diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm index 69c9ba4b..89bf0a23 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm @@ -31,19 +31,9 @@ ajax '/ajax/content/device/ports' => require_login sub { return unless $set->count; } else { - # Google-style search. Quoted means exact, otherwise wildcard. - # but still supoort manual wildcarding. - if ($f =~ m/^['"]/ and $f =~ m/['"]$/) { - $f =~ s/^['"]//; - $f =~ s/['"]$//; - } - else { - $f =~ s/\*/%/g; - $f =~ s/\?/_/g; - $f =~ s/^\%*/%/; - $f =~ s/\%*$/%/; - $f = { '-ilike' => $f }; - } + $f =~ s/\*/%/g if index($f, '*') >= 0; + $f =~ s/\?/_/g if index($f, '?') >= 0; + $f = { '-ilike' => $f }; if ($set->search({'me.port' => $f})->count) { $set = $set->search({'me.port' => $f}); diff --git a/Netdisco/share/views/ajax/device/addresses.tt b/Netdisco/share/views/ajax/device/addresses.tt index d4d45cd5..36231a3c 100644 --- a/Netdisco/share/views/ajax/device/addresses.tt +++ b/Netdisco/share/views/ajax/device/addresses.tt @@ -14,7 +14,7 @@ [% row.alias | html_entity %] [% row.dns | html_entity %] [% row.port | html_entity %] + href="[% device_ports %]&q=[% params.q | uri %]&f=[% row.port | uri %]">[% row.port | html_entity %] [% row.device_port.name | html_entity %] [% row.subnet | html_entity %] diff --git a/Netdisco/share/views/ajax/device/ports.tt b/Netdisco/share/views/ajax/device/ports.tt index e562755c..5f4a42db 100644 --- a/Netdisco/share/views/ajax/device/ports.tt +++ b/Netdisco/share/views/ajax/device/ports.tt @@ -61,7 +61,7 @@ [% END %] + self_options) %]&q=[% params.q | uri %]&f=[% row.port | uri %]"> [% row.port | html_entity %] [% END %] @@ -211,7 +211,7 @@ [% IF params.c_neighbors AND (row.remote_ip OR row.is_uplink) %] [% IF row.neighbor %] + self_options) %]&q=[% row.neighbor.dns || row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]"> [% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip | html_entity %] ([% row.remote_port | html_entity %] [% ' id: '_ row.remote_id IF row.remote_id %] diff --git a/Netdisco/share/views/ajax/report/duplexmismatch.tt b/Netdisco/share/views/ajax/report/duplexmismatch.tt index 5ee66449..1d9ad1c4 100644 --- a/Netdisco/share/views/ajax/report/duplexmismatch.tt +++ b/Netdisco/share/views/ajax/report/duplexmismatch.tt @@ -14,13 +14,13 @@ [% row.left_dns || row.left_ip | html_entity %] + href="[% device_ports %]&q=[% row.left_dns || row.left_ip | uri %]&f=[% row.left_port | uri %]&c_duplex=on"> [% row.left_port | html_entity %] [% row.left_duplex.ucfirst | html_entity %] [% row.right_dns || row.right_ip | html_entity %] + href="[% device_ports %]&q=[% row.right_dns || row.right_ip | uri %]&f=[% row.right_port | uri %]&c_duplex=on"> [% row.right_port | html_entity %] [% row.right_duplex.ucfirst | html_entity %] diff --git a/Netdisco/share/views/ajax/report/halfduplex.tt b/Netdisco/share/views/ajax/report/halfduplex.tt index 5ce01886..f5594292 100644 --- a/Netdisco/share/views/ajax/report/halfduplex.tt +++ b/Netdisco/share/views/ajax/report/halfduplex.tt @@ -12,7 +12,7 @@ [% row.device.dns || row.device.ip | html_entity %] + href="[% device_ports %]&q=[% row.device.dns || row.device.ip | uri %]&f=[% row.port | uri %]&c_duplex=on"> [% row.port | html_entity %] [% row.name | html_entity %] [% row.duplex.ucfirst | html_entity %] diff --git a/Netdisco/share/views/ajax/search/node_by_ip.tt b/Netdisco/share/views/ajax/search/node_by_ip.tt index a230f0ae..fbe15b58 100644 --- a/Netdisco/share/views/ajax/search/node_by_ip.tt +++ b/Netdisco/share/views/ajax/search/node_by_ip.tt @@ -40,7 +40,7 @@ [% END %] Switch Port + href="[% device_ports %]&q=[% node.device.dns || node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on"> [% node.switch | html_entity %] - [% node.port | html_entity %] [% '  ' IF NOT node.active %] [% IF node.device.dns AND node.device_port AND node.device_port.name %] diff --git a/Netdisco/share/views/ajax/search/node_by_mac.tt b/Netdisco/share/views/ajax/search/node_by_mac.tt index e54c6186..7c6e489e 100644 --- a/Netdisco/share/views/ajax/search/node_by_mac.tt +++ b/Netdisco/share/views/ajax/search/node_by_mac.tt @@ -69,7 +69,7 @@ [% END %] Switch Port + href="[% device_ports %]&q=[% node.device.dns || node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on"> [% node.switch | html_entity %] - [% node.port | html_entity %] [% '  ' IF NOT node.active %] [% IF node.device.dns AND node.device_port AND node.device_port.name %] @@ -104,7 +104,7 @@ [% END %] Switch Port + href="[% device_ports %]&q=[% port.device.dns || port.ip | uri %]&f=[% port.port | uri %]&c_mac=on&c_nodes=on&c_neighbors=on"> [% port.ip | html_entity %] - [% port.descr | html_entity %] [% IF port.device.dns AND port.name %] ([% port.device.dns | html_entity %] - [% port.name | html_entity %]) diff --git a/Netdisco/share/views/ajax/search/port.tt b/Netdisco/share/views/ajax/search/port.tt index b86af1f9..7d00832f 100644 --- a/Netdisco/share/views/ajax/search/port.tt +++ b/Netdisco/share/views/ajax/search/port.tt @@ -11,7 +11,7 @@ [% WHILE (row = results.next) %] [% row.name | html_entity %] - + [% row.ip | html_entity %] [ [% row.port | html_entity %] ] [% ' (' _ row.device.dns _ ')' IF row.device.dns %] diff --git a/Netdisco/share/views/js/device.js b/Netdisco/share/views/js/device.js index 0900ef8a..e8439baa 100644 --- a/Netdisco/share/views/js/device.js +++ b/Netdisco/share/views/js/device.js @@ -68,7 +68,7 @@ var port = $(this).text(); port = $.trim(port); - portfilter.val('"'+ port +'"'); + portfilter.val(port); $('.nd_field-clear-icon').show(); $('#ports_form').trigger('submit');