initial location filtering

This commit is contained in:
Oliver Gorwits
2018-03-10 14:27:04 +00:00
parent ffc3f21533
commit 22e6e7a2d8
3 changed files with 31 additions and 5 deletions

View File

@@ -82,7 +82,8 @@ get '/device' => require_login sub {
params->{'tab'} ||= 'details';
template 'device', {
display_name => ($others ? $first->ip : ($first->dns || $first->ip)),
hgroup_list => setting('host_group_displaynames'),
location_list => [ schema('netdisco')->resultset('Device')->get_distinct_col('location') ],
hgroup_list => setting('host_group_displaynames'),
device => params->{'tab'},
};
};

View File

@@ -122,8 +122,8 @@ ajax '/ajax/data/device/netmap' => require_login sub {
grep { defined } @{ $hgroup };
# list of locations selected by user and passed in param
my $locgrp = (ref [] eq ref param('locgrp') ? param('locgrp') : [param('locgrp')]);
my @lgrplist = List::MoreUtils::uniq grep { defined } @{ $locgrp };
my $lgroup = (ref [] eq ref param('lgroup') ? param('lgroup') : [param('lgroup')]);
my @lgrplist = List::MoreUtils::uniq grep { defined } @{ $lgroup };
my %ok_dev = ();
my %logvals = ();

View File

@@ -60,7 +60,7 @@
<div class="radio radio-success">
<input type="radio" name="mapshow" id="nd_mapshow-neighbors"
[% 'checked' IF vars.sidebar_defaults.device_netmap.mapshow == 'neighbors' %] value="neighbors">
<label for="nd_mapshow-neighbors">Neighbors Only</label>
<label for="nd_mapshow-neighbors">Only Neighbors</label>
</div>
[% IF hgroup_list.size %]
@@ -72,7 +72,7 @@
<input type="radio" name="mapshow" id="nd_mapshow-hgroup"
[% 'checked' IF vars.sidebar_defaults.device_netmap.mapshow == 'hgroup' %]
[% 'disabled' IF NOT hgroup_list.size %] value="hgroup">
<label for="nd_mapshow-hgroup">Host Groups</label>
<label for="nd_mapshow-hgroup">Only Host Groups</label>
</div>
[% IF hgroup_list.size %]
@@ -88,6 +88,31 @@
</div>
[% END %]
[% IF location_list.size %]
<div class="radio radio-success">
[% ELSE %]
<div class="radio radio-success tooltip-wrapper"
rel="tooltip" data-placement="left" data-offset="5" data-title="No Locations Found">
[% END %]
<input type="radio" name="mapshow" id="nd_mapshow-location"
[% 'checked' IF vars.sidebar_defaults.device_netmap.mapshow == 'location' %]
[% 'disabled' IF NOT location_list.size %] value="location">
<label for="nd_mapshow-lgroup">Only Locations</label>
</div>
[% IF location_list.size %]
<div class="clearfix">
<select class="nd_side-select" size="[% location_list.size > 5 ? 5 : location_list.size %]"
multiple="on" name="lgroup" id="nd_lgroup-select"
rel="tooltip" data-placement="left" data-offset="5" data-title="Host Groups"/>
[% FOREACH loc IN location_list %]
<option[% ' selected="selected"' IF location_lkp.exists(loc) %]
value="[% loc %]">[% loc | html_entity %]</option>
[% END %]
</select>
</div>
[% END %]
<div class="clearfix nd_netmap-sidebar">
<div id="nd_vlan-label" class="control-group">