Eliminate an necessary database call in Module Inventory, Port SSID, and NetBIOS reports
This commit is contained in:
@@ -96,12 +96,14 @@ get '/ajax/content/report/moduleinventory' => require_login sub {
|
||||
|
||||
return unless $rs->has_rows;
|
||||
if ( request->is_ajax ) {
|
||||
template 'ajax/report/moduleinventory.tt', { results => $rs, },
|
||||
template 'ajax/report/moduleinventory.tt',
|
||||
{ results => $rs, opt => $has_opt },
|
||||
{ layout => undef };
|
||||
}
|
||||
else {
|
||||
header( 'Content-Type' => 'text/comma-separated-values' );
|
||||
template 'ajax/report/moduleinventory_csv.tt', { results => $rs, },
|
||||
template 'ajax/report/moduleinventory_csv.tt',
|
||||
{ results => $rs, opt => $has_opt },
|
||||
{ layout => undef };
|
||||
}
|
||||
};
|
||||
|
||||
@@ -42,11 +42,10 @@ get '/ajax/content/report/netbios' => require_login sub {
|
||||
|
||||
if ( defined $domain ) {
|
||||
$domain = '' if $domain eq 'blank';
|
||||
$rs = $rs->search( { domain => $domain } )->order_by(
|
||||
[ { -asc => 'domain' },
|
||||
{ -desc => 'time_last' }
|
||||
]
|
||||
)->hri;
|
||||
$rs
|
||||
= $rs->search( { domain => $domain } )
|
||||
->order_by( [ { -asc => 'domain' }, { -desc => 'time_last' } ] )
|
||||
->hri;
|
||||
}
|
||||
else {
|
||||
$rs = $rs->search(
|
||||
@@ -62,12 +61,13 @@ get '/ajax/content/report/netbios' => require_login sub {
|
||||
return unless $rs->has_rows;
|
||||
|
||||
if ( request->is_ajax ) {
|
||||
template 'ajax/report/netbios.tt', { results => $rs, },
|
||||
template 'ajax/report/netbios.tt', { results => $rs, opt => $domain },
|
||||
{ layout => undef };
|
||||
}
|
||||
else {
|
||||
header( 'Content-Type' => 'text/comma-separated-values' );
|
||||
template 'ajax/report/netbios_csv.tt', { results => $rs, },
|
||||
template 'ajax/report/netbios_csv.tt',
|
||||
{ results => $rs, opt => $domain },
|
||||
{ layout => undef };
|
||||
}
|
||||
};
|
||||
|
||||
@@ -57,12 +57,13 @@ get '/ajax/content/report/portssid' => require_login sub {
|
||||
return unless $rs->has_rows;
|
||||
|
||||
if ( request->is_ajax ) {
|
||||
template 'ajax/report/portssid.tt', { results => $rs, },
|
||||
template 'ajax/report/portssid.tt', { results => $rs, opt => $ssid },
|
||||
{ layout => undef };
|
||||
}
|
||||
else {
|
||||
header( 'Content-Type' => 'text/comma-separated-values' );
|
||||
template 'ajax/report/portssid_csv.tt', { results => $rs, },
|
||||
template 'ajax/report/portssid_csv.tt',
|
||||
{ results => $rs, opt => $ssid },
|
||||
{ layout => undef };
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
[% USE Number.Format %]
|
||||
[% IF results.first.ip %]
|
||||
[% row = results.reset %]
|
||||
[% IF opt %]
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -62,7 +61,6 @@
|
||||
</tbody>
|
||||
</table>
|
||||
[% ELSE %]
|
||||
[% row = results.reset %]
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
[% USE CSV -%]
|
||||
[% IF results.first.ip %]
|
||||
[% row = results.reset %]
|
||||
[% IF opt %]
|
||||
[% CSV.dump(['Device' 'Description' 'Name' 'Class' 'Type' 'Model' 'Serial' 'HW Version' 'SW Version' 'FW Version']) %]
|
||||
|
||||
[% WHILE (row = results.next) %]
|
||||
@@ -13,7 +12,6 @@
|
||||
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
[% row = results.reset %]
|
||||
[% CSV.dump(['Class' 'Count']) %]
|
||||
|
||||
[% WHILE (row = results.next) %]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
[% USE date(format = '%Y-%m-%d %H:%M') %]
|
||||
[% USE Number.Format %]
|
||||
[% IF results.first.mac %]
|
||||
[% row = results.reset %]
|
||||
[% IF opt %]
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -27,7 +26,6 @@
|
||||
</tbody>
|
||||
</table>
|
||||
[% ELSE %]
|
||||
[% row = results.reset %]
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
[% USE CSV -%]
|
||||
[% USE date(format = '%Y-%m-%d %H:%M') %]
|
||||
[% IF results.first.ip %]
|
||||
[% row = results.reset %]
|
||||
[% IF opt %]
|
||||
[% CSV.dump(['Domain' 'Node' 'Name' 'User' 'First Seen' 'Last Seen']) %]
|
||||
|
||||
[% WHILE (row = results.next) %]
|
||||
@@ -14,7 +13,6 @@
|
||||
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
[% row = results.reset %]
|
||||
[% CSV.dump(['Domain' 'Count']) %]
|
||||
|
||||
[% WHILE (row = results.next) %]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
[% USE Number.Format %]
|
||||
[% IF results.first.device.ip %]
|
||||
[% row = results.reset %]
|
||||
[% IF opt %]
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -28,7 +27,6 @@
|
||||
</tbody>
|
||||
</table>
|
||||
[% ELSE %]
|
||||
[% row = results.reset %]
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
[% USE CSV -%]
|
||||
[% IF results.first.ip %]
|
||||
[% row = results.reset %]
|
||||
[% IF opt %]
|
||||
[% CSV.dump(['Device' 'Port' 'Name' 'Broadcast' 'Model' 'SSID' 'Vendor']) %]
|
||||
|
||||
[% WHILE (row = results.next) %]
|
||||
@@ -14,7 +13,6 @@
|
||||
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
[% row = results.reset %]
|
||||
[% CSV.dump(['SSID' 'Count']) %]
|
||||
|
||||
[% WHILE (row = results.next) %]
|
||||
|
||||
Reference in New Issue
Block a user