diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Report/DeviceByLocation.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Report/DeviceByLocation.pm index 24d01b99..86cdeb8c 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Report/DeviceByLocation.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Report/DeviceByLocation.pm @@ -15,21 +15,24 @@ register_report( ); get '/ajax/content/report/devicebylocation' => require_login sub { - my $set + my @results = schema('netdisco')->resultset('Device') - ->search( {}, - { order_by => [qw/ location name ip vendor model /], } ); - return unless $set->count; + ->columns( [qw/ ip dns name location vendor model /] ) + ->order_by( [qw/ location name ip vendor model /] )->hri->all; + + return unless scalar @results; if ( request->is_ajax ) { - template 'ajax/report/devicebylocation.tt', { results => $set, }, + my $results = to_json( \@results ); + template 'ajax/report/devicebylocation.tt', { results => $results }, { layout => undef }; } else { header( 'Content-Type' => 'text/comma-separated-values' ); - template 'ajax/report/devicebylocation_csv.tt', { results => $set, }, - { layout => undef }; + template 'ajax/report/devicebylocation_csv.tt', + { results => \@results }, + { layout => undef }; } }; -true; +1; diff --git a/Netdisco/share/views/ajax/report/devicebylocation.tt b/Netdisco/share/views/ajax/report/devicebylocation.tt index ab662cf2..79095418 100644 --- a/Netdisco/share/views/ajax/report/devicebylocation.tt +++ b/Netdisco/share/views/ajax/report/devicebylocation.tt @@ -1,4 +1,4 @@ -
| Location | @@ -8,32 +8,47 @@Model | |||
|---|---|---|---|---|
| - [% IF row.location %] - - [% row.location | html_entity %] - [% ELSE %] - [Not Set] - [% END %] - | -[% row.dns || row.ip | html_entity %] | -- [% row.name | html_entity %] - | -- - [% row.vendor | html_entity %] - | -- - [% row.model | html_entity %] - | -