diff --git a/lib/App/Netdisco/Web/Device.pm b/lib/App/Netdisco/Web/Device.pm index bf411c0b..143389b8 100644 --- a/lib/App/Netdisco/Web/Device.pm +++ b/lib/App/Netdisco/Web/Device.pm @@ -16,6 +16,7 @@ set('connected_properties' => [ ]); hook 'before_template' => sub { + my $tokens = shift; my $defaults = var('sidebar_defaults')->{'device_ports'} or return; @@ -34,6 +35,13 @@ hook 'before_template' => sub { } } + # used in the device search sidebar template to set selected items + foreach my $opt (qw/devgrp/) { + my $p = (ref [] eq ref param($opt) ? param($opt) + : (param($opt) ? [param($opt)] : [])); + $tokens->{"${opt}_lkp"} = { map { $_ => 1 } @$p }; + } + return if param('reset') or not var('sidebar_key') or (var('sidebar_key') ne 'device_ports'); @@ -69,6 +77,7 @@ get '/device' => require_login sub { params->{'tab'} ||= 'details'; template 'device', { display_name => ($others ? $first->ip : ($first->dns || $first->ip)), + devgrp_list => setting('host_group_displaynames'), device => params->{'tab'}, }; }; diff --git a/share/config.yml b/share/config.yml index 74a2f145..a34f6455 100644 --- a/share/config.yml +++ b/share/config.yml @@ -133,6 +133,7 @@ sidebar_defaults: mac_format: { default: IEEE } neigh_id: { default: null } device_netmap: + mapshow: { default: neighbors } colorgroups: { default: checked } report_moduleinventory: fruonly: { default: checked } @@ -180,6 +181,7 @@ host_groups: - '::1' - 'fe80::/10' - '127.0.0.0/8' +host_group_displaynames: {} device_identity: [] community: [] community_rw: [] diff --git a/share/public/css/netdisco.css b/share/public/css/netdisco.css index 471ae89d..f5553fbf 100644 --- a/share/public/css/netdisco.css +++ b/share/public/css/netdisco.css @@ -634,7 +634,7 @@ form .clearfix.success input { } .nd_netmap-sidebar { - margin-top: 7px; + /* margin-top: 7px; */ margin-left: -9px; } diff --git a/share/views/js/device.js b/share/views/js/device.js index 5a216c17..5ec3838f 100644 --- a/share/views/js/device.js +++ b/share/views/js/device.js @@ -120,9 +120,10 @@ }); $('#nd_netmap-save').on('click', function(event) { event.preventDefault(); + // if user enters vlan but does not submit this will save wrong data $.post( '[% uri_for('/ajax/data/device/netmappositions') %]' - ,'vlan=[% params.vlan %]&positions=' + JSON.stringify(graph.positions()) + ,'vlan=' + $('#nd_vlan-entry').val() + '&positions=' + JSON.stringify(graph.positions()) ); }); $('#nd_netmap-zoomtodevice').on('click', function(event) { diff --git a/share/views/sidebar/device/netmap.tt b/share/views/sidebar/device/netmap.tt index 2a76dcd1..3c00ff64 100644 --- a/share/views/sidebar/device/netmap.tt +++ b/share/views/sidebar/device/netmap.tt @@ -51,16 +51,18 @@
+ [% 'checked' IF vars.sidebar_defaults.device_netmap.mapshow == 'all' %] value="all">
- +
@@ -70,8 +72,9 @@ @@ -82,8 +85,8 @@ [% IF devgrp_list.size %]
[% END %] +
+ + +
+
-
- - -
-