blib/lib/App/Netdisco/Web/Plugin/AdminTask/UndiscoveredNeighbors.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod n/a totaltotal 0.0% 0 / 41 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::Plugin::AdminTask::UndiscoveredNeighbors;
2  
3 use strict;
4 use warnings;
5 use Dancer ':syntax';
6 use Dancer::Plugin::DBIC;
7 use Dancer::Plugin::Auth::Extensible;
8 use App::Netdisco::Util::Device qw/is_discoverable/;
9  
10 use App::Netdisco::Web::Plugin;
11  
12 register_admin_task(
13 { tag => 'undiscoveredneighbors',
14 label => 'Undiscovered Neighbors',
15 provides_csv => 1,
16 }
17 );
18  
19 # just to note a problem with this query:
20 # using DeviceSkip to see if discover is blocked, but that table only shows
21 # blocked actions on backends not permitted, so there may be a backend running
22 # that permits the action, we would not know.
23  
24 get '/ajax/content/admin/undiscoveredneighbors' => require_role admin => sub {
25 my @results
26 = schema(vars->{'tenant'})->resultset('Virtual::UndiscoveredNeighbors')->hri->all;
27 return unless scalar @results;
28  
29 if ( request->is_ajax ) {
30 template 'ajax/admintask/undiscoveredneighbors.tt',
31 { results => \@results, },
32 { layout => undef };
33 }
34 else {
35 header( 'Content-Type' => 'text/comma-separated-values' );
36 template 'ajax/admintask/undiscoveredneighbors_csv.tt',
37 { results => \@results, },
38 { layout => undef };
39 }
40 };
41  
42 1;