blib/lib/App/Netdisco/Web/CustomFields.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 46 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package App::Netdisco::Web::CustomFields;
2  
3 use Dancer ':syntax';
4  
5 use App::Netdisco::Web::Plugin;
6 use App::Netdisco::Util::CustomFields;
7  
8 foreach my $config (@{ setting('custom_fields')->{'device'} || [] }) {
9 next unless $config->{'name'};
10  
11 register_device_details({
12 %{ $config },
13 field => ('cf_' . $config->{'name'}),
14 label => ($config->{'label'} || ucfirst $config->{'name'}),
15 });
16 }
17  
18 foreach my $config (@{ setting('custom_fields')->{'device_port'} || [] }) {
19 next unless $config->{'name'};
20  
21 register_device_port_column({
22 position => 'right', # or "mid" or "right"
23 default => undef, # or "checked"
24 %{ $config },
25 field => ('cf_' . $config->{'name'}),
26 label => ($config->{'label'} || ucfirst $config->{'name'}),
27 });
28 }
29  
30 true;