Link from the subnet utilization report to ip inventory report for each subnet with the same date range.

This commit is contained in:
Eric A. Miller
2014-01-01 23:31:57 -05:00
parent 992af240fe
commit ed1158a481
3 changed files with 40 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ use Dancer::Plugin::DBIC;
use Dancer::Plugin::Auth::Extensible;
use App::Netdisco::Web::Plugin;
use App::Netdisco::Util::Web (); # for interval_to_daterange
register_report({
category => 'IP',
@@ -18,13 +19,16 @@ get '/ajax/content/report/subnets' => require_login sub {
my $age = param('age') || '7 days';
$age = '7 days' unless $age =~ m/^(?:\d+)\s+(?:day|week|month|year)s?$/;
my $daterange = App::Netdisco::Util::Web::interval_to_daterange($age);
my $set = schema('netdisco')->resultset('Virtual::SubnetUtilization')
->search(undef,{
bind => [ $subnet, $age, $age, $subnet, $age, $age ],
});
if ( request->is_ajax ) {
template 'ajax/report/subnets.tt', { results => $set, },
template 'ajax/report/subnets.tt',
{ results => $set, daterange => $daterange },
{ layout => undef };
}
else {