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::AuthN;
|
||||||
use App::Netdisco::Web::Search;
|
use App::Netdisco::Web::Search;
|
||||||
use App::Netdisco::Web::Device;
|
use App::Netdisco::Web::Device;
|
||||||
|
use App::Netdisco::Web::Report;
|
||||||
use App::Netdisco::Web::TypeAhead;
|
use App::Netdisco::Web::TypeAhead;
|
||||||
use App::Netdisco::Web::PortControl;
|
use App::Netdisco::Web::PortControl;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ set(
|
|||||||
'navbar_items' => [],
|
'navbar_items' => [],
|
||||||
'search_tabs' => [],
|
'search_tabs' => [],
|
||||||
'device_tabs' => [],
|
'device_tabs' => [],
|
||||||
|
'reports_menu' => {},
|
||||||
'reports' => {},
|
'reports' => {},
|
||||||
'report_order' => [qw/Device Port Node VLAN Network Wireless/],
|
'report_order' => [qw/Device Port Node VLAN Network Wireless/],
|
||||||
);
|
);
|
||||||
@@ -92,14 +93,16 @@ register 'register_report' => sub {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $item (@{setting('reports')->{ $config->{category} }}) {
|
foreach my $item (@{setting('reports_menu')->{ $config->{category} }}) {
|
||||||
if ($item->{tag} eq $config->{tag}) {
|
if ($item eq $config->{tag}) {
|
||||||
$item = $config;
|
$item = $config->{tag};
|
||||||
|
setting('reports')->{$config->{tag}} = $config;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
push @{setting('reports')->{ $config->{category} }}, $config;
|
push @{setting('reports_menu')->{ $config->{category} }}, $config->{tag};
|
||||||
|
setting('reports')->{$config->{tag}} = $config;
|
||||||
};
|
};
|
||||||
|
|
||||||
register_plugin;
|
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>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Reports <b class="caret"></b></a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
[% FOREACH category IN settings.report_order %]
|
[% FOREACH category IN settings.report_order %]
|
||||||
[% IF vars.reports.$category.size %]
|
[% IF settings.reports_menu.$category.size %]
|
||||||
<li class="dropdown-submenu">
|
<li class="dropdown-submenu">
|
||||||
<a href="#">[% category | html_entity %]</a>
|
<a href="#">[% category | html_entity %]</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
[% FOREACH item IN settings.reports.$category %]
|
[% FOREACH item IN settings.reports_menu.$category %]
|
||||||
<li><a href="[% uri_for(item.path) %]">[% item.label | html_entity %]</a></li>
|
<li><a href="[% uri_for('/report/' _ item) %]">[% settings.reports.$item.label | html_entity %]</a></li>
|
||||||
[% END %]
|
[% END %]
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -1,31 +1,35 @@
|
|||||||
<div class="container">
|
<i class="sidebar_toggle icon-wrench icon-large" id="sidebar_toggle_img_out"
|
||||||
<div class="row nd_show-grid">
|
rel="tooltip" data-placement="left" data-offset="5" data-title="Show Sidebar"></i>
|
||||||
<div class="span10 offset1">
|
<div class="container-fluid">
|
||||||
<form id="nd_dev_age_form" class="form-inline">
|
<div class="sidebar sidebar_pinned">
|
||||||
Find Devices
|
<div class="well">
|
||||||
<select name="age_type" class="span2">
|
<i class="sidebar_toggle icon-signout" id="sidebar_toggle_img_in"
|
||||||
<option value="first">First Discovered</option>
|
rel="tooltip" data-placement="left" data-offset="5" data-title="Hide Sidebar"></i>
|
||||||
<option value="last" selected="selected">Last Updated</option>
|
<i class="sidebar_pin icon-pushpin sidebar_pin_clicked"
|
||||||
</select>
|
rel="tooltip" data-placement="left" data-offset="5" data-title="Unpin Sidebar"></i>
|
||||||
<select name="age_bool" class="span2">
|
|
||||||
<option value="in">less than</option>
|
<div class="tab-content">
|
||||||
<option value="not_in" selected="selected">more than</option>
|
<div id="[% report.tag %]_search" class="tab-pane active">
|
||||||
</select>
|
<form id="[% report.tag %]_form" class="nd_sidesearchform form-stacked"
|
||||||
<select name="age_num" class="span1">
|
method="get" action="[% uri_for('/report') %]">
|
||||||
[% FOREACH count IN [1..32] %]
|
<input name="tab" value="[% report.tag %]" type="hidden"/>
|
||||||
<option[% ' selected="selected"' IF count == 3 %]>[% count %]</option>
|
[% TRY %]
|
||||||
[% END %]
|
[% INCLUDE "sidebar/report/${report.tag}.tt" %]
|
||||||
</select>
|
<script type="text/javascript">has_sidebar["[% report.tag %]"] = 1;</script>
|
||||||
<select name="age_unit" class="span2">
|
[% CATCH %]
|
||||||
<option>days</option>
|
<script type="text/javascript">has_sidebar["[% report.tag %]"] = 0;</script>
|
||||||
<option>weeks</option>
|
[% END %]
|
||||||
<option selected="selected">months</option>
|
</form>
|
||||||
<option>years</option>
|
</div> <!-- /tab-pane -->
|
||||||
</select>
|
</div> <!-- /tab-content -->
|
||||||
ago.
|
|
||||||
<button type="submit" class="btn btn-primary">
|
|
||||||
<i class="icon-search icon-white"></i></button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</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>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user