add invert port search option, fix wildcarding on partial
This commit is contained in:
@@ -36,10 +36,15 @@ ajax '/ajax/content/device/ports' => require_login sub {
|
|||||||
$f =~ s/\*/%/g;
|
$f =~ s/\*/%/g;
|
||||||
$f =~ s/\?/_/g;
|
$f =~ s/\?/_/g;
|
||||||
# set wilcards at param boundaries
|
# set wilcards at param boundaries
|
||||||
$f =~ s/^\%*/%/;
|
if ($f !~ m/[%_]/) {
|
||||||
$f =~ s/\%*$/%/;
|
$f =~ s/^\%*/%/;
|
||||||
|
$f =~ s/\%*$/%/;
|
||||||
|
}
|
||||||
# enable ILIKE op
|
# 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) {
|
if ($set->search({'me.port' => $f})->count) {
|
||||||
|
|||||||
@@ -406,8 +406,8 @@ td > form.nd_inline-form {
|
|||||||
|
|
||||||
/* fixup for prepended partial port name checkbox in sidebar */
|
/* fixup for prepended partial port name checkbox in sidebar */
|
||||||
.nd_port-partial-checkbox {
|
.nd_port-partial-checkbox {
|
||||||
width: 136px;
|
width: 84px;
|
||||||
padding: 0px 0px 0px 11px !important;
|
padding: 0px 0px 0px 5px !important;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,6 +421,27 @@ td > form.nd_inline-form {
|
|||||||
margin-bottom: 5px !important;
|
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 */
|
/* fixup for prepended checkbox in sidebar */
|
||||||
.nd_sidebar .input-prepend {
|
.nd_sidebar .input-prepend {
|
||||||
margin-left: -2px;
|
margin-left: -2px;
|
||||||
|
|||||||
@@ -93,7 +93,9 @@
|
|||||||
|
|
||||||
// form reset icon on ports tab
|
// form reset icon on ports tab
|
||||||
$('#nd_sidebar-reset-link').attr('href', '/device?tab=ports&reset=on&' +
|
$('#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 %]
|
[% END %]
|
||||||
|
|
||||||
do_search(event, '[% tab.tag %]');
|
do_search(event, '[% tab.tag %]');
|
||||||
|
|||||||
@@ -15,6 +15,13 @@
|
|||||||
<label class="nd_checkboxlabel" for="partial">
|
<label class="nd_checkboxlabel" for="partial">
|
||||||
<span class="nd_port-partial-checkbox uneditable-input">Partial Match</span>
|
<span class="nd_port-partial-checkbox uneditable-input">Partial Match</span>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="add-on nd_port-invert-label">
|
||||||
|
<input type="checkbox" id="invert"
|
||||||
|
name="invert"[% ' checked="checked"' IF params.invert %]/>
|
||||||
|
</label>
|
||||||
|
<label class="nd_checkboxlabel" for="invert">
|
||||||
|
<span class="nd_port-invert-checkbox uneditable-input">Not</span>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
|
|||||||
Reference in New Issue
Block a user