Add FRU filter option to Module Inventory Report
This commit is contained in:
@@ -16,16 +16,6 @@ register_report(
|
||||
);
|
||||
|
||||
hook 'before' => sub {
|
||||
|
||||
# view settings
|
||||
var('module_options' => [
|
||||
{ name => 'matchall',
|
||||
label => 'Match All Options',
|
||||
default => 'on'
|
||||
},
|
||||
]
|
||||
);
|
||||
|
||||
return
|
||||
unless (
|
||||
request->path eq uri_for('/report/moduleinventory')->path
|
||||
@@ -33,13 +23,20 @@ hook 'before' => sub {
|
||||
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;
|
||||
|
||||
foreach my $col ( @{ var('module_options') } ) {
|
||||
next unless $col->{default} eq 'on';
|
||||
params->{ $col->{name} } = 'checked';
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
hook 'before_template' => sub {
|
||||
@@ -69,6 +66,7 @@ get '/ajax/content/report/moduleinventory' => require_login sub {
|
||||
qw/device description name type model serial class/;
|
||||
|
||||
my $rs = schema('netdisco')->resultset('DeviceModule');
|
||||
$rs = $rs->search({-bool => 'fru'}) if param('fruonly');
|
||||
|
||||
if ($has_opt) {
|
||||
|
||||
|
||||
@@ -17,6 +17,14 @@ get '/report/*' => require_login sub {
|
||||
elsif ( $tag eq 'moduleinventory' ) {
|
||||
$class_list = [ schema('netdisco')->resultset('DeviceModule')
|
||||
->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' ) {
|
||||
$ssid_list = [ schema('netdisco')->resultset('DevicePortSsid')
|
||||
|
||||
Reference in New Issue
Block a user