Link from the subnet utilization report to ip inventory report for each subnet with the same date range.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user