implement "no devices" prompt for admin users to do first discover

This commit is contained in:
Oliver Gorwits
2013-05-09 23:30:32 +01:00
parent 2e8ac83173
commit 70f5da8bb6
12 changed files with 231 additions and 6 deletions

View File

@@ -16,6 +16,7 @@ use App::Netdisco::Web::Report;
use App::Netdisco::Web::AdminTask;
use App::Netdisco::Web::TypeAhead;
use App::Netdisco::Web::PortControl;
use App::Netdisco::Web::JobControl;
sub _load_web_plugins {
my $plugin_list = shift;
@@ -54,6 +55,12 @@ hook 'before_template' => sub {
};
get '/' => sub {
if (var('user') and var('user')->admin) {
if (schema('netdisco')->resultset('Device')->count == 0) {
var('nodevices' => true);
}
}
template 'index';
};