Merge branch 'master' of ssh://git.code.sf.net/p/netdisco/netdisco-ng

This commit is contained in:
Oliver Gorwits
2014-06-12 14:53:43 +01:00
8 changed files with 282 additions and 157 deletions

View File

@@ -10,30 +10,38 @@ __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
__PACKAGE__->table('ap_radio_channel_power'); __PACKAGE__->table('ap_radio_channel_power');
__PACKAGE__->result_source_instance->is_virtual(1); __PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(<<ENDSQL __PACKAGE__->result_source_instance->view_definition(<<ENDSQL
SELECT distinct d.name as device_name, d.ip, d.dns, d.model, d.location, SELECT w.channel,
dp.port, dp.name as port_name, dp.descr, w.channel, w.power w.power,
FROM device AS d, device_port_wireless AS w, device_port AS dp w.ip,
WHERE dp.port = w.port AND d.ip = w.ip w.port,
ORDER BY d.name dp.name AS port_name,
dp.descr,
d.name AS device_name,
d.dns,
d.model,
d.location,
CASE
WHEN w.power > 0 THEN round((10.0 * log(w.power) / log(10))::numeric, 1)
ELSE NULL
END AS power2
FROM device_port_wireless AS w
JOIN device_port AS dp ON dp.port = w.port
AND dp.ip = w.ip
JOIN device AS d ON d.ip = w.ip
WHERE w.channel != '0'
ENDSQL ENDSQL
); );
__PACKAGE__->add_columns( __PACKAGE__->add_columns(
'device_name' => { 'channel' => {
data_type => 'text', data_type => 'integer',
},
'power' => {
data_type => 'integer',
}, },
'ip' => { 'ip' => {
data_type => 'inet', data_type => 'inet',
}, },
'dns' => {
data_type => 'text',
},
'model' => {
data_type => 'text',
},
'location' => {
data_type => 'text',
},
'port' => { 'port' => {
data_type => 'text', data_type => 'text',
}, },
@@ -43,11 +51,20 @@ __PACKAGE__->add_columns(
'descr' => { 'descr' => {
data_type => 'text', data_type => 'text',
}, },
'channel' => { 'device_name' => {
data_type => 'integer', data_type => 'text',
}, },
'power' => { 'dns' => {
data_type => 'integer', data_type => 'text',
},
'model' => {
data_type => 'text',
},
'location' => {
data_type => 'text',
},
'power2' => {
data_type => 'numeric',
}, },
); );

View File

@@ -12,6 +12,7 @@ my $search_attr = {
order_by => {'-desc' => 'time_last'}, order_by => {'-desc' => 'time_last'},
'+columns' => [ '+columns' => [
'oui.company', 'oui.company',
'oui.abbrev',
{ time_first_stamp => \"to_char(time_first, 'YYYY-MM-DD HH24:MI')" }, { time_first_stamp => \"to_char(time_first, 'YYYY-MM-DD HH24:MI')" },
{ time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')" }, { time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')" },
], ],

View File

@@ -3,6 +3,7 @@ package App::Netdisco::Web::Plugin::Report::ApRadioChannelPower;
use Dancer ':syntax'; use Dancer ':syntax';
use Dancer::Plugin::DBIC; use Dancer::Plugin::DBIC;
use Dancer::Plugin::Auth::Extensible; use Dancer::Plugin::Auth::Extensible;
use App::Netdisco::Util::ExpandParams 'expand_hash';
use App::Netdisco::Web::Plugin; use App::Netdisco::Web::Plugin;
@@ -47,20 +48,48 @@ sub port_tree {
return \%ports; return \%ports;
} }
get '/ajax/content/report/apradiochannelpower/data' => require_role admin =>
sub {
send_error( 'Missing parameter', 400 )
unless ( param('draw') && param('draw') =~ /\d+/ );
my $rs = schema('netdisco')->resultset('Virtual::ApRadioChannelPower');
my $exp_params = expand_hash( scalar params );
my $recordsTotal = $rs->count;
my @data = $rs->get_datatables_data($exp_params)->hri->all;
my $recordsFiltered = $rs->get_datatables_filtered_count($exp_params);
content_type 'application/json';
return to_json(
{ draw => int( param('draw') ),
recordsTotal => int($recordsTotal),
recordsFiltered => int($recordsFiltered),
data => \@data,
}
);
};
get '/ajax/content/report/apradiochannelpower' => require_login sub { get '/ajax/content/report/apradiochannelpower' => require_login sub {
my @set
= schema('netdisco')->resultset('Virtual::ApRadioChannelPower')->all;
my $results = port_tree( \@set ); if ( request->is_ajax ) {
return unless scalar %$results; template 'ajax/report/apradiochannelpower.tt', {},
if (request->is_ajax) {
template 'ajax/report/apradiochannelpower.tt', { results => $results, },
{ layout => undef }; { layout => undef };
} }
else { else {
my @results
= schema('netdisco')->resultset('Virtual::ApRadioChannelPower')
->hri->all;
return unless scalar @results;
header( 'Content-Type' => 'text/comma-separated-values' ); header( 'Content-Type' => 'text/comma-separated-values' );
template 'ajax/report/apradiochannelpower_csv.tt', { results => $results, }, template 'ajax/report/apradiochannelpower_csv.tt',
{ results => \@results, },
{ layout => undef }; { layout => undef };
} }
}; };

View File

@@ -66,6 +66,7 @@ ajax '/ajax/content/search/node' => require_login sub {
order_by => {'-desc' => 'time_last'}, order_by => {'-desc' => 'time_last'},
'+columns' => [ '+columns' => [
'oui.company', 'oui.company',
'oui.abbrev',
{ time_first_stamp => \"to_char(time_first, 'YYYY-MM-DD HH24:MI')" }, { time_first_stamp => \"to_char(time_first, 'YYYY-MM-DD HH24:MI')" },
{ time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')" }, { time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')" },
], ],
@@ -77,6 +78,7 @@ ajax '/ajax/content/search/node' => require_login sub {
order_by => {'-desc' => 'time_last'}, order_by => {'-desc' => 'time_last'},
'+columns' => [ '+columns' => [
'oui.company', 'oui.company',
'oui.abbrev',
{ time_first_stamp => \"to_char(time_first, 'YYYY-MM-DD HH24:MI')" }, { time_first_stamp => \"to_char(time_first, 'YYYY-MM-DD HH24:MI')" },
{ time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')" }, { time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')" },
], ],
@@ -91,6 +93,7 @@ ajax '/ajax/content/search/node' => require_login sub {
{ order_by => { '-desc' => 'time_last' }, { order_by => { '-desc' => 'time_last' },
'+columns' => [ '+columns' => [
'oui.company', 'oui.company',
'oui.abbrev',
{ {
time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')" time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')"
}], }],

View File

@@ -203,3 +203,22 @@ div.DTFC_LeftFootWrapper table {
border-top: none; border-top: none;
} }
div.dataTables_processing {
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 40px;
margin-left: -50%;
margin-top: -25px;
padding-top: 20px;
text-align: center;
font-size: 1.2em;
background-color: white;
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0)));
background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);
background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);
background: -ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);
background: -o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);
background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);
}

