From 41053199875b1cad4d94b6f128222233e4ba65f7 Mon Sep 17 00:00:00 2001 From: "Eric A. Miller" Date: Mon, 26 May 2014 23:35:57 -0400 Subject: [PATCH] DataTables for ports that are blocking report --- .../Web/Plugin/Report/PortBlocking.pm | 11 +++--- .../share/views/ajax/report/portblocking.tt | 39 ++++++++++++++++--- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Report/PortBlocking.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Report/PortBlocking.pm index c79226e5..c96b36ab 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Report/PortBlocking.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Report/PortBlocking.pm @@ -17,22 +17,21 @@ register_report( get '/ajax/content/report/portblocking' => require_login sub { my @results = schema('netdisco')->resultset('Device')->search( { 'stp' => [ 'blocking', 'broken' ], 'up' => { '!=', 'down' } }, - { result_class => 'DBIx::Class::ResultClass::HashRefInflator', - select => [ 'ip', 'dns', 'name' ], + { select => [ 'ip', 'dns', 'name' ], join => ['ports'], '+columns' => [ { 'port' => 'ports.port' }, { 'description' => 'ports.name' }, { 'stp' => 'ports.stp' }, - ], - order_by => { -asc => [qw/me.ip ports.port/] }, + ] } - )->all; + )->hri->all; return unless scalar @results; if ( request->is_ajax ) { - template 'ajax/report/portblocking.tt', { results => \@results, }, + my $results = to_json (\@results); + template 'ajax/report/portblocking.tt', { results => $results, }, { layout => undef }; } else { diff --git a/Netdisco/share/views/ajax/report/portblocking.tt b/Netdisco/share/views/ajax/report/portblocking.tt index 08aa1428..62593b7f 100644 --- a/Netdisco/share/views/ajax/report/portblocking.tt +++ b/Netdisco/share/views/ajax/report/portblocking.tt @@ -1,11 +1,10 @@ -[% USE Number.Format %] - +
- - - + + + @@ -21,3 +20,33 @@
DevicePortPort DescriptionSTP StatusPortPort DescriptionSTP Status
+ +