add csv output to access point radios channel and power report

This commit is contained in:
Eric A. Miller
2013-09-22 11:56:53 -04:00
parent 8bec4ed8b0
commit 5165451c52
2 changed files with 31 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ register_report(
{ category => 'Wireless',
tag => 'apradiochannelpower',
label => 'Access Point Radios Channel and Power',
provides_csv => 1,
}
);
@@ -47,16 +48,22 @@ sub port_tree {
return \%ports;
}
ajax '/ajax/content/report/apradiochannelpower' => require_login sub {
get '/ajax/content/report/apradiochannelpower' => require_login sub {
my @set
= schema('netdisco')->resultset('Virtual::ApRadioChannelPower')->all;
my $results = port_tree( \@set );
return unless scalar %$results;
content_type('text/html');
if (request->is_ajax) {
template 'ajax/report/apradiochannelpower.tt', { results => $results, },
{ layout => undef };
}
else {
header( 'Content-Type' => 'text/comma-separated-values' );
template 'ajax/report/apradiochannelpower_csv.tt', { results => $results, },
{ layout => undef };
}
};
true;