diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm index 6940b8f4..0f0f04f1 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm @@ -36,10 +36,15 @@ ajax '/ajax/content/device/ports' => require_login sub { $f =~ s/\*/%/g; $f =~ s/\?/_/g; # set wilcards at param boundaries - $f =~ s/^\%*/%/; - $f =~ s/\%*$/%/; + if ($f !~ m/[%_]/) { + $f =~ s/^\%*/%/; + $f =~ s/\%*$/%/; + } # enable ILIKE op - $f = { '-ilike' => $f }; + $f = { (param('invert') ? '-not_ilike' : '-ilike') => $f }; + } + elsif (param('invert')) { + $f = { '!=' => $f }; } if ($set->search({'me.port' => $f})->count) { diff --git a/Netdisco/share/public/css/netdisco.css b/Netdisco/share/public/css/netdisco.css index 97c034ac..922fb7c2 100644 --- a/Netdisco/share/public/css/netdisco.css +++ b/Netdisco/share/public/css/netdisco.css @@ -406,8 +406,8 @@ td > form.nd_inline-form { /* fixup for prepended partial port name checkbox in sidebar */ .nd_port-partial-checkbox { - width: 136px; - padding: 0px 0px 0px 11px !important; + width: 84px; + padding: 0px 0px 0px 5px !important; cursor: pointer; } @@ -421,6 +421,27 @@ td > form.nd_inline-form { margin-bottom: 5px !important; } +/* fixup for prepended invert port name checkbox in sidebar */ +.nd_port-invert-checkbox { + width: 30px; + padding: 0px 0px 0px 5px !important; + cursor: pointer; +} + +.nd_port-invert-label { + padding: 0px !important; + /* for some reason only .add-on:first-child gets these */ + -webkit-border-radius: 4px 0 0 4px !important; + -moz-border-radius: 4px 0 0 4px !important; + border-radius: 4px 0 0 4px !important; +} + +.nd_port-invert { + margin-left: 5px !important; + margin-top: -5px; + margin-bottom: 5px !important; +} + /* fixup for prepended checkbox in sidebar */ .nd_sidebar .input-prepend { margin-left: -2px; diff --git a/Netdisco/share/views/js/common.js b/Netdisco/share/views/js/common.js index d673dfe2..6385df6d 100644 --- a/Netdisco/share/views/js/common.js +++ b/Netdisco/share/views/js/common.js @@ -93,7 +93,9 @@ // form reset icon on ports tab $('#nd_sidebar-reset-link').attr('href', '/device?tab=ports&reset=on&' + - $('#ports_form').find('input[name="q"],input[name="f"],input[name="partial"]').serialize()) + $('#ports_form') + .find('input[name="q"],input[name="f"],input[name="partial"],input[name="invert"]') + .serialize()) [% END %] do_search(event, '[% tab.tag %]'); diff --git a/Netdisco/share/views/sidebar/device/ports.tt b/Netdisco/share/views/sidebar/device/ports.tt index 84c0c003..8c9e366b 100644 --- a/Netdisco/share/views/sidebar/device/ports.tt +++ b/Netdisco/share/views/sidebar/device/ports.tt @@ -15,6 +15,13 @@ + +