diff --git a/Netdisco/lib/App/Netdisco/Web/Device.pm b/Netdisco/lib/App/Netdisco/Web/Device.pm index 5fdc6f55..4e66ac27 100644 --- a/Netdisco/lib/App/Netdisco/Web/Device.pm +++ b/Netdisco/lib/App/Netdisco/Web/Device.pm @@ -59,7 +59,7 @@ hook 'before' => sub { my $cookie = cookie('nd_ports-form'); my $cdata = url_params_mixed($cookie); - if ($cdata and ref {} eq ref $cdata) { + if ($cdata and ref {} eq ref $cdata and not param('reset')) { foreach my $item (@{ var('port_columns') }) { my $key = $item->{name}; next unless defined $cdata->{$key} @@ -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) - foreach my $col (@{ var('port_columns') }) { - next unless $col->{default} eq 'on'; - params->{$col->{name}} = 'checked' - if not param('tab') or param('tab') ne 'ports'; - } + if (param('reset') or not param('tab') or param('tab') ne 'ports') { + foreach my $col (@{ var('port_columns') }) { + delete params->{$col->{name}}; + params->{$col->{name}} = 'checked' + if $col->{default} eq 'on'; + } - foreach my $col (@{ var('connected_properties') }) { - next unless $col->{default} eq 'on'; - params->{$col->{name}} = 'checked' - if not param('tab') or param('tab') ne 'ports'; - } + foreach my $col (@{ var('connected_properties') }) { + delete params->{$col->{name}}; + params->{$col->{name}} = 'checked' + 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'); + } } }; diff --git a/Netdisco/share/public/css/netdisco.css b/Netdisco/share/public/css/netdisco.css index 0e4e4707..d5f77577 100644 --- a/Netdisco/share/public/css/netdisco.css +++ b/Netdisco/share/public/css/netdisco.css @@ -340,7 +340,16 @@ td > form.nd_inline-form { .nd_sidebar-pin { float: left; - margin-top: 6px; + margin-top: 8px; + margin-left: -16px; + font-size: 15px; + color: #555; + cursor: pointer; +} + +.nd_sidebar-reset { + float: left; + margin-top: 27px; margin-left: -16px; font-size: 15px; color: #555; @@ -349,7 +358,7 @@ td > form.nd_inline-form { #nd_sidebar-toggle-img-in { float: left; - margin-top: -9px; + margin-top: -10px; margin-left: -16px; font-size: 15px; color: #555; diff --git a/Netdisco/share/views/admintask.tt b/Netdisco/share/views/admintask.tt index 07322d53..d246e2b9 100644 --- a/Netdisco/share/views/admintask.tt +++ b/Netdisco/share/views/admintask.tt @@ -4,9 +4,9 @@