add Half Duplex Ports report
This commit is contained in:
29
Netdisco/lib/App/Netdisco/Web/Plugin/Report/HalfDuplex.pm
Normal file
29
Netdisco/lib/App/Netdisco/Web/Plugin/Report/HalfDuplex.pm
Normal file
@@ -0,0 +1,29 @@
|
||||
package App::Netdisco::Web::Plugin::Report::HalfDuplex;
|
||||
|
||||
use Dancer ':syntax';
|
||||
use Dancer::Plugin::Ajax;
|
||||
use Dancer::Plugin::DBIC;
|
||||
use Dancer::Plugin::Auth::Extensible;
|
||||
|
||||
use App::Netdisco::Web::Plugin;
|
||||
|
||||
register_report({
|
||||
category => 'Port',
|
||||
tag => 'halfduplex',
|
||||
label => 'Ports in Half Duplex Mode',
|
||||
});
|
||||
|
||||
ajax '/ajax/content/report/halfduplex' => require_login sub {
|
||||
my $set = schema('netdisco')->resultset('DevicePort')->search(
|
||||
{ up => 'up', duplex => { '-ilike' => 'half' } },
|
||||
{ order_by => [qw/device.dns port/], prefetch => 'device' },
|
||||
);
|
||||
return unless $set->count;
|
||||
|
||||
content_type('text/html');
|
||||
template 'ajax/report/halfduplex.tt', {
|
||||
results => $set,
|
||||
}, { layout => undef };
|
||||
};
|
||||
|
||||
true;
|
||||
@@ -34,6 +34,7 @@ path: '/'
|
||||
web_plugins:
|
||||
- Inventory
|
||||
- Report::PortUtilization
|
||||
- Report::HalfDuplex
|
||||
- Report::DuplexMismatch
|
||||
- AdminTask::PseudoDevice
|
||||
- AdminTask::Topology
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="nd_center-cell">Left Device</th>
|
||||
<th class="nd_center-cell">Interface</th>
|
||||
<th class="nd_center-cell">Port</th>
|
||||
<th class="nd_center-cell">Duplex</th>
|
||||
<th class="nd_center-cell">Right Device</th>
|
||||
<th class="nd_center-cell">Interface</th>
|
||||
<th class="nd_center-cell">Port</th>
|
||||
<th class="nd_center-cell">Duplex</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
23
Netdisco/share/views/ajax/report/halfduplex.tt
Normal file
23
Netdisco/share/views/ajax/report/halfduplex.tt
Normal file
@@ -0,0 +1,23 @@
|
||||
<table class="table table-bordered table-condensed table-striped nd_floatinghead">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Device</th>
|
||||
<th class="nd_center-cell">Port</th>
|
||||
<th class="nd_center-cell">Description</th>
|
||||
<th class="nd_center-cell">Duplex</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</tbody>
|
||||
[% WHILE (row = results.next) %]
|
||||
<tr>
|
||||
<td>[% row.device.dns || row.device.ip | html_entity %]</td>
|
||||
<td class="nd_center-cell"><a class="nd_linkcell"
|
||||
href="[% device_ports %]&q=[% row.device.dns || row.device.ip | uri %]&f=[% row.port | uri %]&c_duplex=on">
|
||||
[% row.port | html_entity %]</a></td>
|
||||
<td class="nd_center-cell">[% row.name | html_entity %]</td>
|
||||
<td class="nd_center-cell">[% row.duplex.ucfirst | html_entity %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user