relocate repo files so ND2 is the only code
This commit is contained in:
71
share/views/ajax/search/device.tt
Normal file
71
share/views/ajax/search/device.tt
Normal file
@@ -0,0 +1,71 @@
|
||||
<table id="ds-data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Device</th>
|
||||
<th>Contact</th>
|
||||
<th>Location</th>
|
||||
<th>System Name</th>
|
||||
<th>Model</th>
|
||||
<th>OS Version</th>
|
||||
<th>Management IP</th>
|
||||
<th>Serial</th>
|
||||
<th>Last Discovered</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var table = $('#ds-data-table').dataTable({
|
||||
"deferRender": true,
|
||||
"data": [% results %],
|
||||
"columns": [{
|
||||
"data": 'ip',
|
||||
"render": function(data, type, row, meta) {
|
||||
return '<a href="[% uri_for('/device') %]?q=' + encodeURIComponent(data) + '">' + he.encode(row.dns || row.name || row.ip) + '</a>';
|
||||
}
|
||||
}, {
|
||||
"data": 'contact',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
}
|
||||
}, {
|
||||
"data": 'location',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
}
|
||||
}, {
|
||||
"data": 'name',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
}
|
||||
}, {
|
||||
"data": 'model',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
}
|
||||
}, {
|
||||
"data": 'os_ver',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
}
|
||||
}, {
|
||||
"data": 'ip',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
}
|
||||
}, {
|
||||
"data": 'serial',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
}
|
||||
}, {
|
||||
"data": 'last_discover_stamp',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
}
|
||||
}
|
||||
],
|
||||
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
|
||||
});
|
||||
});</script>
|
||||
12
share/views/ajax/search/device_csv.tt
Normal file
12
share/views/ajax/search/device_csv.tt
Normal file
@@ -0,0 +1,12 @@
|
||||
[% USE CSV -%]
|
||||
[% CSV.dump(['Device','Contact','Location','System Name','Model','OS Version','Management IP','Serial']) %]
|
||||
|
||||
[% FOREACH row IN results %]
|
||||
[% mylist = [] %]
|
||||
[% device = row.dns || row.ip %]
|
||||
[% FOREACH col IN [ device row.contact row.location row.name row.model row.os_ver row.ip row.serial] %]
|
||||
[% mylist.push(col) %]
|
||||
[% END %]
|
||||
[% CSV.dump(mylist) %]
|
||||
|
||||
[% END %]
|
||||
216
share/views/ajax/search/node_by_ip.tt
Normal file
216
share/views/ajax/search/node_by_ip.tt
Normal file
@@ -0,0 +1,216 @@
|
||||
[% USE date(format = '%Y-%m-%d %H:%M') %]
|
||||
[% USE Number.Format %]
|
||||
<table id="nsbi-data-table" class="table table-bordered table-hover" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>MAC</th>
|
||||
<th>Match</th>
|
||||
<th class="nd_center-cell">Device or Node</th>
|
||||
[% IF params.stamps %]
|
||||
<th>First Seen</th>
|
||||
<th>Last Seen</th>
|
||||
[% END %]
|
||||
</tr>
|
||||
</thead>
|
||||
</tbody>
|
||||
[% WHILE (row = macs.next) %]
|
||||
[% IF row.nbname %]
|
||||
<tr>
|
||||
<td>MAC: <a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]">
|
||||
[% row.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% row.oui.abbrev | uri %]">
|
||||
[% row.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>NetBIOS</td>
|
||||
<td class="nd_linkcell nd_center-cell">\\<a href="[% uri_for('/report/netbios') %]?domain=[% row.domain | uri %]" title="Devices in this Domain">[% row.domain | html_entity %]</a>\<a href="[% search_node %]&q=[% row.nbname | uri %]">[% row.nbname | html_entity %]</a>
|
||||
<br>[% row.nbuser || '[No User]' | html_entity %]@<a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a>
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% row.time_first_stamp | html_entity %]</td>
|
||||
<td>[% row.time_last_stamp | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% ELSE %]
|
||||
<tr>
|
||||
<td>MAC: <a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]">
|
||||
[% row.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% row.oui.abbrev | uri %]">
|
||||
[% row.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>IP → MAC</td>
|
||||
<td class="nd_center-cell">
|
||||
<a href="[% search_node %]&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 %]
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% row.time_first_stamp | html_entity %]</td>
|
||||
<td>[% row.time_last_stamp | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
[% FOREACH nbt IN row.netbios %]
|
||||
<tr>
|
||||
<td>MAC: <a href="[% search_node %]&q=[% nbt.net_mac.$mac_format_call | uri %]">
|
||||
[% nbt.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% nbt.oui.abbrev | uri %]">
|
||||
[% nbt.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>NetBIOS</td>
|
||||
<td class="nd_linkcell nd_center-cell">\\<a href="[% uri_for('/report/netbios') %]?domain=[% nbt.domain | uri %]" title="Devices in this Domain">[% nbt.domain | html_entity %]</a>\<a href="[% search_node %]&q=[% nbt.nbname | uri %]">[% nbt.nbname | html_entity %]</a>
|
||||
<br>[% nbt.nbuser || '[No User]' | html_entity %]@<a href="[% search_node %]&q=[% nbt.ip | uri %]">[% nbt.ip | html_entity %]</a>
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% date.format(nbt.time_first) | html_entity %]</td>
|
||||
<td>[% date.format(nbt.time_last) | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
[% FOREACH ni IN row.nodeips %]
|
||||
<tr>
|
||||
<td>MAC: <a href="[% search_node %]&q=[% ni.net_mac.$mac_format_call | uri %]">
|
||||
[% ni.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% ni.oui.abbrev | uri %]">
|
||||
[% ni.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>IP → MAC</td>
|
||||
<td class="nd_center-cell">
|
||||
<a href="[% search_node %]&q=[% ni.ip | uri %]">[% ni.ip | html_entity %]</a>
|
||||
[% ' <i class="icon-book text-warning"></i> ' IF NOT ni.active %]
|
||||
[% ' (' _ ni.dns.remove(settings.domain_suffix) _ ')' IF ni.dns %]
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% date.format(ni.time_first) | html_entity %]</td>
|
||||
<td>[% date.format(ni.time_last) | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
[% FOREACH node IN row.node_sightings(archive_filter) %]
|
||||
<tr>
|
||||
<td>MAC: <a href="[% search_node %]&q=[% node.net_mac.$mac_format_call | uri %]">
|
||||
[% node.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% node.oui.abbrev | uri %]">
|
||||
[% node.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>Switch Port</td>
|
||||
<td class="nd_center-cell">
|
||||
<a class="nd_linkcell"
|
||||
href="[% device_ports %]&q=[% node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on&prefer=port">
|
||||
[% node.switch | html_entity %] - [% node.port | html_entity %]
|
||||
[% ' <i class="icon-book text-warning"></i>' IF NOT node.active %]</a>
|
||||
[% IF node.device.dns AND node.device_port AND node.device_port.name %]
|
||||
([% node.device.dns | html_entity %] - [% node.device_port.name | html_entity %])
|
||||
[% END %]
|
||||
on vlan [% node.vlan %]
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% node.time_first_stamp | html_entity %]</td>
|
||||
<td>[% node.time_last_stamp | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% FOREACH wlan IN node.wireless %]
|
||||
<tr>
|
||||
<td>MAC: <a href="[% search_node %]&q=[% wlan.net_mac.$mac_format_call | uri %]">
|
||||
[% wlan.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% wlan.oui.abbrev | uri %]">
|
||||
[% wlan.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>Wireless Info</td>
|
||||
<td class="nd_center-cell">SSID: [% wlan.ssid | html_entity %]<br>
|
||||
MaxRate: [% wlan.maxrate | html_entity %]Mbps TxRate: [% wlan.txrate | html_entity %]Mbps<br>
|
||||
SigStr: [% wlan.sigstrength | html_entity %] SigQual: [% wlan.sigqual | html_entity %]<br>
|
||||
Rx: [% wlan.rxpkt | format_number %] pkts, [% wlan.rxbyte | format_number %] bytes<br>
|
||||
Tx: [% wlan.txpkt | format_number %] pkts, [% wlan.txbyte | format_number %] bytes<br>
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td> </td>
|
||||
<td>[% date.format(wlan.time_last) | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% FOREACH nodeip IN row.ip_aliases(archive_filter) %]
|
||||
<tr>
|
||||
<td>MAC: <a href="[% search_node %]&q=[% nodeip.net_mac.$mac_format_call | uri %]">
|
||||
[% nodeip.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% nodeip.oui.abbrev | uri %]">
|
||||
[% nodeip.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>MAC → IP</td>
|
||||
<td class="nd_center-cell">
|
||||
<a href="[% search_node %]&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 %]
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% nodeip.time_first_stamp | html_entity %]</td>
|
||||
<td>[% nodeip.time_last_stamp | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<style>
|
||||
tr.group,
|
||||
tr.group:hover {
|
||||
background-color: #ddd !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var table = $('#nsbi-data-table').DataTable({
|
||||
"columnDefs": [
|
||||
{ "visible": false, "targets": 0 }
|
||||
],
|
||||
"order": [[ 0, 'asc' ]],
|
||||
"drawCallback": function ( settings ) {
|
||||
var api = this.api();
|
||||
var rows = api.rows( {page:'current'} ).nodes();
|
||||
var last=null;
|
||||
|
||||
api.column(0, {page:'current'} ).data().each( function ( group, i ) {
|
||||
if ( last !== group ) {
|
||||
$(rows).eq( i ).before(
|
||||
[% IF params.stamps %]
|
||||
'<tr class="group"><td colspan="4">'+group+'</td></tr>'
|
||||
[% ELSE %]
|
||||
'<tr class="group"><td colspan="2">'+group+'</td></tr>'
|
||||
[% END %]
|
||||
);
|
||||
|
||||
last = group;
|
||||
}
|
||||
} );
|
||||
},
|
||||
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
|
||||
} );
|
||||
|
||||
// Order by the grouping
|
||||
$('#nsbi-data-table tbody').on( 'click', 'tr.group', function () {
|
||||
var currentOrder = table.order()[0];
|
||||
if ( currentOrder[0] === 0 && currentOrder[1] === 'asc' ) {
|
||||
table.order( [ 0, 'desc' ] ).draw();
|
||||
}
|
||||
else {
|
||||
table.order( [ 0, 'asc' ] ).draw();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
176
share/views/ajax/search/node_by_mac.tt
Normal file
176
share/views/ajax/search/node_by_mac.tt
Normal file
@@ -0,0 +1,176 @@
|
||||
[% USE Number.Format %]
|
||||
<table id="nsbm-data-table" class="table table-bordered table-hover" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>MAC</th>
|
||||
<th>Match</th>
|
||||
<th class="nd_center-cell">Device or Node</th>
|
||||
[% IF params.stamps %]
|
||||
<th>First Seen</th>
|
||||
<th>Last Seen</th>
|
||||
[% END %]
|
||||
</tr>
|
||||
</thead>
|
||||
</tbody>
|
||||
[% WHILE (row = ips.next) %]
|
||||
<tr>
|
||||
<td>
|
||||
MAC: <a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]">
|
||||
[% row.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% row.oui.abbrev | uri %]">
|
||||
[% row.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>MAC → IP</td>
|
||||
<td class="nd_center-cell"><a href="[% search_node %]&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 %]
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% row.time_first_stamp | html_entity %]</td>
|
||||
<td>[% row.time_last_stamp | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
[% WHILE (node = sightings.next) %]
|
||||
<tr>
|
||||
<td>
|
||||
MAC: <a href="[% search_node %]&q=[% node.net_mac.$mac_format_call | uri %]">
|
||||
[% node.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% node.oui.abbrev | uri %]">
|
||||
[% node.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>Switch Port</td>
|
||||
<td class="nd_center-cell">
|
||||
<a href="[% device_ports %]&q=[% node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on&prefer=port">
|
||||
[% node.switch | html_entity %] - [% node.port | html_entity %]</a>
|
||||
[% ' <i class="icon-book text-warning"></i> ' IF NOT node.active %]
|
||||
[% IF node.device.dns AND node.device_port AND node.device_port.name %]
|
||||
([% node.device.dns | html_entity %] - [% node.device_port.name | html_entity %])
|
||||
[% END %]
|
||||
on vlan [% node.vlan %]
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% node.time_first_stamp | html_entity %]</td>
|
||||
<td>[% node.time_last_stamp | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
[% WHILE (port = ports.next) %]
|
||||
<tr>
|
||||
<td>
|
||||
MAC: <a href="[% search_node %]&q=[% port.net_mac.$mac_format_call | uri %]">[% port.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% port.oui.abbrev | uri %]">
|
||||
[% port.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>Switch Port</td>
|
||||
<td class="nd_center-cell">
|
||||
<a href="[% device_ports %]&q=[% port.ip | uri %]&f=[% port.port | uri %]&c_mac=on&c_nodes=on&c_neighbors=on">
|
||||
[% port.ip | html_entity %] - [% port.descr | html_entity %]</a>
|
||||
[% IF port.device.dns AND port.name %]
|
||||
([% port.device.dns | html_entity %] - [% port.name | html_entity %])
|
||||
[% END %]
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% port.creation | html_entity %]</td>
|
||||
<td>[% port.creation | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
[% WHILE (nbt = netbios.next) %]
|
||||
<tr>
|
||||
<td>
|
||||
MAC: <a href="[% search_node %]&q=[% nbt.net_mac.$mac_format_call | uri %]">[% nbt.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% nbt.oui.abbrev | uri %]">
|
||||
[% nbt.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>NetBIOS</td>
|
||||
<td class="nd_center-cell">\\<a href="[% uri_for('/report/netbios') %]?domain=[% nbt.domain | uri %]" title="Devices in this Domain">[% nbt.domain | html_entity %]</a>\<a href="[% search_node %]&q=[% nbt.nbname | uri %]">[% nbt.nbname | html_entity %]</a>
|
||||
<br>[% nbt.nbuser || '[No User]' | html_entity %]@<a href="[% search_node %]&q=[% nbt.ip | uri %]">[% nbt.ip | html_entity %]</a>
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td>[% nbt.time_first_stamp | html_entity %]</td>
|
||||
<td>[% nbt.time_last_stamp | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
[% WHILE (wlan = wireless.next) %]
|
||||
<tr>
|
||||
<td>
|
||||
MAC: <a href="[% search_node %]&q=[% wlan.net_mac.$mac_format_call | uri %]">[% wlan.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% wlan.oui.abbrev | uri %]">
|
||||
[% wlan.oui.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
</td>
|
||||
<td>Wireless Info</td>
|
||||
<td class="nd_center-cell">SSID: [% wlan.ssid | html_entity %]<br>
|
||||
MaxRate: [% wlan.maxrate | html_entity %]Mbps TxRate: [% wlan.txrate | html_entity %]Mbps<br>
|
||||
SigStr: [% wlan.sigstrength | html_entity %] SigQual: [% wlan.sigqual | html_entity %]<br>
|
||||
Rx: [% wlan.rxpkt | format_number %] pkts, [% wlan.rxbyte | format_number %] bytes<br>
|
||||
Tx: [% wlan.txpkt | format_number %] pkts, [% wlan.txbyte | format_number %] bytes<br>
|
||||
</td>
|
||||
[% IF params.stamps %]
|
||||
<td> </td>
|
||||
<td>[% wlan.get_column('time_last_stamp') | html_entity %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<style>
|
||||
tr.group,
|
||||
tr.group:hover {
|
||||
background-color: #ddd !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var table = $('#nsbm-data-table').DataTable({
|
||||
"columnDefs": [
|
||||
{ "visible": false, "targets": 0 }
|
||||
],
|
||||
"order": [[ 0, 'asc' ]],
|
||||
"drawCallback": function ( settings ) {
|
||||
var api = this.api();
|
||||
var rows = api.rows( {page:'current'} ).nodes();
|
||||
var last=null;
|
||||
|
||||
api.column(0, {page:'current'} ).data().each( function ( group, i ) {
|
||||
if ( last !== group ) {
|
||||
$(rows).eq( i ).before(
|
||||
[% IF params.stamps %]
|
||||
'<tr class="group"><td colspan="4">'+group+'</td></tr>'
|
||||
[% ELSE %]
|
||||
'<tr class="group"><td colspan="2">'+group+'</td></tr>'
|
||||
[% END %]
|
||||
);
|
||||
|
||||
last = group;
|
||||
}
|
||||
} );
|
||||
},
|
||||
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
|
||||
} );
|
||||
|
||||
// Order by the grouping
|
||||
$('#nsbm-data-table tbody').on( 'click', 'tr.group', function () {
|
||||
var currentOrder = table.order()[0];
|
||||
if ( currentOrder[0] === 0 && currentOrder[1] === 'asc' ) {
|
||||
table.order( [ 0, 'desc' ] ).draw();
|
||||
}
|
||||
else {
|
||||
table.order( [ 0, 'asc' ] ).draw();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
48
share/views/ajax/search/port.tt
Normal file
48
share/views/ajax/search/port.tt
Normal file
@@ -0,0 +1,48 @@
|
||||
<table id="ps-data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Port</th>
|
||||
<th>Description</th>
|
||||
<th>Vlan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var table = $('#ps-data-table').dataTable({
|
||||
"deferRender": true,
|
||||
"data": [% results %],
|
||||
"columns": [{
|
||||
"data": 'name',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
}
|
||||
}, {
|
||||
"data": 'ip',
|
||||
"render": function(data, type, row, meta) {
|
||||
var ddns = '';
|
||||
if (row.device.dns || row.device.name) {
|
||||
ddns = ' (' + he.encode(row.device.dns || row.device.name) + ')';
|
||||
}
|
||||
return '<a href="[% device_ports %]&q=' + encodeURIComponent(data)
|
||||
+ '&f=' + encodeURIComponent(row.port) + '">' + he.encode(data)
|
||||
+ ' [' + he.encode(row.port) + ']</a>' + ddns;
|
||||
}
|
||||
}, {
|
||||
"data": 'descr',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
}
|
||||
}, {
|
||||
"data": 'port_vlans.vlan',
|
||||
"render": function(data, type, row, meta) {
|
||||
return data || '';
|
||||
}
|
||||
}
|
||||
],
|
||||
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
|
||||
});
|
||||
});</script>
|
||||
|
||||
12
share/views/ajax/search/port_csv.tt
Normal file
12
share/views/ajax/search/port_csv.tt
Normal file
@@ -0,0 +1,12 @@
|
||||
[% USE CSV -%]
|
||||
[% CSV.dump([ 'Name' 'Port' 'Description' 'Vlan' ]) %]
|
||||
|
||||
[% FOREACH row IN results %]
|
||||
[% mylist = [] %]
|
||||
[% myport = "$row.ip [ $row.port ] (" _ (row.device.dns || row.device.name) _ ")" IF (row.device.dns || row.device.name) %]
|
||||
[% FOREACH col IN [ row.name myport row.descr row.port_vlans.vlan ] %]
|
||||
[% mylist.push(col) %]
|
||||
[% END %]
|
||||
[% CSV.dump(mylist) %]
|
||||
|
||||
[% END %]
|
||||
53
share/views/ajax/search/vlan.tt
Normal file
53
share/views/ajax/search/vlan.tt
Normal file
@@ -0,0 +1,53 @@
|
||||
<table id="vs-data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Vlan</th>
|
||||
<th>Device</th>
|
||||
<th>Description</th>
|
||||
<th>Model</th>
|
||||
<th>OS</th>
|
||||
<th>Vendor</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var table = $('#vs-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>';
|
||||
}
|
||||
}
|
||||
],
|
||||
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
|
||||
});
|
||||
});</script>
|
||||
12
share/views/ajax/search/vlan_csv.tt
Normal file
12
share/views/ajax/search/vlan_csv.tt
Normal file
@@ -0,0 +1,12 @@
|
||||
[% USE CSV -%]
|
||||
[% CSV.dump([ 'Vlan' 'Device' 'Description' 'Model' 'OS' 'Vendor' ]) %]
|
||||
|
||||
[% FOREACH row IN results %]
|
||||
[% mylist = [] %]
|
||||
[% device = row.dns || row.ip %]
|
||||
[% FOREACH col IN [ row.vlans.vlan device row.vlans.description row.model row.os row.vendor ] %]
|
||||
[% mylist.push(col) %]
|
||||
[% END %]
|
||||
[% CSV.dump(mylist) %]
|
||||
|
||||
[% END %]
|
||||
Reference in New Issue
Block a user