#1064 display device and device port tags in web ui

This commit is contained in:
Oliver Gorwits
2023-07-19 13:01:51 +01:00
parent 4b99f0bb9c
commit 04ee1e1613
6 changed files with 52 additions and 19 deletions

View File

@@ -9,6 +9,8 @@ use App::Netdisco::Util::Port 'port_reconfig_check';
use App::Netdisco::Util::Web (); # for sort_port
use App::Netdisco::Web::Plugin;
use List::MoreUtils 'singleton';
register_device_tab({ tag => 'ports', label => 'Ports', provides_csv => 1 });
# device ports with a description (er, name) matching
@@ -254,6 +256,10 @@ get '/ajax/content/device/ports' => require_login sub {
map {$_->{portctl} = (port_reconfig_check($_, $device, logged_in_user) ? false : true)} @results;
}
# filter the tags by hide_tags setting
my @hide = @{ setting('hide_tags')->{'device_port'} };
map { $_->{filtered_tags} = [ singleton (@{ $_->tags || [] }, @hide, @hide) ] } @results;
# empty set would be a 'no records' msg
return unless scalar @results;