commitb054119d9cAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 17 14:29:58 2013 +0000 hide Reports menu if there are no reports commitd86e670600Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 17 14:23:59 2013 +0000 add Report docs for developers commitee8351eb30Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 17 14:06:39 2013 +0000 split Plugin docs into user and developer pages commit5e4b8f3063Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 17 12:59:47 2013 +0000 add duplex report into default config commit8fd622f50cAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 17 12:56:51 2013 +0000 update query for duplex mismatch to check left and right are both not DOWN commit6d9170598cAuthor: Oliver Gorwits <oliver@cpan.org> Date: Mon Mar 11 23:10:38 2013 +0000 use the new duplex mismatch query in a template commit786977354bAuthor: Oliver Gorwits <oliver@cpan.org> Date: Mon Mar 11 22:54:21 2013 +0000 add VIEW for duplex mismatches commitf37ae8568eAuthor: Oliver Gorwits <oliver@cpan.org> Date: Mon Mar 11 22:54:01 2013 +0000 remove unecessary assign commit13af853582Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 10 23:40:53 2013 +0000 fixes to main app to support reports commit55a0f3d8dcAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 10 22:18:48 2013 +0000 also update fontawesome to match bootstrap version commit83a2c74242Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 10 22:07:23 2013 +0000 update bootstrap again, to include glyphicons with correct path commit25be8bfa92Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 10 19:27:37 2013 +0000 implement first report - duplex mismatch - as a placeholder only commit00265a9323Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 10 18:41:40 2013 +0000 report error on failure to load a plugin commitaf8f124bb2Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 10 18:37:19 2013 +0000 change id for tag in device and search tab plugins commitb818d4156fAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 10 18:29:57 2013 +0000 change id for tag in navbar plugins commitf513000f08Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 10 17:21:23 2013 +0000 implement register_report() and replace More menu with Reports menu commit4a16e3fde3Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 10 17:00:44 2013 +0000 Upgraded to Twitter Bootstrap 2.3.1 - customized for 13px font 18px line
66 lines
1.5 KiB
Perl
66 lines
1.5 KiB
Perl
package App::Netdisco::Web;
|
|
|
|
use Dancer ':syntax';
|
|
use Dancer::Plugin::Ajax;
|
|
|
|
use Dancer::Plugin::DBIC;
|
|
|
|
use Socket6 (); # to ensure dependency is met
|
|
use HTML::Entities (); # to ensure dependency is met
|
|
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;
|
|
|
|
sub _load_web_plugins {
|
|
my $plugin_list = shift;
|
|
|
|
foreach my $plugin (@$plugin_list) {
|
|
$plugin = 'App::Netdisco::Web::Plugin::'. $plugin
|
|
unless $plugin =~ m/^\+/;
|
|
$plugin =~ s/^\+//;
|
|
|
|
debug "loading Netdisco plugin $plugin";
|
|
eval "require $plugin";
|
|
error $@ if $@;
|
|
}
|
|
}
|
|
|
|
if (setting('web_plugins') and ref [] eq ref setting('web_plugins')) {
|
|
_load_web_plugins( setting('web_plugins') );
|
|
}
|
|
|
|
if (setting('extra_web_plugins') and ref [] eq ref setting('extra_web_plugins')) {
|
|
_load_web_plugins( setting('extra_web_plugins') );
|
|
}
|
|
|
|
hook 'before_template' => sub {
|
|
my $tokens = shift;
|
|
|
|
# allow portable static content
|
|
$tokens->{uri_base} = request->base->path
|
|
if request->base->path ne '/';
|
|
|
|
# allow portable dynamic content
|
|
$tokens->{uri_for} = sub { uri_for(@_)->path_query() };
|
|
|
|
# allow very long lists of ports
|
|
$Template::Directive::WHILE_MAX = 10_000;
|
|
};
|
|
|
|
get '/' => sub {
|
|
template 'index';
|
|
};
|
|
|
|
any qr{.*} => sub {
|
|
var('notfound' => true);
|
|
status 'not_found';
|
|
template 'index';
|
|
};
|
|
|
|
true;
|