#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

@@ -7,6 +7,8 @@ use Dancer::Plugin::Auth::Extensible;
use App::Netdisco::Web::Plugin;
use List::MoreUtils 'singleton';
register_device_tab({ tag => 'details', label => 'Details' });
# device details table
@@ -40,10 +42,14 @@ ajax '/ajax/content/device/details' => require_login sub {
],
})->order_by('pos')->get_column('serial')->all;
# filter the tags by hide_tags setting
my @hide = @{ setting('hide_tags')->{'device'} };
content_type('text/html');
template 'ajax/device/details.tt', {
d => $results[0], p => \@power,
interfaces => \@interfaces,
filtered_tags => [ singleton (@{ $device->tags || [] }, @hide, @hide) ],
serials => [sort keys %{ { map {($_ => $_)} (@serials, ($device->serial ? $device->serial : ())) } }],
}, { layout => undef };
};