add wireless ssid inventory report
This commit is contained in:
39
Netdisco/lib/App/Netdisco/Web/Plugin/Report/SsidInventory.pm
Normal file
39
Netdisco/lib/App/Netdisco/Web/Plugin/Report/SsidInventory.pm
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package App::Netdisco::Web::Plugin::Report::SsidInventory;
|
||||||
|
|
||||||
|
use Dancer ':syntax';
|
||||||
|
use Dancer::Plugin::DBIC;
|
||||||
|
use Dancer::Plugin::Auth::Extensible;
|
||||||
|
|
||||||
|
use App::Netdisco::Web::Plugin;
|
||||||
|
|
||||||
|
register_report(
|
||||||
|
{ category => 'Wireless',
|
||||||
|
tag => 'ssidinventory',
|
||||||
|
label => 'SSID Inventory',
|
||||||
|
provides_csv => 1,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
get '/ajax/content/report/ssidinventory' => require_login sub {
|
||||||
|
my $set = schema('netdisco')->resultset('DevicePortSsid')->search(
|
||||||
|
{},
|
||||||
|
{ select => [ 'ssid', 'broadcast', { count => 'ssid' } ],
|
||||||
|
as => [qw/ ssid broadcast scount /],
|
||||||
|
group_by => [qw/ ssid broadcast /],
|
||||||
|
order_by => { -desc => [qw/count/] },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return unless $set->count;
|
||||||
|
|
||||||
|
if ( request->is_ajax ) {
|
||||||
|
template 'ajax/report/ssidinventory.tt', { results => $set, },
|
||||||
|
{ layout => undef };
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
header( 'Content-Type' => 'text/comma-separated-values' );
|
||||||
|
template 'ajax/report/ssidinventory_csv.tt', { results => $set, },
|
||||||
|
{ layout => undef };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
true;
|
||||||
@@ -38,6 +38,7 @@ web_plugins:
|
|||||||
- Report::ApRadioChannelPower
|
- Report::ApRadioChannelPower
|
||||||
- Report::HalfDuplex
|
- Report::HalfDuplex
|
||||||
- Report::DuplexMismatch
|
- Report::DuplexMismatch
|
||||||
|
- Report::SsidInventory
|
||||||
- Report::VlanInventory
|
- Report::VlanInventory
|
||||||
- AdminTask::PseudoDevice
|
- AdminTask::PseudoDevice
|
||||||
- AdminTask::Topology
|
- AdminTask::Topology
|
||||||
|
|||||||
20
Netdisco/share/views/ajax/report/ssidinventory.tt
Normal file
20
Netdisco/share/views/ajax/report/ssidinventory.tt
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
[% USE Number.Format %]
|
||||||
|
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="nd_center-cell">SSID</th>
|
||||||
|
<th class="nd_center-cell">Broadcast</th>
|
||||||
|
<th class="nd_center-cell">Count</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</tbody>
|
||||||
|
[% WHILE (row = results.next) %]
|
||||||
|
<tr>
|
||||||
|
<td class="nd_center-cell">[% row.ssid %]</td>
|
||||||
|
<td class="nd_center-cell">[% row.broadcast ? 'Yes' : 'No' %]</td>
|
||||||
|
<td class="nd_center-cell">[% row.get_column('scount') | format_number %]</td>
|
||||||
|
</tr>
|
||||||
|
[% END %]
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
11
Netdisco/share/views/ajax/report/ssidinventory_csv.tt
Normal file
11
Netdisco/share/views/ajax/report/ssidinventory_csv.tt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[% USE CSV -%]
|
||||||
|
[% CSV.dump([ 'SSID' 'Broadcast' 'Count' ]) %]
|
||||||
|
|
||||||
|
[% WHILE (row = results.next) %]
|
||||||
|
[% mylist = [] %]
|
||||||
|
[% mylist.push(row.ssid) %]
|
||||||
|
[% mylist.push(row.broadcast ? 'Yes' : 'No') %]
|
||||||
|
[% mylist.push(row.get_column('scount')) %]
|
||||||
|
[% CSV.dump(mylist) %]
|
||||||
|
|
||||||
|
[% END %]
|
||||||
Reference in New Issue
Block a user