« blib/lib/App/Netdisco/Web/Plugin/Report/VlanInventory.pm
↑ Summary
blib/lib/App/Netdisco/Web/Plugin/Search/Node.pm »
| 1 | package App::Netdisco::Web::Plugin::Report::VrfInconsistency; | ||
| 2 | |||
| 3 | use Dancer ':syntax'; | ||
| 4 | use Dancer::Plugin::DBIC; | ||
| 5 | use Dancer::Plugin::Auth::Extensible; | ||
| 6 | |||
| 7 | use App::Netdisco::Web::Plugin; | ||
| 8 | |||
| 9 | register_report( | ||
| 10 | { category => 'IP', | ||
| 11 | tag => 'vrfinconsistency', | ||
| 12 | label => 'VRF Naming Inconsistencies', | ||
| 13 | provides_csv => 1, | ||
| 14 | api_endpoint => 1, | ||
| 15 | } | ||
| 16 | ); | ||
| 17 | |||
| 18 | get '/ajax/content/report/vrfinconsistency' => require_login sub { | ||
| 19 | my @results = schema(vars->{'tenant'})->resultset('Virtual::VrfInconsistency') | ||
| 20 | ->search( undef, { order_by => [qw/ finding domain vrfs /] } )->hri->all; | ||
| 21 | |||
| 22 | return unless scalar @results; | ||
| 23 | |||
| 24 | if ( request->is_ajax ) { | ||
| 25 | template 'ajax/report/vrfinconsistency.tt', { results => to_json(\@results) }, { layout => 'noop' }; | ||
| 26 | } | ||
| 27 | else { | ||
| 28 | header( 'Content-Type' => 'text/comma-separated-values' ); | ||
| 29 | template 'ajax/report/vrfinconsistency_csv.tt', { results => \@results }, { layout => 'noop' }; | ||
| 30 | } | ||
| 31 | }; | ||
| 32 | |||
| 33 | true; |