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