make VLAN names option work for VLANS missing a name

This commit is contained in:
Oliver Gorwits
2022-07-27 21:30:42 +01:00
parent ba7347eafa
commit 48b7447537
3 changed files with 6 additions and 6 deletions

View File

@@ -109,8 +109,8 @@ get '/ajax/content/device/ports' => require_login sub {
select => [
'port',
{ count => 'port_vlans.vlan', -as => 'vlan_count' },
{ array_agg => 'port_vlans.vlan', -as => 'vlan_set' },
{ array_agg => 'vlan_entry.description', -as => 'vlan_name_set' },
{ array_agg => \q{port_vlans.vlan ORDER BY port_vlans.vlan}, -as => 'vlan_set' },
{ array_agg => \q{COALESCE(NULLIF(vlan_entry.description,''), vlan_entry.vlan::text) ORDER BY vlan_entry.vlan}, -as => 'vlan_name_set' },
],
join => {'port_vlans' => 'vlan_entry'},
group_by => 'me.port',

View File

@@ -220,8 +220,8 @@
<td>
[% 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.sort %]
[% ELSE %][% SET vlanlist = vlans.$portname.vlan_set.nsort %][% END %]
[% IF params.c_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">
<div class="nd_arrow-up-down-left icon-chevron-up icon-large"></div>Show VLANs</span>

View File

@@ -114,8 +114,8 @@
[% IF params.c_vmember %]
[% SET portname = row.port %]
[% SET output = '' %]
[% IF params.c_vlan_names %][% SET vlanlist = vlans.$portname.vlan_name_set.sort %]
[% ELSE %][% SET vlanlist = vlans.$portname.vlan_set.nsort %][% END %]
[% IF params.c_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 %]
[% SET output = output _ vlan %]