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
|
# copy ports form defaults into request query params if this is
|
||||||
# a redirect from within the application (tab param is not set)
|
# a redirect from within the application (tab param is not set)
|
||||||
|
|
||||||
foreach my $col (@{ var('port_columns') }) {
|
if (param('reset') or not param('tab') or param('tab') ne 'ports') {
|
||||||
next unless $col->{default} eq 'on';
|
foreach my $col (@{ var('port_columns') }) {
|
||||||
params->{$col->{name}} = 'checked'
|
delete params->{$col->{name}};
|
||||||
if not param('tab') or param('tab') ne 'ports';
|
params->{$col->{name}} = 'checked'
|
||||||
}
|
if $col->{default} eq 'on';
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $col (@{ var('connected_properties') }) {
|
foreach my $col (@{ var('connected_properties') }) {
|
||||||
next unless $col->{default} eq 'on';
|
delete params->{$col->{name}};
|
||||||
params->{$col->{name}} = 'checked'
|
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_num'} ||= 3;
|
||||||
params->{'age_unit'} ||= 'months';
|
params->{'age_unit'} ||= 'months';
|
||||||
params->{'mac_format'} ||= 'IEEE';
|
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