#1118 user configurable external links from node search and device details
* frontend example * process config with template macro * shared external links template for mac and IP search * default into product config * add support for device external links * better presentation of IP links and change color to grey
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -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; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,3 +1,4 @@ | ||||
| [% PROCESS 'externallinks.tt' -%] | ||||
| [% SET user_can_port_control = user_has_role('port_control', d) %] | ||||
| <table class="table table-condensed table-striped"> | ||||
|   <tbody> | ||||
| @@ -115,7 +116,7 @@ | ||||
|     [% END %] | ||||
|     [% END %] | ||||
|     <tr> | ||||
|       <td>Administration</td> | ||||
|       <td>External Links</td> | ||||
|       <td> | ||||
|         <a href="ssh://[% d.ip | uri %]" target="_blank"> | ||||
|           <span class="label label-info"><i class="icon-keyboard"></i> SSH</span></a> | ||||
| @@ -123,6 +124,7 @@ | ||||
|           <span class="label label-info"><i class="icon-keyboard"></i> Telnet</span></a> | ||||
|         <a href="https://[% d.ip | uri %]/" target="_blank"> | ||||
|           <span class="label label-info"><i class="icon-external-link"></i> Web</span></a> | ||||
|         [% INCLUDE external_device_links item = d %] | ||||
|       </td> | ||||
|     </tr> | ||||
|     <tr> | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| [% USE date(format = '%Y-%m-%d %H:%M') %] | ||||
| [% USE Number.Format %] | ||||
| [% PROCESS 'externallinks.tt' -%] | ||||
| <table id="nsbi-data-table" class="table table-bordered table-hover" width="100%" cellspacing="0"> | ||||
|   <thead> | ||||
|     <tr> | ||||
| @@ -23,6 +24,7 @@ | ||||
|         [% row.oui.company | html_entity %]</a> ) | ||||
|       [% END %] | ||||
|       seen as: | ||||
|       [% INCLUDE external_mac_links item = row %] | ||||
|       </td> | ||||
|       <td>NetBIOS</td> | ||||
|       <td class="nd_linkcell nd_center-cell">\\<a href="[% uri_for('/report/netbios') | none %]?domain=[% row.domain | uri %]" title="Devices in this Domain">[% row.domain | html_entity %]</a>\<a href="[% search_node | none %]&q=[% row.nbname | uri %]">[% row.nbname | html_entity %]</a> | ||||
| @@ -42,6 +44,7 @@ | ||||
|         [% row.oui.company | html_entity %]</a> ) | ||||
|       [% END %] | ||||
|       seen as: | ||||
|       [% INCLUDE external_mac_links item = row %] | ||||
|       </td> | ||||
|       <td>IP → MAC</td> | ||||
|       <td class="nd_center-cell"> | ||||
| @@ -64,6 +67,7 @@ | ||||
|         [% nbt.oui.company | html_entity %]</a> ) | ||||
|       [% END %] | ||||
|       seen as: | ||||
|       [% INCLUDE external_mac_links item = nbt %] | ||||
|       </td> | ||||
|       <td>NetBIOS</td> | ||||
|       <td class="nd_linkcell nd_center-cell">\\<a href="[% uri_for('/report/netbios') | none %]?domain=[% nbt.domain | uri %]" title="Devices in this Domain">[% nbt.domain | html_entity %]</a>\<a href="[% search_node | none %]&q=[% nbt.nbname | uri %]">[% nbt.nbname | html_entity %]</a> | ||||
| @@ -84,6 +88,7 @@ | ||||
|         [% ni.oui.company | html_entity %]</a> ) | ||||
|       [% END %] | ||||
|       seen as: | ||||
|       [% INCLUDE external_mac_links item = ni %] | ||||
|       </td> | ||||
|       <td>IP → MAC</td> | ||||
|       <td class="nd_center-cell"> | ||||
| @@ -106,6 +111,7 @@ | ||||
|         [% node.oui.company | html_entity %]</a> ) | ||||
|       [% END %] | ||||
|       seen as: | ||||
|       [% INCLUDE external_mac_links item = node %] | ||||
|       </td> | ||||
|       <td>Node on Port</td> | ||||
|       <td class="nd_center-cell"> | ||||
| @@ -129,6 +135,7 @@ | ||||
|         [% wlan.oui.company | html_entity %]</a> ) | ||||
|         [% END %] | ||||
|         seen as: | ||||
|         [% INCLUDE external_mac_links item = wlan %] | ||||
|         </td> | ||||
|         <td>Wireless Info</td> | ||||
|         <td class="nd_center-cell">SSID: [% wlan.ssid | html_entity %]<br> | ||||
| @@ -153,12 +160,14 @@ | ||||
|         [% nodeip.oui.company | html_entity %]</a> ) | ||||
|       [% END %] | ||||
|       seen as: | ||||
|       [% INCLUDE external_mac_links item = nodeip %] | ||||
|       </td> | ||||
|       <td>MAC → IP</td> | ||||
|       <td class="nd_center-cell"> | ||||
|         <a href="[% search_node | none %]&q=[% nodeip.ip | uri %]">[% nodeip.ip | html_entity %]</a> | ||||
|         [% ' <i class="icon-book text-warning"></i> ' IF NOT nodeip.active %] | ||||
|         [% ' (' _ nodeip.dns.remove(settings.domain_suffix) _ ')' IF nodeip.dns %] | ||||
|         <br/>[% INCLUDE external_ip_links item = nodeip %] | ||||
|       </td> | ||||
|       [% IF params.stamps %] | ||||
|       <td>[% nodeip.time_first_stamp | html_entity %]</td> | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| [% USE Number.Format %] | ||||
| [% PROCESS 'externallinks.tt' -%] | ||||
| <table id="nsbm-data-table" class="table table-bordered table-hover" width="100%" cellspacing="0"> | ||||
|   <thead> | ||||
|     <tr> | ||||
| @@ -22,11 +23,13 @@ | ||||
|         [% row.oui.company | html_entity %]</a> ) | ||||
|       [% END %] | ||||
|       seen as: | ||||
|       [% INCLUDE external_mac_links item = row %] | ||||
|       </td> | ||||
|       <td>MAC → IP</td> | ||||
|       <td class="nd_center-cell"><a href="[% search_node | none %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a> | ||||
|         [% ' <i class="icon-book text-warning"></i> ' IF NOT row.active %] | ||||
|         [% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %] | ||||
|         <br/>[% INCLUDE external_ip_links item = row %] | ||||
|       </td> | ||||
|       [% IF params.stamps %] | ||||
|       <td>[% row.time_first_stamp | html_entity %]</td> | ||||
| @@ -46,6 +49,7 @@ | ||||
|         [% node.oui.company | html_entity %]</a> ) | ||||
|       [% END %] | ||||
|       seen as: | ||||
|       [% INCLUDE external_mac_links item = node %] | ||||
|       </td> | ||||
|       <td>Node on Port</td> | ||||
|       <td class="nd_center-cell"> | ||||
| @@ -72,6 +76,7 @@ | ||||
|         [% port.oui.company | html_entity %]</a> ) | ||||
|       [% END %] | ||||
|       seen as: | ||||
|       [% INCLUDE external_mac_links item = port %] | ||||
|       </td> | ||||
|       <td>Device Port</td> | ||||
|       <td class="nd_center-cell"> | ||||
| @@ -94,6 +99,7 @@ | ||||
|         [% nbt.oui.company | html_entity %]</a> ) | ||||
|       [% END %] | ||||
|       seen as: | ||||
|       [% INCLUDE external_mac_links item = nbt %] | ||||
|       </td> | ||||
|       <td>NetBIOS</td> | ||||
|       <td class="nd_center-cell">\\<a href="[% uri_for('/report/netbios') | none %]?domain=[% nbt.domain | uri %]" title="Devices in this Domain">[% nbt.domain | html_entity %]</a>\<a href="[% search_node | none %]&q=[% nbt.nbname | uri %]">[% nbt.nbname | html_entity %]</a> | ||||
| @@ -114,6 +120,7 @@ | ||||
|         [% wlan.oui.company | html_entity %]</a> ) | ||||
|       [% END %] | ||||
|       seen as: | ||||
|       [% INCLUDE external_mac_links item = wlan %] | ||||
|       </td> | ||||
|       <td>Wireless Info</td> | ||||
|       <td class="nd_center-cell">SSID: [% wlan.ssid | html_entity %]<br> | ||||
|   | ||||
							
								
								
									
										26
									
								
								share/views/externallinks.tt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								share/views/externallinks.tt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| [% BLOCK external_link %] | ||||
| <a href="[% link.url | evaltt %]" target="_blank"> | ||||
|      <span class="label label-default"><i class="icon-external-link"></i> [% link.displayname | html_entity %]</span></a> | ||||
| [% 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 %] | ||||
|     <span class="nd_node-ext-link">[% PROCESS external_link %]</span> | ||||
|     <span class="nd_node-ext-link"> </span> | ||||
|   [% 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 %] | ||||
		Reference in New Issue
	
	Block a user