implement first report - duplex mismatch - as a placeholder only
This commit is contained in:
		| @@ -12,6 +12,7 @@ use URI::QueryParam (); # part of URI, to add helper methods | ||||
| use App::Netdisco::Web::AuthN; | ||||
| use App::Netdisco::Web::Search; | ||||
| use App::Netdisco::Web::Device; | ||||
| use App::Netdisco::Web::Report; | ||||
| use App::Netdisco::Web::TypeAhead; | ||||
| use App::Netdisco::Web::PortControl; | ||||
|  | ||||
|   | ||||
| @@ -7,6 +7,7 @@ set( | ||||
|   'navbar_items' => [], | ||||
|   'search_tabs'  => [], | ||||
|   'device_tabs'  => [], | ||||
|   'reports_menu' => {}, | ||||
|   'reports' => {}, | ||||
|   'report_order' => [qw/Device Port Node VLAN Network Wireless/], | ||||
| ); | ||||
| @@ -92,14 +93,16 @@ register 'register_report' => sub { | ||||
|       return; | ||||
|   } | ||||
|  | ||||
|   foreach my $item (@{setting('reports')->{ $config->{category} }}) { | ||||
|       if ($item->{tag} eq $config->{tag}) { | ||||
|           $item = $config; | ||||
|   foreach my $item (@{setting('reports_menu')->{ $config->{category} }}) { | ||||
|       if ($item eq $config->{tag}) { | ||||
|           $item = $config->{tag}; | ||||
|           setting('reports')->{$config->{tag}} = $config; | ||||
|           return; | ||||
|       } | ||||
|   } | ||||
|  | ||||
|   push @{setting('reports')->{ $config->{category} }}, $config; | ||||
|   push @{setting('reports_menu')->{ $config->{category} }}, $config->{tag}; | ||||
|   setting('reports')->{$config->{tag}} = $config; | ||||
| }; | ||||
|  | ||||
| register_plugin; | ||||
|   | ||||
| @@ -0,0 +1,26 @@ | ||||
| package App::Netdisco::Web::Plugin::Report::DuplexMismatch; | ||||
|  | ||||
| use Dancer ':syntax'; | ||||
| use Dancer::Plugin::Ajax; | ||||
| use Dancer::Plugin::DBIC; | ||||
|  | ||||
| use App::Netdisco::Web::Plugin; | ||||
|  | ||||
| register_report({ | ||||
|   category => 'Port', | ||||
|   tag => 'duplexmismatch', | ||||
|   label => 'Duplex Mismatches Between Devices', | ||||
| }); | ||||
|  | ||||
| ajax '/ajax/content/report/duplexmismatch' => sub { | ||||
| #    my $q = param('q'); | ||||
| #    my $device = schema('netdisco')->resultset('Device') | ||||
| #      ->with_times()->search_for_device($q) or return; | ||||
|  | ||||
|     content_type('text/html'); | ||||
|     template 'ajax/report/duplexmismatch.tt', { | ||||
| #      d => $device, | ||||
|     }, { layout => undef }; | ||||
| }; | ||||
|  | ||||
| true; | ||||
							
								
								
									
										14
									
								
								Netdisco/lib/App/Netdisco/Web/Report.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								Netdisco/lib/App/Netdisco/Web/Report.pm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| package App::Netdisco::Web::Report; | ||||
|  | ||||
| use Dancer ':syntax'; | ||||
|  | ||||
| get '/report/*' => sub { | ||||
|     my ($tag) = splat; | ||||
|  | ||||
|     var(nav => 'reports'); | ||||
|     template 'report', { | ||||
|       report => setting('reports')->{ $tag }, | ||||
|     }; | ||||
| }; | ||||
|  | ||||
| true; | ||||
		Reference in New Issue
	
	Block a user