View File

@@ -1,23 +1,9 @@
<div class="accordion" id="accordion-radio-pwr"> <table id="data-table" class="table table-bordered table-hover" width="100%" cellspacing="0">
[% count = 0 %]
[% FOREACH row IN results.keys.sort %]
[% count = count + 1 %]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse-[% count %]" href="#collapse-[% count %]">
<i class="[% results.$row.ports.size < 10 ? 'icon-chevron-down' : 'icon-chevron-up' %]"></i> &nbsp;
[% results.$row.device.dns || results.$row.device.name %] &nbsp;
( [% results.$row.device.model %] ) &nbsp;
[% IF results.$row.device.location %]
Location: [% results.$row.device.location %]
[% END %]
</a>
</div>
<div id="collapse-[% count %]" class="accordion-body collapse[% ' in' IF results.$row.ports.size < 10 %]">
<div class="accordion-inner">
<table class="table table-bordered table-condensed">
<thead> <thead>
<tr> <tr>
<th>IP</th>
<th>DNS</th>
<th>Device</th>
<th>Port</th> <th>Port</th>
<th>Name</th> <th>Name</th>
<th>Description</th> <th>Description</th>
@@ -25,29 +11,107 @@
<th class="nd_center-cell">Tx Power (mW/dBm)</th> <th class="nd_center-cell">Tx Power (mW/dBm)</th>
</tr> </tr>
</thead> </thead>
<tbody> </table>
[% FOREACH p IN results.$row.ports %]
[% NEXT UNLESS p.channel # No channel port is admin down %] <style>
<tr> tr.group,
<td> tr.group:hover {
<a href="[% device_ports %]&q=[% results.$row.device.ip | uri %]&f=[% p.port | uri %]"> background-color: #ddd !important;
[% p.port | html_entity %]</a></td> }
<td>[% p.name %]</td> </style>
<td>[% p.descr %]</td>
<td class="nd_center-cell">[% p.channel %]</td>
<td class="nd_center-cell">[% IF p.power or p.power2 %][% p.power %] / [% p.power2 %][% END %]</td>
</tr>
[% END %]
</tbody>
</table>
</div>
</div>
</div>
[%END%]
</div>
<script> <script>
$('.accordion').on('show hide', function (n) { function groupString(d) {
$(n.target).siblings('.accordion-heading').find('.accordion-toggle i').toggleClass('icon-chevron-up icon-chevron-down'); "use strict";
}); var s = '';
s = s + 'Device: ';
s = s + '<a href="[% uri_for('/device') %]?tab=details&q=' + encodeURIComponent(d.ip) + '">';
s = s + he.encode(d.dns || d.device_name || d.ip);
if (d.dns || d.device_name) {
s = s + ' (' + he.encode(d.ip) + ') ';
}
s = s + '</a> Model: ' + he.encode(d.model || '');
s = s + he.encode(d.location ? ' Location: ' + d.location : '');
return s;
}
$(document).ready(function() {
var table = $('#data-table').DataTable({
"processing": true,
"stateSave": true,
"pageLength": 25,
"language": {
"search": 'Filter records: '
},
"serverSide": true,
"ajax": '/ajax/content/report/apradiochannelpower/data',
"order": [[ 0, 'asc' ]],
"columns": [
{
// Grouping column
"data": 'ip',
"visible": false
}, {
// Included for filtering
"data": 'dns',
"visible": false
}, {
// Included for filtering
"data": 'device_name',
"visible": false
}, {
"data": 'port',
"render": function(data, type, row, meta) {
return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>';
}
}, {
"data": 'port_name',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'descr',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'channel',
"className": "nd_center-cell"
}, {
"data": 'power',
"className": "nd_center-cell",
"render": function(data, type, row, meta) {
return (row.power2 ? data + ' / ' + row.power2 : '');
}
}
],
"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 ) {
var row_data = api.row( i ).data();
$(rows).eq( i ).before(
'<tr class="group"><td colspan="5">' + groupString(row_data) + '</td></tr>'
);
last = group;
}
} );
}
} );
// Order by the grouping
$('#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> </script>

View File

@@ -4,11 +4,8 @@
<thead> <thead>
<tr> <tr>
<th>MAC</th> <th>MAC</th>
[% IF params.show_vendor %]
<th>Vendor</th>
[% END %]
<th>Match</th> <th>Match</th>
<th>Device or Node</th> <th class="nd_center-cell">Device or Node</th>
[% IF params.stamps %] [% IF params.stamps %]
<th>First Seen</th> <th>First Seen</th>
<th>Last Seen</th> <th>Last Seen</th>
@@ -19,11 +16,13 @@
[% WHILE (row = macs.next) %] [% WHILE (row = macs.next) %]
[% IF row.nbname %] [% IF row.nbname %]
<tr> <tr>
<td><a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]"> <td>MAC: <a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]">
[% row.net_mac.$mac_format_call | html_entity %]</a></td> [% row.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td>[% row.oui.company | html_entity %]</td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% row.oui.abbrev | uri %]">
[% row.oui.company | html_entity %]</a> )
[% END %] [% END %]
</td>
<td>NetBIOS</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> <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> <br>[% row.nbuser || '[No User]' | html_entity %]@<a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a>
@@ -35,11 +34,13 @@
</tr> </tr>
[% ELSE %] [% ELSE %]
<tr> <tr>
<td><a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]"> <td>MAC: <a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]">
[% row.net_mac.$mac_format_call | html_entity %]</a></td> [% row.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td>[% row.oui.company | html_entity %]</td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% row.oui.abbrev | uri %]">
[% row.oui.company | html_entity %]</a> )
[% END %] [% END %]
</td>
<td>IP &rarr; MAC</td> <td>IP &rarr; MAC</td>
<td class="nd_center-cell"> <td class="nd_center-cell">
<a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a> <a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a>
@@ -54,13 +55,13 @@
[% END %] [% END %]
[% FOREACH nbt IN row.netbios %] [% FOREACH nbt IN row.netbios %]
<tr> <tr>
<td><a href="[% search_node %]&q=[% nbt.net_mac.$mac_format_call | uri %]"> <td>MAC: <a href="[% search_node %]&q=[% nbt.net_mac.$mac_format_call | uri %]">
[% nbt.net_mac.$mac_format_call | html_entity %]</a></td> [% nbt.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% nbt.oui.abbrev | uri %]">
[% nbt.oui.company | html_entity %] [% nbt.oui.company | html_entity %]</a> )
</td>
[% END %] [% END %]
</td>
<td>NetBIOS</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> <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> <br>[% nbt.nbuser || '[No User]' | html_entity %]@<a href="[% search_node %]&q=[% nbt.ip | uri %]">[% nbt.ip | html_entity %]</a>
@@ -73,13 +74,13 @@
[% END %] [% END %]
[% FOREACH ni IN row.nodeips %] [% FOREACH ni IN row.nodeips %]
<tr> <tr>
<td><a href="[% search_node %]&q=[% ni.net_mac.$mac_format_call | uri %]"> <td>MAC: <a href="[% search_node %]&q=[% ni.net_mac.$mac_format_call | uri %]">
[% ni.net_mac.$mac_format_call | html_entity %]</a></td> [% ni.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% ni.oui.abbrev | uri %]">
[% ni.oui.company | html_entity %] [% ni.oui.company | html_entity %]</a> )
</td>
[% END %] [% END %]
</td>
<td>IP &rarr; MAC</td> <td>IP &rarr; MAC</td>
<td class="nd_center-cell"> <td class="nd_center-cell">
<a href="[% search_node %]&q=[% ni.ip | uri %]">[% ni.ip | html_entity %]</a> <a href="[% search_node %]&q=[% ni.ip | uri %]">[% ni.ip | html_entity %]</a>
@@ -94,13 +95,13 @@
[% END %] [% END %]
[% FOREACH node IN row.node_sightings(archive_filter) %] [% FOREACH node IN row.node_sightings(archive_filter) %]
<tr> <tr>
<td><a href="[% search_node %]&q=[% node.net_mac.$mac_format_call | uri %]"> <td>MAC: <a href="[% search_node %]&q=[% node.net_mac.$mac_format_call | uri %]">
[% node.net_mac.$mac_format_call | html_entity %]</a></td> [% node.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% node.oui.abbrev | uri %]">
[% node.oui.company | html_entity %] [% node.oui.company | html_entity %]</a> )
</td>
[% END %] [% END %]
</td>
<td>Switch Port</td> <td>Switch Port</td>
<td><a class="nd_linkcell nd_center-cell" <td><a class="nd_linkcell nd_center-cell"
href="[% device_ports %]&q=[% node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on"> href="[% device_ports %]&q=[% node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on">
@@ -117,13 +118,13 @@
</tr> </tr>
[% FOREACH wlan IN node.wireless %] [% FOREACH wlan IN node.wireless %]
<tr> <tr>
<td><a href="[% search_node %]&q=[% wlan.net_mac.$mac_format_call | uri %]"> <td>MAC: <a href="[% search_node %]&q=[% wlan.net_mac.$mac_format_call | uri %]">
[% wlan.net_mac.$mac_format_call | html_entity %]</a></td> [% wlan.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% wlan.oui.abbrev | uri %]">
[% wlan.oui.company | html_entity %] [% wlan.oui.company | html_entity %]</a> )
</td>
[% END %] [% END %]
</td>
<td>Wireless Info</td> <td>Wireless Info</td>
<td class="nd_center-cell">SSID: [% wlan.ssid | html_entity %]<br> <td class="nd_center-cell">SSID: [% wlan.ssid | html_entity %]<br>
MaxRate: [% wlan.maxrate | html_entity %]Mbps TxRate: [% wlan.txrate | html_entity %]Mbps<br> MaxRate: [% wlan.maxrate | html_entity %]Mbps TxRate: [% wlan.txrate | html_entity %]Mbps<br>
@@ -140,13 +141,13 @@
[% END %] [% END %]
[% FOREACH nodeip IN row.ip_aliases(archive_filter) %] [% FOREACH nodeip IN row.ip_aliases(archive_filter) %]
<tr> <tr>
<td><a href="[% search_node %]&q=[% nodeip.net_mac.$mac_format_call | uri %]"> <td>MAC: <a href="[% search_node %]&q=[% nodeip.net_mac.$mac_format_call | uri %]">
[% nodeip.net_mac.$mac_format_call | html_entity %]</a></td> [% nodeip.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% nodeip.oui.abbrev | uri %]">
[% nodeip.oui.company | html_entity %] [% nodeip.oui.company | html_entity %]</a> )
</td>
[% END %] [% END %]
</td>
<td>MAC &rarr; IP</td> <td>MAC &rarr; IP</td>
<td class="nd_center-cell"> <td class="nd_center-cell">
<a href="[% search_node %]&q=[% nodeip.ip | uri %]">[% nodeip.ip | html_entity %]</a> <a href="[% search_node %]&q=[% nodeip.ip | uri %]">[% nodeip.ip | html_entity %]</a>
@@ -179,6 +180,9 @@ $(document).ready(function() {
"order": [[ 0, 'asc' ]], "order": [[ 0, 'asc' ]],
"stateSave": true, "stateSave": true,
"pageLength": 25, "pageLength": 25,
"language": {
"search": 'Filter records: '
},
"drawCallback": function ( settings ) { "drawCallback": function ( settings ) {
var api = this.api(); var api = this.api();
var rows = api.rows( {page:'current'} ).nodes(); var rows = api.rows( {page:'current'} ).nodes();
@@ -187,12 +191,8 @@ $(document).ready(function() {
api.column(0, {page:'current'} ).data().each( function ( group, i ) { api.column(0, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) { if ( last !== group ) {
$(rows).eq( i ).before( $(rows).eq( i ).before(
[% IF params.show_vendor && params.stamps %] [% IF params.stamps %]
'<tr class="group"><td colspan="5">'+group+'</td></tr>'
[% ELSIF params.stamps %]
'<tr class="group"><td colspan="4">'+group+'</td></tr>' '<tr class="group"><td colspan="4">'+group+'</td></tr>'
[% ELSIF params.show_vendor %]
'<tr class="group"><td colspan="3">'+group+'</td></tr>'
[% ELSE %] [% ELSE %]
'<tr class="group"><td colspan="2">'+group+'</td></tr>' '<tr class="group"><td colspan="2">'+group+'</td></tr>'
[% END %] [% END %]

View File

@@ -3,9 +3,6 @@
<thead> <thead>
<tr> <tr>
<th>MAC</th> <th>MAC</th>
[% IF params.show_vendor %]
<th>Vendor</th>
[% END %]
<th>Match</th> <th>Match</th>
<th class="nd_center-cell">Device or Node</th> <th class="nd_center-cell">Device or Node</th>
[% IF params.stamps %] [% IF params.stamps %]
@@ -18,13 +15,13 @@
[% WHILE (row = ips.next) %] [% WHILE (row = ips.next) %]
<tr> <tr>
<td> <td>
<a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]"> MAC: <a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]">
[% row.net_mac.$mac_format_call | html_entity %]</a> [% row.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% row.oui.abbrev | uri %]">
[% row.oui.company | html_entity %] [% row.oui.company | html_entity %]</a> )
</td>
[% END %] [% END %]
</td>
<td>MAC &rarr; IP</td> <td>MAC &rarr; IP</td>
<td class="nd_center-cell"><a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a> <td class="nd_center-cell"><a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a>
[% '&nbsp;<i class="icon-book text-warning"></i>&nbsp;' IF NOT row.active %] [% '&nbsp;<i class="icon-book text-warning"></i>&nbsp;' IF NOT row.active %]
@@ -39,14 +36,13 @@
[% WHILE (node = sightings.next) %] [% WHILE (node = sightings.next) %]
<tr> <tr>
<td> <td>
<a href="[% search_node %]&q=[% node.net_mac.$mac_format_call | uri %]"> MAC: <a href="[% search_node %]&q=[% node.net_mac.$mac_format_call | uri %]">
[% node.net_mac.$mac_format_call | html_entity %]</a> [% node.net_mac.$mac_format_call | html_entity %]</a>
</td>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% node.oui.abbrev | uri %]">
[% node.oui.company | html_entity %] [% node.oui.company | html_entity %]</a> )
</td>
[% END %] [% END %]
</td>
<td>Switch Port</td> <td>Switch Port</td>
<td class="nd_center-cell"> <td class="nd_center-cell">
<a href="[% device_ports %]&q=[% node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on"> <a href="[% device_ports %]&q=[% node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on">
@@ -65,13 +61,12 @@
[% WHILE (port = ports.next) %] [% WHILE (port = ports.next) %]
<tr> <tr>
<td> <td>
<a href="[% search_node %]&q=[% port.net_mac.$mac_format_call | uri %]">[% port.net_mac.$mac_format_call | html_entity %]</a> MAC: <a href="[% search_node %]&q=[% port.net_mac.$mac_format_call | uri %]">[% port.net_mac.$mac_format_call | html_entity %]</a>
</td>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% port.oui.abbrev | uri %]">
[% port.oui.company | html_entity %] [% port.oui.company | html_entity %]</a> )
</td>
[% END %] [% END %]
</td>
<td>Switch Port</td> <td>Switch Port</td>
<td class="nd_center-cell"> <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"> <a href="[% device_ports %]&q=[% port.ip | uri %]&f=[% port.port | uri %]&c_mac=on&c_nodes=on&c_neighbors=on">
@@ -89,13 +84,12 @@
[% WHILE (nbt = netbios.next) %] [% WHILE (nbt = netbios.next) %]
<tr> <tr>
<td> <td>
<a href="[% search_node %]&q=[% nbt.net_mac.$mac_format_call | uri %]">[% nbt.net_mac.$mac_format_call | html_entity %]</a> MAC: <a href="[% search_node %]&q=[% nbt.net_mac.$mac_format_call | uri %]">[% nbt.net_mac.$mac_format_call | html_entity %]</a>
</td>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% nbt.oui.abbrev | uri %]">
[% nbt.oui.company | html_entity %] [% nbt.oui.company | html_entity %]</a> )
</td>
[% END %] [% END %]
</td>
<td>NetBIOS</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> <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> <br>[% nbt.nbuser || '[No User]' | html_entity %]@<a href="[% search_node %]&q=[% nbt.ip | uri %]">[% nbt.ip | html_entity %]</a>
@@ -109,13 +103,12 @@
[% WHILE (wlan = wireless.next) %] [% WHILE (wlan = wireless.next) %]
<tr> <tr>
<td> <td>
<a href="[% search_node %]&q=[% wlan.net_mac.$mac_format_call | uri %]">[% wlan.net_mac.$mac_format_call | html_entity %]</a> MAC: <a href="[% search_node %]&q=[% wlan.net_mac.$mac_format_call | uri %]">[% wlan.net_mac.$mac_format_call | html_entity %]</a>
</td>
[% IF params.show_vendor %] [% IF params.show_vendor %]
<td> ( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% wlan.oui.abbrev | uri %]">
[% wlan.oui.company | html_entity %] [% wlan.oui.company | html_entity %]</a> )
</td>
[% END %] [% END %]
</td>
<td>Wireless Info</td> <td>Wireless Info</td>
<td class="nd_center-cell">SSID: [% wlan.ssid | html_entity %]<br> <td class="nd_center-cell">SSID: [% wlan.ssid | html_entity %]<br>
MaxRate: [% wlan.maxrate | html_entity %]Mbps TxRate: [% wlan.txrate | html_entity %]Mbps<br> MaxRate: [% wlan.maxrate | html_entity %]Mbps TxRate: [% wlan.txrate | html_entity %]Mbps<br>
@@ -148,6 +141,9 @@ $(document).ready(function() {
"order": [[ 0, 'asc' ]], "order": [[ 0, 'asc' ]],
"stateSave": true, "stateSave": true,
"pageLength": 25, "pageLength": 25,
"language": {
"search": 'Filter records: '
},
"drawCallback": function ( settings ) { "drawCallback": function ( settings ) {
var api = this.api(); var api = this.api();
var rows = api.rows( {page:'current'} ).nodes(); var rows = api.rows( {page:'current'} ).nodes();
@@ -156,12 +152,8 @@ $(document).ready(function() {
api.column(0, {page:'current'} ).data().each( function ( group, i ) { api.column(0, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) { if ( last !== group ) {
$(rows).eq( i ).before( $(rows).eq( i ).before(
[% IF params.show_vendor && params.stamps %] [% IF params.stamps %]
'<tr class="group"><td colspan="5">'+group+'</td></tr>'
[% ELSIF params.stamps %]
'<tr class="group"><td colspan="4">'+group+'</td></tr>' '<tr class="group"><td colspan="4">'+group+'</td></tr>'
[% ELSIF params.show_vendor %]
'<tr class="group"><td colspan="3">'+group+'</td></tr>'
[% ELSE %] [% ELSE %]
'<tr class="group"><td colspan="2">'+group+'</td></tr>' '<tr class="group"><td colspan="2">'+group+'</td></tr>'
[% END %] [% END %]