make netmap Color By Host Group work with no groups selected

This commit is contained in:
Oliver Gorwits
2018-04-23 20:41:07 +01:00
parent f7df6b907b
commit 5eb443438c
2 changed files with 6 additions and 2 deletions

View File

@@ -226,11 +226,15 @@ ajax '/ajax/data/device/netmap' => require_login sub {
next DEVICE if ((scalar @lgrplist) and ((!defined $device->location) next DEVICE if ((scalar @lgrplist) and ((!defined $device->location)
or (0 == scalar grep {$_ eq $device->location} @lgrplist))); or (0 == scalar grep {$_ eq $device->location} @lgrplist)));
# if host groups piked then use ACLs to filter # if host groups picked then use ACLs to filter
my $first_hgrp = my $first_hgrp =
first { check_acl_only($device, setting('host_groups')->{$_}) } @hgrplist; first { check_acl_only($device, setting('host_groups')->{$_}) } @hgrplist;
next DEVICE if ((scalar @hgrplist) and (not $first_hgrp)); next DEVICE if ((scalar @hgrplist) and (not $first_hgrp));
# now reset first_hgroup to be the group matching the device, if any
$first_hgrp = first { check_acl_only($device, setting('host_groups')->{$_}) }
keys %{ setting('host_group_displaynames') || {} };
++$logvals{ $device->get_column('log') || 1 }; ++$logvals{ $device->get_column('log') || 1 };
(my $name = lc($device->dns || $device->name || $device->ip)) =~ s/$domain$//; (my $name = lc($device->dns || $device->name || $device->ip)) =~ s/$domain$//;

View File

@@ -623,7 +623,7 @@ div.toggle.btn-small {
/* when the sidebar submit button DOES NOT HAVE a dropdown */ /* when the sidebar submit button DOES NOT HAVE a dropdown */
.nd_sidebar button:not(.nd_sidebar-btn-drop):not(.nd_sidebar-btn-drop-drop):not(.nd_sidebar-btn-netmap) { .nd_sidebar button:not(.nd_sidebar-btn-drop):not(.nd_sidebar-btn-drop-drop):not(.nd_sidebar-btn-netmap) {
margin-top: 9px; margin-top: 9px;
margin-left: -3px; margin-left: -2px;
width: 165px; width: 165px;
} }