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;
|
||||
@@ -60,12 +60,12 @@
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Reports <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
[% FOREACH category IN settings.report_order %]
|
||||
[% IF vars.reports.$category.size %]
|
||||
[% IF settings.reports_menu.$category.size %]
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#">[% category | html_entity %]</a>
|
||||
<ul class="dropdown-menu">
|
||||
[% FOREACH item IN settings.reports.$category %]
|
||||
<li><a href="[% uri_for(item.path) %]">[% item.label | html_entity %]</a></li>
|
||||
[% FOREACH item IN settings.reports_menu.$category %]
|
||||
<li><a href="[% uri_for('/report/' _ item) %]">[% settings.reports.$item.label | html_entity %]</a></li>
|
||||
[% END %]
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -1,31 +1,35 @@
|
||||
<div class="container">
|
||||
<div class="row nd_show-grid">
|
||||
<div class="span10 offset1">
|
||||
<form id="nd_dev_age_form" class="form-inline">
|
||||
Find Devices
|
||||
<select name="age_type" class="span2">
|
||||
<option value="first">First Discovered</option>
|
||||
<option value="last" selected="selected">Last Updated</option>
|
||||
</select>
|
||||
<select name="age_bool" class="span2">
|
||||
<option value="in">less than</option>
|
||||
<option value="not_in" selected="selected">more than</option>
|
||||
</select>
|
||||
<select name="age_num" class="span1">
|
||||
[% FOREACH count IN [1..32] %]
|
||||
<option[% ' selected="selected"' IF count == 3 %]>[% count %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
<select name="age_unit" class="span2">
|
||||
<option>days</option>
|
||||
<option>weeks</option>
|
||||
<option selected="selected">months</option>
|
||||
<option>years</option>
|
||||
</select>
|
||||
ago.
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="icon-search icon-white"></i></button>
|
||||
</form>
|
||||
<i class="sidebar_toggle icon-wrench icon-large" id="sidebar_toggle_img_out"
|
||||
rel="tooltip" data-placement="left" data-offset="5" data-title="Show Sidebar"></i>
|
||||
<div class="container-fluid">
|
||||
<div class="sidebar sidebar_pinned">
|
||||
<div class="well">
|
||||
<i class="sidebar_toggle icon-signout" id="sidebar_toggle_img_in"
|
||||
rel="tooltip" data-placement="left" data-offset="5" data-title="Hide Sidebar"></i>
|
||||
<i class="sidebar_pin icon-pushpin sidebar_pin_clicked"
|
||||
rel="tooltip" data-placement="left" data-offset="5" data-title="Unpin Sidebar"></i>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="[% report.tag %]_search" class="tab-pane active">
|
||||
<form id="[% report.tag %]_form" class="nd_sidesearchform form-stacked"
|
||||
method="get" action="[% uri_for('/report') %]">
|
||||
<input name="tab" value="[% report.tag %]" type="hidden"/>
|
||||
[% TRY %]
|
||||
[% INCLUDE "sidebar/report/${report.tag}.tt" %]
|
||||
<script type="text/javascript">has_sidebar["[% report.tag %]"] = 1;</script>
|
||||
[% CATCH %]
|
||||
<script type="text/javascript">has_sidebar["[% report.tag %]"] = 0;</script>
|
||||
[% END %]
|
||||
</form>
|
||||
</div> <!-- /tab-pane -->
|
||||
</div> <!-- /tab-content -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<ul id="search_results" class="nav nav-tabs">
|
||||
<li class="active"><a id="[% report.tag %]_link" href="#[% report.tag %]_pane">[% report.label %]</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="[% report.tag %]_pane"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user