diff --git a/lib/App/Netdisco/Web.pm b/lib/App/Netdisco/Web.pm index 3cae4070..6702c416 100644 --- a/lib/App/Netdisco/Web.pm +++ b/lib/App/Netdisco/Web.pm @@ -6,6 +6,7 @@ use Dancer::Plugin::Ajax; use Dancer::Plugin::DBIC; use Dancer::Plugin::Auth::Extensible; +use URI (); use Socket6 (); # to ensure dependency is met use HTML::Entities (); # to ensure dependency is met use URI::QueryParam (); # part of URI, to add helper methods @@ -129,6 +130,12 @@ hook 'before_template' => sub { # allow portable dynamic content $tokens->{uri_for} = sub { uri_for(@_)->path_query }; + # current query string to all resubmit from within ajax template + my $queryuri = URI->new(); + $queryuri->query_param($_ => param($_)) + for grep {$_ ne 'return_url'} keys %{params()}; + $tokens->{my_query} = $queryuri->query(); + # access to logged in user's roles $tokens->{user_has_role} = sub { user_has_role(@_) }; diff --git a/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm b/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm index 05586848..5d9f6aa3 100644 --- a/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm +++ b/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm @@ -49,7 +49,10 @@ ajax '/ajax/data/device/netmappositions' => require_login sub { } }; +# q +# vlan # mapshow=all,neighbors,only + # devgrp[] # colorgroups # dynamicsize diff --git a/share/views/ajax/device/netmap.tt b/share/views/ajax/device/netmap.tt index 6bc55a7f..7a3afc87 100644 --- a/share/views/ajax/device/netmap.tt +++ b/share/views/ajax/device/netmap.tt @@ -29,11 +29,7 @@ function resizeGraphContainer() { }, 500) } -$.getJSON('[% uri_for('/ajax/data/device/netmap') %]',{ - q: '[% params.q %]' - ,vlan: '[% params.vlan %]' - ,mapshow: '[% params.mapshow %]' - }, function(mapdata) { +$.getJSON('[% uri_for('/ajax/data/device/netmap') %]?[% my_query %]', function(mapdata) { jQuery(document).ready(function() { window.graph = netGobrechtsD3Force('netmap_pane') diff --git a/share/views/sidebar/device/netmap.tt b/share/views/sidebar/device/netmap.tt index 3c00ff64..d6240cac 100644 --- a/share/views/sidebar/device/netmap.tt +++ b/share/views/sidebar/device/netmap.tt @@ -64,7 +64,7 @@ - + [% IF devgrp_list.size %] @@ -82,6 +82,15 @@
+
+
+ +
+
+ [% IF devgrp_list.size %]
-
-
- -
-
-