Subnets report date range fixed, but (unnecessary?) "not" option removed

This commit is contained in:
Oliver Gorwits
2014-06-23 16:03:55 +01:00
parent 4d8acdacc1
commit 71b2ab2563
5 changed files with 19 additions and 9 deletions

View File

@@ -1,3 +1,9 @@
2.027008_002 - 2014-06-23
[BUG FIXES]
* Subnets report date range fixed, but (unnecessary?) "not" option removed
2.027008_001 - 2014-06-23
[NEW FEATURES]

View File

@@ -20,8 +20,13 @@ __PACKAGE__->result_source_instance->view_definition(<<'ENDSQL');
FROM subnets s1, node_ip ni
WHERE s1.net <<= ?::cidr
AND ni.ip <<= s1.net
AND ni.time_last >= ?
AND ni.time_last <= ?
AND ((
ni.time_first IS null
AND ni.time_last IS null
) OR (
ni.time_last >= ?
AND ni.time_last <= ?
))
AND s1.last_discover >= ?
UNION
SELECT DISTINCT net, di.alias as ip

View File

@@ -18,15 +18,12 @@ get '/ajax/content/report/subnets' => require_login sub {
my $agenot = param('age_invert') || '0';
my ( $start, $end ) = param('daterange') =~ /(\d+-\d+-\d+)/gmx;
if ($agenot) {
my $tmp = $end;
$end = $start;
$start = $tmp;
}
$start = $start . ' 00:00:00';
$end = $end . ' 23:59:59';
my @results = schema('netdisco')->resultset('Virtual::SubnetUtilization')
->search(undef,{
bind => [ $subnet, $start, $end, $end, $subnet, $end, $end ],
bind => [ $subnet, $start, $end, $start, $subnet, $start, $start ],
})->hri->all;
return unless scalar @results;

View File

@@ -11,7 +11,7 @@
</tbody>
[% FOREACH row IN results %]
<tr>
<td class="nd_center-cell"><a href="[% uri_for('/report/ipinventory') %]?subnet=[% row.subnet | uri %]&daterange=[% daterange | uri %]&limit=[% row.subnet_size | uri %]">
<td class="nd_center-cell"><a href="[% uri_for('/report/ipinventory') %]?subnet=[% row.subnet | uri %]&daterange=[% params.daterange | uri %]&age_invert=[% params.age_invert | uri %]&limit=[% row.subnet_size | uri %]">
[% row.subnet | html_entity %]</a></td>
<td class="nd_center-cell">[% row.subnet_size | format_number %]</td>
<td class="nd_center-cell">[% row.active | format_number %]</td>

View File

@@ -10,6 +10,7 @@
<legend class="nd_sidebar-legend">
<label><em><strong>Date Range</strong></em></label>
</legend>
<!--
<div class="clearfix input-prepend">
<label class="add-on">
<input type="checkbox" id="age_invert"
@@ -19,6 +20,7 @@
<span class="nd_searchcheckbox uneditable-input">Not within...</span>
</label>
</div>
-->
<div class="clearfix">
<input class="nd_side-input" id="daterange" required="required"
type="text" name="daterange" value="[%