When linking to devices, use the DNS name in preference to the IP

This commit is contained in:
Oliver Gorwits
2013-02-10 15:31:55 +00:00
parent b7e971074f
commit 4d832cb2a5
14 changed files with 41 additions and 29 deletions

View File

@@ -14,10 +14,10 @@
<td>[% row.alias %]</a>
<td>[% row.dns.remove(settings.domain_suffix) %]</a>
<td class="center_cell"><a class="nd_linkcell"
href="[% device_ports %]&q=[% row.ip %]&f=[% row.port %]">[% row.port %]</a></td>
href="[% device_ports %]&q=[% params.q | uri %]&f=[% row.port | uri %]">[% row.port %]</a></td>
<td>[% row.device_port.name %]</td>
<td><a class="nd_linkcell"
href="[% search_device %]&ip=[% row.subnet %]">[% row.subnet %]</a></td>
href="[% search_device %]&ip=[% row.subnet | uri %]">[% row.subnet %]</a></td>
</tr>
[% END %]
</tbody>

View File

@@ -60,7 +60,7 @@ function to_class(name) { return 'nd_' + name.replace(/\./g, "_") }
// handler for clicking on a circle - redirect to that device's netmap
function circleClick(d) {
window.location = '[% uri_for('/device') %]?tab=netmap&q=' + d.ip;
window.location = '[% uri_for('/device') %]?tab=netmap&q=' + (d.name || d.ip);
}
// handler for mouseover on a circle - show that device's real neighbors

View File

@@ -182,7 +182,7 @@
[% IF params.c_neighbors AND row.remote_ip %]
[% IF row.neighbor %]
<a href="[% uri_for('/device',
self_options) %]&q=[% row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]">
self_options) %]&q=[% row.neighbor.dns || row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]">
[% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip %]
([% row.remote_port | html_entity %])</a>
[% ELSE %]

View File

@@ -14,7 +14,7 @@
</tbody>
[% WHILE (row = results.next) %]
<tr>
<td><a href="[% uri_for('/device') %]?q=[% row.ip %]">[% row.dns.remove(settings.domain_suffix) || row.ip %]</a></td>
<td><a href="[% uri_for('/device') %]?q=[% row.dns || row.ip %]">[% row.dns || row.ip %]</a></td>
<td>[% row.contact %]</td>
<td>[% row.location %]</td>
<td>[% row.name %]</td>

View File

@@ -38,8 +38,8 @@
<td>&nbsp;</td>
[% END %]
<td>Switch Port</td>
<td><a href="[% device_ports %]&q=[% node.switch | url %]&f=[% node.port | url %]&c_nodes=on&c_neighbor=on">[% node.switch %] [ [% node.port %] ]</a>
[% ' (' _ node.device.dns.remove(settings.domain_suffix) _ ')' IF node.device.dns %]
<td><a href="[% device_ports %]&q=[% node.device.dns || node.switch %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on">[% node.switch %] [ [% node.port %] ]</a>
[% ' (' _ node.device.dns _ ')' IF node.device.dns %]
[% ' <span class="label label-warning">A</span>' IF NOT node.active %]
</td>
[% IF params.stamps %]

View File

@@ -66,8 +66,8 @@
</td>
[% END %]
<td>Switch Port</td>
<td><a href="[% device_ports %]&q=[% node.switch | url %]&f=[% node.port | url %]&c_nodes=on&c_neighbor=on">[% node.switch %] [ [% node.port %] ]</a>
[% ' (' _ node.device.dns.remove(settings.domain_suffix) _ ')' IF node.device.dns %]
<td><a href="[% device_ports %]&q=[% node.device.dns || node.switch %]&f=[% node.port %]&c_nodes=on&c_neighbors=on">[% node.switch %] [ [% node.port %] ]</a>
[% ' (' _ node.device.dns _ ')' IF node.device.dns %]
[% ' <span class="label label-warning">A</span>' IF NOT node.active %]
</td>
[% IF params.stamps %]
@@ -97,8 +97,8 @@
</td>
[% END %]
<td>Switch Port</td>
<td><a href="[% device_ports %]&q=[% port.ip | url %]&f=[% port.port | url %]&c_nodes=on&c_neighbor=on">[% port.ip %] [ [% port.port %] ]</a>
[% ' (' _ port.device.dns.remove(settings.domain_suffix) _ ')' IF port.device.dns %]
<td><a href="[% device_ports %]&q=[% port.device.dns || port.ip %]&f=[% port.port %]&c_mac=on&c_nodes=on&c_neighbors=on">[% port.ip %] [ [% port.port %] ]</a>
[% ' (' _ port.device.dns _ ')' IF port.device.dns %]
</td>
[% IF params.stamps %]
<td>[% port.creation %]</td>

View File

@@ -11,8 +11,8 @@
[% WHILE (row = results.next) %]
<tr>
<td>[% row.name %]</td>
<td><a href="[% device_ports %]&q=[% row.ip %]&f=[% row.port %]">[% row.ip %] [ [% row.port %] ]</a>
[% ' (' _ row.device.dns.remove(settings.domain_suffix) _ ')' IF row.device.dns %]
<td><a href="[% device_ports %]&q=[% row.device.dns || row.ip %]&f=[% row.port %]">[% row.ip %] [ [% row.port %] ]</a>
[% ' (' _ row.device.dns _ ')' IF row.device.dns %]
</td>
<td>[% row.descr %]</td>
<td>[% row.vlan %]</td>

View File

@@ -13,17 +13,17 @@
[% WHILE (row = results.next) %]
<tr>
<td><a class="nd_linkcell nd_stealthlink"
href="[% device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vlan.vlan %]</a></td>
href="[% device_ports %]&q=[% row.dns || row.ip %]&f=[% row.vlan.vlan %]">[% row.vlan.vlan %]</a></td>
<td><a class="nd_linkcell"
href="[% device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.dns.remove(settings.domain_suffix) || row.ip %]</a></td>
href="[% device_ports %]&q=[% row.dns || row.ip %]&f=[% row.vlan.vlan %]">[% row.dns || row.ip %]</a></td>
<td><a class="nd_linkcell nd_stealthlink"
href="[% device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vlan.description %]</a></td>
href="[% device_ports %]&q=[% row.dns || row.ip %]&f=[% row.vlan.vlan %]">[% row.vlan.description %]</a></td>
<td><a class="nd_linkcell nd_stealthlink"
href="[% device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.model %]</a></td>
href="[% device_ports %]&q=[% row.dns || row.ip %]&f=[% row.vlan.vlan %]">[% row.model %]</a></td>
<td><a class="nd_linkcell nd_stealthlink"
href="[% device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.os %]</a></td>
href="[% device_ports %]&q=[% row.dns || row.ip %]&f=[% row.vlan.vlan %]">[% row.os %]</a></td>
<td><a class="nd_linkcell nd_stealthlink"
href="[% device_ports %]&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vendor %]</a></td>
href="[% device_ports %]&q=[% row.dns || row.ip %]&f=[% row.vlan.vlan %]">[% row.vendor %]</a></td>
</tr>
[% END %]
</tbody>