make hide1002 and vlan_names true sidebar options and move to port properties section

This commit is contained in:
Oliver Gorwits
2022-08-03 06:22:51 +01:00
parent d6dea441eb
commit 3d81f3e5f6
7 changed files with 29 additions and 15 deletions

View File

@@ -126,7 +126,6 @@ sidebar_defaults:
c_mtu: { label: 'MTU', default: null, idx: 12 }
c_pvid: { label: 'Native VLAN', default: checked, idx: 13 }
c_vmember: { label: 'VLAN Membership', default: checked, idx: 14 }
c_vlan_names: { label: 'use VLAN Names', default: null, idx: 15 }
c_power: { label: 'PoE', default: null, idx: 16 }
c_ssid: { label: 'SSID', default: null, idx: 17 }
c_nodes: { label: 'Connected Nodes', default: null, idx: 18 }
@@ -145,7 +144,8 @@ sidebar_defaults:
n_archived: { label: 'Archived Data', default: null, idx: 8 }
age_num: { default: 3 }
age_unit: { default: months }
hide1002: { default: checked }
p_vlan_names: { label: 'Use VLAN Names', default: null, idx: 0 }
p_hide1002: { label: 'Hide VLAN 1002-1005', default: null, idx: 1 }
device_netmap:
showips: { default: null }
showspeed: { default: null }

View File

@@ -56,6 +56,13 @@ device_auth:
#discover_waps: true
#discover_phones: false
# show VLAN names instead of VLAN numbers in Device Ports table.
# hide VLAN 1002-1005 in Device Ports (useful for older Cisco).
#sidebar_defaults:
# device_ports:
# p_vlan_names: { default: checked }
# p_hide1002: { default: checked }
# this is the schedule for automatically keeping netdisco up-to-date;
# these are good defaults, so only uncomment if needing to change.
# (or set "schedule: null" if you wish to disable the scheduler)

View File

@@ -4,7 +4,7 @@
<tr>
<th></th>
[% FOREACH item IN settings.port_columns %]
[% NEXT IF item.name == 'c_admin' OR item.name == 'c_vlan_names' %]
[% NEXT IF item.name == 'c_admin' %]
[% NEXT IF item.name == 'c_nodes' AND params.c_nodes AND params.c_neighbors %]
[% NEXT UNLESS params.${item.name} %]
[% SET th_class = '' %]
@@ -204,7 +204,7 @@
<td>
[% IF row.vlan AND row.vlan > 0 %]
<a class="nd_linkcell"
[% IF params.c_vlan_names %]
[% IF params.p_vlan_names %]
href="[% uri_for('/search') | none %]?tab=vlan&q=[% row.get_column('native_vlan_name') | uri %]">
[% row.get_column('native_vlan_name') | html_entity %]</a>
[% ELSE %]
@@ -218,10 +218,10 @@
[% IF params.c_vmember %]
<td>
[% IF vlans.exists($portname) %]
[% IF vlans.$portname.size %]
[% IF vlans.$portname.vlan_count <= settings.devport_vlan_limit %]
[% SET vlan_count = vlans.$portname.vlan_count %]
[% IF params.c_vlan_names %][% SET vlanlist = vlans.$portname.vlan_name_set %]
[% IF params.p_vlan_names %][% SET vlanlist = vlans.$portname.vlan_name_set %]
[% ELSE %][% SET vlanlist = vlans.$portname.vlan_set %][% END %]
[% IF vlan_count > 10 %] [%# TODO make this a settable variable %]
<div class="nd_vlan-total">([% vlan_count %])</div><span class="nd_linkcell nd_collapse-vlans">

View File

@@ -3,7 +3,7 @@
[% SET headers = [] %]
[% SET c_nodes_pos = -1 %]
[% FOREACH item IN settings.port_columns %]
[% NEXT IF item.name == 'c_admin' OR item.name == 'c_vlan_names' %]
[% NEXT IF item.name == 'c_admin' %]
[% NEXT UNLESS params.${item.name} %]
[% IF item.name == 'c_nodes' %]
@@ -108,13 +108,13 @@
[% END %]
[% IF params.c_pvid %]
[% myport.push(params.c_vlan_names ? row.get_column('native_vlan_name') : row.vlan) %]
[% myport.push(params.p_vlan_names ? row.get_column('native_vlan_name') : row.vlan) %]
[% END %]
[% IF params.c_vmember %]
[% SET portname = row.port %]
[% SET output = '' %]
[% IF params.c_vlan_names %][% SET vlanlist = vlans.$portname.vlan_name_set %]
[% IF params.p_vlan_names %][% SET vlanlist = vlans.$portname.vlan_name_set %]
[% ELSE %][% SET vlanlist = vlans.$portname.vlan_set %][% END %]
[% FOREACH vlan IN vlanlist %]
[% SET output = output _ ',' IF NOT loop.first %]

View File

@@ -70,8 +70,6 @@
name="[% item.name | html_entity %]"[% ' checked="checked"' IF vars.sidebar_defaults.device_ports.${item.name} %] />
[% IF item.name == 'c_admin' %]
<span class="label label-info">[% item.label | html_entity %]</span>
[% ELSIF item.name == 'c_vlan_names' %]
<span class="label label-default">[% item.label | html_entity %]</span>
[% ELSE %]
[% item.label | html_entity %]
[% END %]
@@ -139,12 +137,15 @@
</select>
</div>
</li>
[% FOREACH item IN settings.port_display_properties %]
<li>
<label class="checkbox">
<input type="checkbox" id="hide1002"
name="hide1002" [% ' checked="checked"' IF vars.sidebar_defaults.device_ports.hide1002 %] />Hide VLAN 1002-1005
<input type="checkbox" id="[% item.name | html_entity %]"
name="[% item.name | html_entity %]"[% ' checked="checked"' IF vars.sidebar_defaults.device_ports.${item.name} %] />
[% item.label | html_entity %]
</label>
</li>
[% END %]
</ul>
</div>
</div>