diff --git a/share/config.yml b/share/config.yml index 508403b6..f81406e5 100644 --- a/share/config.yml +++ b/share/config.yml @@ -278,6 +278,10 @@ defanged_api_admin: 'api_admin' hide_deviceports: 'group:__ANY__': - 'group:__HIDE_NOTPRESENT_TYPES__' +external_links: + node: [] + device: [] + device_port: [] # ------------- # NETDISCO CORE diff --git a/share/public/css/netdisco.css b/share/public/css/netdisco.css index 7ad931bc..1acfda55 100644 --- a/share/public/css/netdisco.css +++ b/share/public/css/netdisco.css @@ -357,7 +357,8 @@ td > form.nd_inline-form { } /* for the tagged vlans total when hiding the full list */ -.nd_vlan-total { +/* and external links from node search */ +.nd_vlan-total, .nd_node-ext-link { float: right; } diff --git a/share/views/ajax/device/details.tt b/share/views/ajax/device/details.tt index 4c61a2af..836e845a 100644 --- a/share/views/ajax/device/details.tt +++ b/share/views/ajax/device/details.tt @@ -1,3 +1,4 @@ +[% PROCESS 'externallinks.tt' -%] [% SET user_can_port_control = user_has_role('port_control', d) %]
| Administration | +External Links | SSH @@ -123,6 +124,7 @@ Telnet Web + [% INCLUDE external_device_links item = d %] | |||||||||||||||||||||||
| NetBIOS | \\[% row.domain | html_entity %]\[% row.nbname | html_entity %] @@ -42,6 +44,7 @@ [% row.oui.company | html_entity %] ) [% END %] seen as: + [% INCLUDE external_mac_links item = row %] | IP → MAC | @@ -64,6 +67,7 @@ [% nbt.oui.company | html_entity %] ) [% END %] seen as: + [% INCLUDE external_mac_links item = nbt %] | NetBIOS | \\[% nbt.domain | html_entity %]\[% nbt.nbname | html_entity %] @@ -84,6 +88,7 @@ [% ni.oui.company | html_entity %] ) [% END %] seen as: + [% INCLUDE external_mac_links item = ni %] | IP → MAC | @@ -106,6 +111,7 @@ [% node.oui.company | html_entity %] ) [% END %] seen as: + [% INCLUDE external_mac_links item = node %] | Node on Port | @@ -129,6 +135,7 @@ [% wlan.oui.company | html_entity %] ) [% END %] seen as: + [% INCLUDE external_mac_links item = wlan %] | Wireless Info | SSID: [% wlan.ssid | html_entity %] @@ -153,12 +160,14 @@ [% nodeip.oui.company | html_entity %] ) [% END %] seen as: + [% INCLUDE external_mac_links item = nodeip %] |
MAC → IP |
[% nodeip.ip | html_entity %]
[% ' ' IF NOT nodeip.active %]
[% ' (' _ nodeip.dns.remove(settings.domain_suffix) _ ')' IF nodeip.dns %]
+ [% INCLUDE external_ip_links item = nodeip %] |
[% IF params.stamps %]
[% nodeip.time_first_stamp | html_entity %] | diff --git a/share/views/ajax/search/node_by_mac.tt b/share/views/ajax/search/node_by_mac.tt index 11179653..befd95ff 100644 --- a/share/views/ajax/search/node_by_mac.tt +++ b/share/views/ajax/search/node_by_mac.tt @@ -1,4 +1,5 @@ [% USE Number.Format %] +[% PROCESS 'externallinks.tt' -%]
| MAC → IP | [% row.ip | html_entity %]
[% ' ' IF NOT row.active %]
[% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %]
+ [% INCLUDE external_ip_links item = row %] |
[% IF params.stamps %]
[% row.time_first_stamp | html_entity %] | @@ -46,6 +49,7 @@ [% node.oui.company | html_entity %] ) [% END %] seen as: + [% INCLUDE external_mac_links item = node %]Node on Port | @@ -72,6 +76,7 @@ [% port.oui.company | html_entity %] ) [% END %] seen as: + [% INCLUDE external_mac_links item = port %] | Device Port | @@ -94,6 +99,7 @@ [% nbt.oui.company | html_entity %] ) [% END %] seen as: + [% INCLUDE external_mac_links item = nbt %] | NetBIOS | \\[% nbt.domain | html_entity %]\[% nbt.nbname | html_entity %] @@ -114,6 +120,7 @@ [% wlan.oui.company | html_entity %] ) [% END %] seen as: + [% INCLUDE external_mac_links item = wlan %] | Wireless Info | SSID: [% wlan.ssid | html_entity %] diff --git a/share/views/externallinks.tt b/share/views/externallinks.tt new file mode 100644 index 00000000..c2fc3205 --- /dev/null +++ b/share/views/externallinks.tt @@ -0,0 +1,26 @@ +[% BLOCK external_link %] + + [% link.displayname | html_entity %] +[% END %] +[% BLOCK external_mac_links %] + [% FOREACH link IN settings.external_links.node.reverse %] + [% NEXT UNLESS link.for_mac %] + [% mac_format = 'as_' _ (link.mac_format.lower || 'ieee') %] + [% node = item.net_mac.$mac_format FILTER uri %] + [% PROCESS external_link %] + + [% END %] +[% END %] +[% BLOCK external_ip_links %] + [% FOREACH link IN settings.external_links.node.reverse %] + [% NEXT UNLESS link.for_ip %] + [% node = item.ip FILTER uri %] + [% PROCESS external_link %] + [% END %] +[% END %] +[% BLOCK external_device_links %] + [% FOREACH link IN settings.external_links.device.reverse %] + [% device = item.ip FILTER uri %] + [% PROCESS external_link %] + [% END %] +[% END %] |