DataTables for VLAN search results tab
Modify carrying_vlan and carrying_vlan_name searches to use device_vlan table to capture devices carrying a VLAN but no port members
This commit is contained in:
		| @@ -1,4 +1,4 @@ | ||||
| <table class="table table-bordered table-condensed table-striped nd_floatinghead"> | ||||
| <table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0"> | ||||
|   <thead> | ||||
|     <tr> | ||||
|       <th>Vlan</th> | ||||
| @@ -9,22 +9,44 @@ | ||||
|       <th>Vendor</th> | ||||
|     </tr> | ||||
|   </thead> | ||||
|   </tbody> | ||||
|     [% WHILE (row = results.next) %] | ||||
|     <tr> | ||||
|       <td><a class="nd_linkcell nd_stealth-link" | ||||
|         href="[% device_ports %]&q=[% row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.vlan.vlan | html_entity %]</a></td> | ||||
|       <td><a class="nd_linkcell" | ||||
|         href="[% device_ports %]&q=[% row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.dns || row.ip | html_entity %]</a></td> | ||||
|       <td><a class="nd_linkcell nd_stealth-link" | ||||
|         href="[% device_ports %]&q=[% row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.vlan.description | html_entity %]</a></td> | ||||
|       <td><a class="nd_linkcell nd_stealth-link" | ||||
|         href="[% device_ports %]&q=[% row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.model | html_entity %]</a></td> | ||||
|       <td><a class="nd_linkcell nd_stealth-link" | ||||
|         href="[% device_ports %]&q=[% row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.os | html_entity %]</a></td> | ||||
|       <td><a class="nd_linkcell nd_stealth-link" | ||||
|         href="[% device_ports %]&q=[% row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.vendor | html_entity %]</a></td> | ||||
|     </tr> | ||||
|     [% END %] | ||||
|   </tbody> | ||||
| </table> | ||||
|  | ||||
| <script type="text/javascript"> | ||||
| $(document).ready(function() { | ||||
|   var table = $('#data-table').dataTable({ | ||||
|     "deferRender": true, | ||||
|     "data": [% results %], | ||||
|     "columns": [{ | ||||
|         "data": 'vlans.vlan', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + data + '</a>'; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'ip', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(row.dns || row.ip) + '</a>'; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'vlans.description', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>'; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'model', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>'; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'os', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>'; | ||||
|         } | ||||
|       }, { | ||||
|         "data": 'vendor', | ||||
|         "render": function(data, type, row, meta) { | ||||
|           return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>'; | ||||
|         } | ||||
|       } | ||||
|     ] | ||||
|   }); | ||||
| });</script> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user