Squashed commit of the following:

commit 4b6f3de36cbf508c05fbf7f18acee1758bc838ed
Merge: 94ed8b8 200dd2d
Author: Eric A. Miller <emiller@cpan.org>
Date:   Mon Nov 4 19:30:04 2013 -0500

    Merge branch 'master' into em-poe-report

commit 94ed8b8cf01963030a40829fd71bff529750719e
Author: Eric A. Miller <emiller@cpan.org>
Date:   Sun Nov 3 23:34:07 2013 -0500

    Show PoE module statistics in device details if available

commit 652974b312c11d6017cf6f3c0693d62085774e80
Author: Eric A. Miller <emiller@cpan.org>
Date:   Sun Nov 3 23:31:02 2013 -0500

    Move PoE statistics to model from controller
    Add missing div in PoE status report

commit f94f68b1c84d23b2f252d985509757d95be5c0d0
Author: Eric A. Miller <emiller@cpan.org>
Date:   Tue Oct 22 22:38:45 2013 -0400

    Device PoE status report
This commit is contained in:
Eric A. Miller
2013-11-04 19:45:49 -05:00
parent 200dd2d3d1
commit 9f29204676
9 changed files with 252 additions and 2 deletions

View File

@@ -86,6 +86,19 @@
<br/>PS1 [[% d.ps1_type | html_entity %]]: [% d.ps1_status | html_entity %]
<br/>PS2 [[% d.ps2_type | html_entity %]]: [% d.ps2_status | html_entity %]</td>
</tr>
[% IF d.power_modules.size %]
<tr>
<td>PoE Status</td>
<td>
[% FOREACH m IN d.power_modules %]
[% UNLESS m.module == 1 %]
<br/>
[% END %]
Module [% m.module %]: [% m.status | html_entity %], [% m.capable_ports %] power-capable ports, [% m.powered_ports %] powered ([% m.disabled_ports %] admin disabled, [% m.errored_ports %] errors), [% m.pwr_committed %]/[% m.power %] watts committed.
[% END %]
</td>
</tr>
[% END %]
<tr>
<td>MAC Address</td>
<td>[% d.mac | html_entity %]</td>

View File

@@ -0,0 +1,60 @@
[% USE Number.Format %]
<div class="accordion" id="accordion-radio-pwr">
[% count = 0 %]
[% FOREACH row IN results %]
[% NEXT UNLESS row.power_modules.size %]
[% count = count + 1 %]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse-[% count %]" href="#collapse-[% count %]">
<i class="icon-chevron-down"></i> &nbsp;
[% row.dns || row.name %] &nbsp;
( [% row.model %] ) &nbsp;
[% IF row.location %]
Location: [% row.location %]
[% END %]
</a>
</div>
<div id="collapse-[% count %]" class="accordion-body collapse in">
<div class="accordion-inner">
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>PoE<br>Module</th>
<th class="nd_center-cell">Power<br>(W)</th>
<th class="nd_center-cell">Supply</th>
<th class="nd_center-cell">Capable<br>Ports</th>
<th class="nd_center-cell">Powered<br>Ports</th>
<th class="nd_center-cell">Disabled<br>Ports</th>
<th class="nd_center-cell">Errored<br>Ports</th>
<th class="nd_center-cell">Committed<br>(W)</th>
<th class="nd_center-cell">Delivering<br>(W)</th>
</tr>
</thead>
<tbody>
[% FOREACH m IN row.power_modules %]
<tr>
<td class="nd_center-cell">[% m.module %]</td>
<td class="nd_center-cell">[% m.power | format_number %]</td>
<td class="nd_center-cell">[% m.status %]</td>
<td class="nd_center-cell">[% m.capable_ports %]</td>
<td class="nd_center-cell">[% m.powered_ports %]</td>
<td class="nd_center-cell">[% m.disabled_ports %]</td>
<td class="nd_center-cell">[% m.errored_ports %]</td>
<td class="nd_center-cell">[% m.pwr_committed | format_number %]</td>
<td class="nd_center-cell">[% m.pwr_delivering | format_number %]</td>
</tr>
[% END %]
</tbody>
</table>
</div>
</div>
</div>
[%END%]
</div>
<script>
$('.accordion').on('show hide', function (n) {
$(n.target).siblings('.accordion-heading').find('.accordion-toggle i').toggleClass('icon-chevron-up icon-chevron-down');
});
</script>

View File

@@ -0,0 +1,25 @@
[% USE CSV -%]
[% CSV.dump([ 'Device' 'Model' 'Device Location' 'PoE Module' 'Power (W)'
'Supply' 'Capable Ports' 'Powered Ports' 'Disabled Ports'
'Errored Ports' 'Committed (W)' 'Delivering (W)' ]) %]
[% FOREACH row IN results %]
[% NEXT UNLESS row.power_modules.size %]
[% mydlist = [] %]
[% mydevice = row.dns || row.name %]
[% mydlist.push(mydevice) %]
[% mydlist.push(row.model) %]
[% mydlist.push(row.location) %]
[% FOREACH m IN row.power_modules %]
[% myplist = [] %]
[% FOREACH col IN [ m.module m.power m.status m.capable_ports
m.powered_ports m.disabled_ports m.errored_ports
m.pwr_committed m.pwr_delivering
] %]
[% myplist.push(col) %]
[% END %]
[% CALL mydlist.splice(3, 9, myplist ) %]
[% CSV.dump(mydlist) %]
[% END %]
[%END%]