Add FRU filter option to Module Inventory Report
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2.025002 -
|
||||||
|
|
||||||
|
[ENHANCEMENTS]
|
||||||
|
|
||||||
|
* Add FRU filter option to Module Inventory Report
|
||||||
|
|
||||||
2.025001 - 2014-04-08
|
2.025001 - 2014-04-08
|
||||||
|
|
||||||
[NEW FEATURES]
|
[NEW FEATURES]
|
||||||
|
|||||||
@@ -16,16 +16,6 @@ register_report(
|
|||||||
);
|
);
|
||||||
|
|
||||||
hook 'before' => sub {
|
hook 'before' => sub {
|
||||||
|
|
||||||
# view settings
|
|
||||||
var('module_options' => [
|
|
||||||
{ name => 'matchall',
|
|
||||||
label => 'Match All Options',
|
|
||||||
default => 'on'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
return
|
return
|
||||||
unless (
|
unless (
|
||||||
request->path eq uri_for('/report/moduleinventory')->path
|
request->path eq uri_for('/report/moduleinventory')->path
|
||||||
@@ -33,13 +23,20 @@ hook 'before' => sub {
|
|||||||
uri_for('/ajax/content/report/moduleinventory')->path ) == 0
|
uri_for('/ajax/content/report/moduleinventory')->path ) == 0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# view settings
|
||||||
|
var('module_options' => [
|
||||||
|
{ name => 'fruonly',
|
||||||
|
label => 'FRU Only',
|
||||||
|
default => 'on'
|
||||||
|
},
|
||||||
|
{ name => 'matchall',
|
||||||
|
label => 'Match All Options',
|
||||||
|
default => 'on'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
params->{'limit'} ||= 1024;
|
params->{'limit'} ||= 1024;
|
||||||
|
|
||||||
foreach my $col ( @{ var('module_options') } ) {
|
|
||||||
next unless $col->{default} eq 'on';
|
|
||||||
params->{ $col->{name} } = 'checked';
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
hook 'before_template' => sub {
|
hook 'before_template' => sub {
|
||||||
@@ -69,6 +66,7 @@ get '/ajax/content/report/moduleinventory' => require_login sub {
|
|||||||
qw/device description name type model serial class/;
|
qw/device description name type model serial class/;
|
||||||
|
|
||||||
my $rs = schema('netdisco')->resultset('DeviceModule');
|
my $rs = schema('netdisco')->resultset('DeviceModule');
|
||||||
|
$rs = $rs->search({-bool => 'fru'}) if param('fruonly');
|
||||||
|
|
||||||
if ($has_opt) {
|
if ($has_opt) {
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,14 @@ get '/report/*' => require_login sub {
|
|||||||
elsif ( $tag eq 'moduleinventory' ) {
|
elsif ( $tag eq 'moduleinventory' ) {
|
||||||
$class_list = [ schema('netdisco')->resultset('DeviceModule')
|
$class_list = [ schema('netdisco')->resultset('DeviceModule')
|
||||||
->get_distinct_col('class') ];
|
->get_distinct_col('class') ];
|
||||||
|
|
||||||
|
# this is a bit fragile... three params currently
|
||||||
|
if (3 == scalar keys params()) {
|
||||||
|
foreach my $col ( @{ var('module_options') } ) {
|
||||||
|
next unless $col->{default} eq 'on';
|
||||||
|
params->{ $col->{name} } = 'checked';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elsif ( $tag eq 'portssid' ) {
|
elsif ( $tag eq 'portssid' ) {
|
||||||
$ssid_list = [ schema('netdisco')->resultset('DevicePortSsid')
|
$ssid_list = [ schema('netdisco')->resultset('DevicePortSsid')
|
||||||
|
|||||||
@@ -59,6 +59,15 @@
|
|||||||
[% END %]
|
[% END %]
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="clearfix input-prepend">
|
||||||
|
<label class="add-on">
|
||||||
|
<input type="checkbox" id="fruonly"
|
||||||
|
name="fruonly"[% ' checked="checked"' IF params.fruonly %]/>
|
||||||
|
</label>
|
||||||
|
<label class="nd_checkboxlabel" for="fruonly">
|
||||||
|
<span class="nd_searchcheckbox uneditable-input">FRU Only</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="clearfix input-prepend">
|
<div class="clearfix input-prepend">
|
||||||
<label class="add-on">
|
<label class="add-on">
|
||||||
<input type="checkbox" id="matchall"
|
<input type="checkbox" id="matchall"
|
||||||
|
|||||||
Reference in New Issue
Block a user