[#18] Inventory by Model by OS Report
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
[NEW FEATURES]
|
[NEW FEATURES]
|
||||||
|
|
||||||
* [#4] Allow comment on device port in the log, for any user
|
* [#4] Allow comment on device port in the log, for any user
|
||||||
|
* [#18] Inventory by Model by OS Report
|
||||||
|
|
||||||
[ENHANCEMENTS]
|
[ENHANCEMENTS]
|
||||||
|
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ lib/App/Netdisco/Web/Plugin/Report/DeviceDnsMismatch.pm
|
|||||||
lib/App/Netdisco/Web/Plugin/Report/DevicePoeStatus.pm
|
lib/App/Netdisco/Web/Plugin/Report/DevicePoeStatus.pm
|
||||||
lib/App/Netdisco/Web/Plugin/Report/DuplexMismatch.pm
|
lib/App/Netdisco/Web/Plugin/Report/DuplexMismatch.pm
|
||||||
lib/App/Netdisco/Web/Plugin/Report/HalfDuplex.pm
|
lib/App/Netdisco/Web/Plugin/Report/HalfDuplex.pm
|
||||||
|
lib/App/Netdisco/Web/Plugin/Report/InventoryByModelByOS.pm
|
||||||
lib/App/Netdisco/Web/Plugin/Report/IpInventory.pm
|
lib/App/Netdisco/Web/Plugin/Report/IpInventory.pm
|
||||||
lib/App/Netdisco/Web/Plugin/Report/ModuleInventory.pm
|
lib/App/Netdisco/Web/Plugin/Report/ModuleInventory.pm
|
||||||
lib/App/Netdisco/Web/Plugin/Report/Netbios.pm
|
lib/App/Netdisco/Web/Plugin/Report/Netbios.pm
|
||||||
@@ -341,6 +342,7 @@ share/views/ajax/report/generic_report.tt
|
|||||||
share/views/ajax/report/generic_report_csv.tt
|
share/views/ajax/report/generic_report_csv.tt
|
||||||
share/views/ajax/report/halfduplex.tt
|
share/views/ajax/report/halfduplex.tt
|
||||||
share/views/ajax/report/halfduplex_csv.tt
|
share/views/ajax/report/halfduplex_csv.tt
|
||||||
|
share/views/ajax/report/inventorybymodelbyos.tt
|
||||||
share/views/ajax/report/ipinventory.tt
|
share/views/ajax/report/ipinventory.tt
|
||||||
share/views/ajax/report/ipinventory_csv.tt
|
share/views/ajax/report/ipinventory_csv.tt
|
||||||
share/views/ajax/report/moduleinventory.tt
|
share/views/ajax/report/moduleinventory.tt
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package App::Netdisco::Web::Plugin::Report::InventoryByModelByOS;
|
||||||
|
|
||||||
|
use Dancer ':syntax';
|
||||||
|
use Dancer::Plugin::DBIC;
|
||||||
|
use Dancer::Plugin::Auth::Extensible;
|
||||||
|
|
||||||
|
use App::Netdisco::Web::Plugin;
|
||||||
|
|
||||||
|
register_report(
|
||||||
|
{ category => 'Device',
|
||||||
|
tag => 'inventorybymodelbyos',
|
||||||
|
label => 'Inventory by Model by OS',
|
||||||
|
provides_csv => 0,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
get '/ajax/content/report/inventorybymodelbyos' => require_login sub {
|
||||||
|
my @results = schema('netdisco')->resultset('Device')->search(undef, {
|
||||||
|
columns => [qw/vendor model os os_ver/],
|
||||||
|
select => [ { count => 'os_ver' } ],
|
||||||
|
as => [qw/ os_ver_count /],
|
||||||
|
group_by => [qw/ vendor model os os_ver /],
|
||||||
|
order_by => ['vendor', 'model', { -desc => 'count' }, 'os_ver'],
|
||||||
|
})->hri->all;
|
||||||
|
|
||||||
|
template 'ajax/report/inventorybymodelbyos.tt', { results => \@results, },
|
||||||
|
{ layout => undef };
|
||||||
|
};
|
||||||
|
|
||||||
|
1;
|
||||||
@@ -46,6 +46,7 @@ web_plugins:
|
|||||||
- Report::HalfDuplex
|
- Report::HalfDuplex
|
||||||
- Report::DeviceAddrNoDNS
|
- Report::DeviceAddrNoDNS
|
||||||
- Report::DeviceByLocation
|
- Report::DeviceByLocation
|
||||||
|
- Report::InventoryByModelByOS
|
||||||
- Report::DeviceDnsMismatch
|
- Report::DeviceDnsMismatch
|
||||||
- Report::DevicePoeStatus
|
- Report::DevicePoeStatus
|
||||||
- Report::DuplexMismatch
|
- Report::DuplexMismatch
|
||||||
|
|||||||
71
Netdisco/share/views/ajax/report/inventorybymodelbyos.tt
Normal file
71
Netdisco/share/views/ajax/report/inventorybymodelbyos.tt
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<table id="nsbi-data-table" class="table table-bordered table-hover" width="100%" cellspacing="0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Model</th>
|
||||||
|
<th>Operating System Version</th>
|
||||||
|
<th>Count</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</tbody>
|
||||||
|
[% FOREACH row IN results %]
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="[% search_device %]&q=[% row.model | uri %]&vendor=[% row.vendor | uri %]&model=[% row.model | uri %]">
|
||||||
|
[% row.vendor.ucfirst | html_entity %] [% row.model | html_entity %]</a>
|
||||||
|
[% IF row.os %] running "[% row.os | html_entity %]"[% END %]
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a class="nd_linkcell"
|
||||||
|
href="[% search_device %]&q=[% row.os_ver | uri %]&vendor=[% row.vendor | uri %]&model=[% row.model | uri %]&os=[% row.os | uri %]&os_ver=[% row.os_ver | uri %]&matchall=on">
|
||||||
|
[% row.os_ver | html_entity %]</a>
|
||||||
|
</td>
|
||||||
|
<td>[% row.os_ver_count | html_entity %]</td>
|
||||||
|
</tr>
|
||||||
|
[% 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 }
|
||||||
|
],
|
||||||
|
sort: false,
|
||||||
|
"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(
|
||||||
|
'<tr class="group"><td colspan="2">'+group+'</td></tr>'
|
||||||
|
);
|
||||||
|
|
||||||
|
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>
|
||||||
Reference in New Issue
Block a user