reset params used in query
This commit is contained in:
@@ -84,22 +84,32 @@ hook 'before' => sub {
|
||||
# copy ports form defaults into request query params if this is
|
||||
# a redirect from within the application (tab param is not set)
|
||||
|
||||
if (param('reset') or not param('tab') or param('tab') ne 'ports') {
|
||||
foreach my $col (@{ var('port_columns') }) {
|
||||
next unless $col->{default} eq 'on';
|
||||
delete params->{$col->{name}};
|
||||
params->{$col->{name}} = 'checked'
|
||||
if not param('tab') or param('tab') ne 'ports';
|
||||
if $col->{default} eq 'on';
|
||||
}
|
||||
|
||||
foreach my $col (@{ var('connected_properties') }) {
|
||||
next unless $col->{default} eq 'on';
|
||||
delete params->{$col->{name}};
|
||||
params->{$col->{name}} = 'checked'
|
||||
if not param('tab') or param('tab') ne 'ports';
|
||||
if $col->{default} eq 'on';
|
||||
}
|
||||
|
||||
if (not param('tab') or param('tab') ne 'ports') {
|
||||
# not stored in the cookie
|
||||
params->{'age_num'} ||= 3;
|
||||
params->{'age_unit'} ||= 'months';
|
||||
params->{'mac_format'} ||= 'IEEE';
|
||||
|
||||
if (param('reset')) {
|
||||
params->{'age_num'} = 3;
|
||||
params->{'age_unit'} = 'months';
|
||||
params->{'mac_format'} = 'IEEE';
|
||||
|
||||
# nuke the port params cookie
|
||||
cookie('nd_ports-form' => '', expires => '-1 day');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user