rename fields to keep main query in navbar

This commit is contained in:
Oliver Gorwits
2012-02-03 11:03:13 +00:00
parent 2246405fbf
commit c2213e7cfa
11 changed files with 22 additions and 22 deletions

View File

@@ -54,7 +54,7 @@ ajax '/ajax/content/device/:thing' => sub {
# device interface addresses # device interface addresses
ajax '/ajax/content/device/addresses' => sub { ajax '/ajax/content/device/addresses' => sub {
my $ip = param('ip'); my $ip = param('q');
return unless $ip; return unless $ip;
my $set = schema('netdisco')->resultset('DeviceIp')->search({ip => $ip}, { order_by => 'alias' }); my $set = schema('netdisco')->resultset('DeviceIp')->search({ip => $ip}, { order_by => 'alias' });
@@ -68,13 +68,13 @@ ajax '/ajax/content/device/addresses' => sub {
# device ports with a description (er, name) matching # device ports with a description (er, name) matching
ajax '/ajax/content/device/ports' => sub { ajax '/ajax/content/device/ports' => sub {
my $ip = param('ip'); my $ip = param('q');
return unless $ip; return unless $ip;
my $set = schema('netdisco')->resultset('DevicePort')->by_ip($ip); my $set = schema('netdisco')->resultset('DevicePort')->by_ip($ip);
# refine by ports if requested # refine by ports if requested
my $q = param('q'); my $q = param('f');
if ($q) { if ($q) {
if ($q =~ m/^\d+$/) { if ($q =~ m/^\d+$/) {
$set = $set->by_vlan($q); $set = $set->by_vlan($q);
@@ -107,7 +107,7 @@ ajax '/ajax/content/device/ports' => sub {
# device details table # device details table
ajax '/ajax/content/device/details' => sub { ajax '/ajax/content/device/details' => sub {
my $ip = param('ip'); my $ip = param('q');
return unless $ip; return unless $ip;
my $device = schema('netdisco')->resultset('Device')->find($ip); my $device = schema('netdisco')->resultset('Device')->find($ip);
@@ -120,7 +120,7 @@ ajax '/ajax/content/device/details' => sub {
}; };
get '/device' => sub { get '/device' => sub {
my $ip = NetAddr::IP::Lite->new(param('ip')); my $ip = NetAddr::IP::Lite->new(param('q'));
if (! $ip) { if (! $ip) {
redirect uri_for('/', {nosuchdevice => 1}); redirect uri_for('/', {nosuchdevice => 1});
return; return;

View File

@@ -14,7 +14,7 @@
<td>[% row.alias %]</a> <td>[% row.alias %]</a>
<td>[% row.dns.remove(settings.domain_suffix) %]</a> <td>[% row.dns.remove(settings.domain_suffix) %]</a>
<td class="center_cell"><a class="nd_linkcell" <td class="center_cell"><a class="nd_linkcell"
href="[% uri_for('/device') %]?tab=ports&ip=[% row.ip %]&q=[% row.port %]">[% row.port %]</a></td> href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.port %]">[% row.port %]</a></td>
<td>[% row.device_port.name %]</td> <td>[% row.device_port.name %]</td>
<td><a class="nd_linkcell" <td><a class="nd_linkcell"
href="[% uri_for('/search') %]?tab=device&ip=[% row.subnet %]">[% row.subnet %]</a></td> href="[% uri_for('/search') %]?tab=device&ip=[% row.subnet %]">[% row.subnet %]</a></td>

View File

@@ -85,7 +85,7 @@
<td> <td>
[% IF row.remote_ip %] [% IF row.remote_ip %]
[% IF row.neighbor %] [% IF row.neighbor %]
<a href="[% uri_for('/device') %]?tab=ports&ip=[% row.neighbor.ip | uri %]&q=[% row.remote_port | uri %]"> <a href="[% uri_for('/device') %]?tab=ports&q=[% row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]">
[% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip %] [% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip %]
([% row.remote_port | html_entity %])</a> ([% row.remote_port | html_entity %])</a>
[% ELSE %] [% ELSE %]

View File

@@ -14,7 +14,7 @@
</tbody> </tbody>
[% WHILE (row = results.next) %] [% WHILE (row = results.next) %]
<tr> <tr>
<td><a href="[% uri_for('/device') %]?ip=[% row.ip %]">[% row.dns.remove(settings.domain_suffix) %]</a></td> <td><a href="[% uri_for('/device') %]?q=[% row.ip %]">[% row.dns.remove(settings.domain_suffix) %]</a></td>
<td>[% row.contact %]</td> <td>[% row.contact %]</td>
<td>[% row.location %]</td> <td>[% row.location %]</td>
<td>[% row.name %]</td> <td>[% row.name %]</td>

View File

@@ -38,7 +38,7 @@
<td>&nbsp;</td> <td>&nbsp;</td>
[% END %] [% END %]
<td>Switch Port</td> <td>Switch Port</td>
<td><a href="[% uri_for('/device') %]?tab=ports&ip=[% node.switch | url %]&q=[% node.port | url %]">[% node.switch %] [ [% node.port %] ]</a> <td><a href="[% uri_for('/device') %]?tab=ports&q=[% node.switch | url %]&f=[% node.port | url %]">[% node.switch %] [ [% node.port %] ]</a>
[% ' (' _ node.device.dns.remove(settings.domain_suffix) _ ')' IF node.device.dns %] [% ' (' _ node.device.dns.remove(settings.domain_suffix) _ ')' IF node.device.dns %]
[% ' <span class="label warning">a</span>' IF NOT node.active %] [% ' <span class="label warning">a</span>' IF NOT node.active %]
</td> </td>

View File

@@ -66,7 +66,7 @@
</td> </td>
[% END %] [% END %]
<td>Switch Port</td> <td>Switch Port</td>
<td><a href="[% uri_for('/device') %]?tab=ports&ip=[% node.switch | url %]&q=[% node.port | url %]">[% node.switch %] [ [% node.port %] ]</a> <td><a href="[% uri_for('/device') %]?tab=ports&q=[% node.switch | url %]&f=[% node.port | url %]">[% node.switch %] [ [% node.port %] ]</a>
[% ' (' _ node.device.dns.remove(settings.domain_suffix) _ ')' IF node.device.dns %] [% ' (' _ node.device.dns.remove(settings.domain_suffix) _ ')' IF node.device.dns %]
[% ' <span class="label warning">a</span>' IF NOT node.active %] [% ' <span class="label warning">a</span>' IF NOT node.active %]
</td> </td>
@@ -97,7 +97,7 @@
</td> </td>
[% END %] [% END %]
<td>Switch Port</td> <td>Switch Port</td>
<td><a href="[% uri_for('/device') %]?tab=ports&ip=[% port.ip | url %]&q=[% port.port | url %]">[% port.ip %] [ [% port.port %] ]</a> <td><a href="[% uri_for('/device') %]?tab=ports&q=[% port.ip | url %]&f=[% port.port | url %]">[% port.ip %] [ [% port.port %] ]</a>
[% ' (' _ port.device.dns.remove(settings.domain_suffix) _ ')' IF port.device.dns %] [% ' (' _ port.device.dns.remove(settings.domain_suffix) _ ')' IF port.device.dns %]
</td> </td>
[% IF params.stamps %] [% IF params.stamps %]

View File

@@ -11,7 +11,7 @@
[% WHILE (row = results.next) %] [% WHILE (row = results.next) %]
<tr> <tr>
<td>[% row.name %]</td> <td>[% row.name %]</td>
<td><a href="[% uri_for('/device') %]?tab=ports&ip=[% row.ip %]&q=[% row.port %]">[% row.ip %] [ [% row.port %] ]</a> <td><a href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.port %]">[% row.ip %] [ [% row.port %] ]</a>
[% ' (' _ row.device.dns.remove(settings.domain_suffix) _ ')' IF row.device.dns %] [% ' (' _ row.device.dns.remove(settings.domain_suffix) _ ')' IF row.device.dns %]
</td> </td>
<td>[% row.descr %]</td> <td>[% row.descr %]</td>

View File

@@ -13,17 +13,17 @@
[% WHILE (row = results.next) %] [% WHILE (row = results.next) %]
<tr> <tr>
<td><a class="nd_linkcell nd_stealthlink" <td><a class="nd_linkcell nd_stealthlink"
href="[% uri_for('/device') %]?tab=ports&ip=[% row.ip %]&q=[% row.vlan.vlan %]">[% row.vlan.vlan %]</a></td> href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vlan.vlan %]</a></td>
<td><a class="nd_linkcell" <td><a class="nd_linkcell"
href="[% uri_for('/device') %]?tab=ports&ip=[% row.ip %]&q=[% row.vlan.vlan %]">[% row.dns %]</a></td> href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.dns %]</a></td>
<td><a class="nd_linkcell nd_stealthlink" <td><a class="nd_linkcell nd_stealthlink"
href="[% uri_for('/device') %]?tab=ports&ip=[% row.ip %]&q=[% row.vlan.vlan %]">[% row.vlan.description %]</a></td> href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vlan.description %]</a></td>
<td><a class="nd_linkcell nd_stealthlink" <td><a class="nd_linkcell nd_stealthlink"
href="[% uri_for('/device') %]?tab=ports&ip=[% row.ip %]&q=[% row.vlan.vlan %]">[% row.model %]</a></td> href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.model %]</a></td>
<td><a class="nd_linkcell nd_stealthlink" <td><a class="nd_linkcell nd_stealthlink"
href="[% uri_for('/device') %]?tab=ports&ip=[% row.ip %]&q=[% row.vlan.vlan %]">[% row.os %]</a></td> href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.os %]</a></td>
<td><a class="nd_linkcell nd_stealthlink" <td><a class="nd_linkcell nd_stealthlink"
href="[% uri_for('/device') %]?tab=ports&ip=[% row.ip %]&q=[% row.vlan.vlan %]">[% row.vendor %]</a></td> href="[% uri_for('/device') %]?tab=ports&q=[% row.ip %]&f=[% row.vlan.vlan %]">[% row.vendor %]</a></td>
</tr> </tr>
[% END %] [% END %]
</tbody> </tbody>

View File

@@ -17,8 +17,8 @@
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 1;</script> <script type="text/javascript">has_sidebar["[% tab.id %]"] = 1;</script>
[% CATCH %] [% CATCH %]
<!-- no "[% tab.id %]" search options --> <!-- no "[% tab.id %]" search options -->
<input name="ip" value="[% params.ip %]" type="hidden"/>
<input name="q" value="[% params.q %]" type="hidden"/> <input name="q" value="[% params.q %]" type="hidden"/>
<input name="f" value="[% params.f %]" type="hidden"/>
<script type="text/javascript">has_sidebar["[% tab.id %]"] = 0;</script> <script type="text/javascript">has_sidebar["[% tab.id %]"] = 0;</script>
[% END %] [% END %]
</form> </form>

View File

@@ -47,7 +47,7 @@
}); });
// show or hide sweeping brush icon when field has content // show or hide sweeping brush icon when field has content
var sweep = $('#ports_form').find("input[name=q]"); var sweep = $('#ports_form').find("input[name=f]");
if (sweep.val() === "") { if (sweep.val() === "") {
$('.field_clear_icon').hide(); $('.field_clear_icon').hide();

View File

@@ -1,12 +1,12 @@
<p><em>Port Filter Options</em></p> <p><em>Port Filter Options</em></p>
<input name="ip" value="[% params.ip %]" type="hidden"/> <input name="q" value="[% params.q %]" type="hidden"/>
<div class="clearfix"> <div class="clearfix">
<a class="field_clear_icon" href="#" <a class="field_clear_icon" href="#"
rel="twipsy" data-placement="above" data-offset="3" title="Show all Ports"> rel="twipsy" data-placement="above" data-offset="3" title="Show all Ports">
<img src="[% uri_base %]/images/tango_sweep.png"/></a> <img src="[% uri_base %]/images/tango_sweep.png"/></a>
<input class="nd_port_query span3" placeholder="Port, Name or VLAN" <input class="nd_port_query span3" placeholder="Port, Name or VLAN"
name="q" value="[% params.q %]" type="text" name="f" value="[% params.f %]" type="text"
rel="twipsy" data-placement="left" data-offset="5" title="Filter by Port, Name or VLAN"/> rel="twipsy" data-placement="left" data-offset="5" title="Filter by Port, Name or VLAN"/>
</div> </div>
<div class="clearfix"> <div class="clearfix">