Move system information to the Netdisco "home" page
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
* Add a spinner to all waiting messages
|
* Add a spinner to all waiting messages
|
||||||
* Try to make the Job Queue page a little faster
|
* Try to make the Job Queue page a little faster
|
||||||
* Require the Net::LDAP module for all installs
|
* Require the Net::LDAP module for all installs
|
||||||
|
* Move system information to the Netdisco "home" page
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use App::Netdisco::Web::Report;
|
|||||||
use App::Netdisco::Web::AdminTask;
|
use App::Netdisco::Web::AdminTask;
|
||||||
use App::Netdisco::Web::TypeAhead;
|
use App::Netdisco::Web::TypeAhead;
|
||||||
use App::Netdisco::Web::PortControl;
|
use App::Netdisco::Web::PortControl;
|
||||||
use App::Netdisco::Web::About;
|
use App::Netdisco::Web::Statistics;
|
||||||
|
|
||||||
sub _load_web_plugins {
|
sub _load_web_plugins {
|
||||||
my $plugin_list = shift;
|
my $plugin_list = shift;
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
package App::Netdisco::Web::About;
|
package App::Netdisco::Web::Statistics;
|
||||||
|
|
||||||
use Dancer ':syntax';
|
use Dancer ':syntax';
|
||||||
use Dancer::Plugin::DBIC;
|
use Dancer::Plugin::DBIC;
|
||||||
use Dancer::Plugin::Auth::Extensible;
|
use Dancer::Plugin::Auth::Extensible;
|
||||||
|
|
||||||
get '/about' => require_login sub {
|
get '/ajax/content/statistics' => require_login sub {
|
||||||
|
|
||||||
my $time1 = time;
|
my $time1 = time;
|
||||||
my $schema = schema('netdisco');
|
my $schema = schema('netdisco');
|
||||||
my $devices = $schema->resultset('Device')->search(
|
my $devices = $schema->resultset('Device');
|
||||||
|
|
||||||
|
# used only to get the PostgreSQL version
|
||||||
|
my $users = $schema->resultset('User')->search(
|
||||||
{},
|
{},
|
||||||
{ select => [ { version => '' } ],
|
{ select => [ { version => '' } ],
|
||||||
as => [qw/ version /],
|
as => [qw/ version /],
|
||||||
@@ -50,16 +53,15 @@ get '/about' => require_login sub {
|
|||||||
my $process_time = $time2 - $time1;
|
my $process_time = $time2 - $time1;
|
||||||
|
|
||||||
my $disco_ver = $App::Netdisco::VERSION;
|
my $disco_ver = $App::Netdisco::VERSION;
|
||||||
my $db_version = $devices->next->get_column('version');
|
my $db_version = $users->next->get_column('version');
|
||||||
my $dbi_ver = $DBI::VERSION;
|
my $dbi_ver = $DBI::VERSION;
|
||||||
my $dbdpg_ver = $DBD::Pg::VERSION;
|
my $dbdpg_ver = $DBD::Pg::VERSION;
|
||||||
|
|
||||||
eval 'require SNMP::Info';
|
eval 'require SNMP::Info';
|
||||||
my $snmpinfo_ver = ($@ ? 'n/a' : $SNMP::Info::VERSION);
|
my $snmpinfo_ver = ($@ ? 'n/a' : $SNMP::Info::VERSION);
|
||||||
|
|
||||||
var( nav => 'about' );
|
var( nav => 'statistics' );
|
||||||
|
template 'ajax/statistics.tt',
|
||||||
template 'about',
|
|
||||||
{
|
{
|
||||||
device_count => $device_count,
|
device_count => $device_count,
|
||||||
device_ip_count => $device_ip_count,
|
device_ip_count => $device_ip_count,
|
||||||
@@ -76,7 +78,8 @@ get '/about' => require_login sub {
|
|||||||
dbdpg_ver => $dbdpg_ver,
|
dbdpg_ver => $dbdpg_ver,
|
||||||
snmpinfo_ver => $snmpinfo_ver,
|
snmpinfo_ver => $snmpinfo_ver,
|
||||||
schema_ver => $schema_version,
|
schema_ver => $schema_version,
|
||||||
};
|
},
|
||||||
|
{ layout => undef };
|
||||||
};
|
};
|
||||||
|
|
||||||
true;
|
true;
|
||||||
@@ -110,6 +110,11 @@ div.content > div.tab-content table.nd_floatinghead thead {
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* for System Information bar */
|
||||||
|
.nd_sysinfo-heading {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
}
|
||||||
|
|
||||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||||
/* styles to adjust the hero box used for homepage + login */
|
/* styles to adjust the hero box used for homepage + login */
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function do_search (event, tab) {
|
|||||||
function(response, status, xhr) {
|
function(response, status, xhr) {
|
||||||
if (status !== "success") {
|
if (status !== "success") {
|
||||||
$(target).html(
|
$(target).html(
|
||||||
'<div class="span5 alert alert-error">' +
|
'<div class="span5 alert alert-error"><i class="icon-warning-sign"></i> ' +
|
||||||
'Search failed! Please contact your site administrator.</div>'
|
'Search failed! Please contact your site administrator.</div>'
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
[% USE Number.Format %]
|
[% USE Number.Format %]
|
||||||
<div class="container">
|
|
||||||
<div class="row nd_hero-row">
|
|
||||||
<div class="hero-unit">
|
|
||||||
<h2>About Netdisco</h2>
|
|
||||||
<small>Netdisco is a web-based network management tool designed for
|
|
||||||
network administrators. Data is collected into a PostgreSQL database
|
|
||||||
using SNMP.</small>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span5 offset1">
|
<div class="span5 offset1">
|
||||||
<h4>Built using Open Source</h4>
|
<h4>Built using Open Source</h4>
|
||||||
@@ -43,7 +35,7 @@
|
|||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th><a href="http://http://snmp-info.sourceforge.net/">SNMP::Info</a></th>
|
<th><a href="http://snmp-info.sourceforge.net/">SNMP::Info</a></th>
|
||||||
<th>[% snmpinfo_ver | html_entity %]</th>
|
<th>[% snmpinfo_ver | html_entity %]</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -53,7 +45,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="span5">
|
<div class="span4 offset1">
|
||||||
<h4>Statistics for this installation</h4>
|
<h4>Statistics for this installation</h4>
|
||||||
<table class="table table-condensed">
|
<table class="table table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -67,19 +59,19 @@
|
|||||||
using [% device_count + device_ip_count | format_number %] IPs</th>
|
using [% device_count + device_ip_count | format_number %] IPs</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>[% device_links | format_number %] layer 2 links between devices.</th>
|
<th>[% device_links | format_number %] layer 2 links between devices</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>[% node_count | format_number %] nodes in [% node_table_count | format_number %] entries. </th>
|
<th>[% node_count | format_number %] nodes in [% node_table_count | format_number %] entries</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>[% ip_count | format_number %] IPs in [% ip_table_count | format_number %] entries.</th>
|
<th>[% ip_count | format_number %] IPs in [% ip_table_count | format_number %] entries</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Statistics took [% process_time %] seconds to process.</th>
|
<th>Statistics took [% process_time %] seconds to process.</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr><th></th></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- /container -->
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
[% END %]
|
[% END %]
|
||||||
<div class="hero-unit">
|
<div class="hero-unit">
|
||||||
<h2>Welcome to Netdisco</h2>
|
<h2>Welcome to Netdisco</h2>
|
||||||
<small>Netdisco is an Open Source web-based network management tool.</small>
|
<small>Netdisco is an Open Source management tool designed for network administrators.</small>
|
||||||
[% IF NOT session.logged_in_user %]
|
[% IF NOT session.logged_in_user %]
|
||||||
<form class="nd_login-form" method="post" action="[% uri_for('/login') %]">
|
<form class="nd_login-form" method="post" action="[% uri_for('/login') %]">
|
||||||
<div class="form-horizontal">
|
<div class="form-horizontal">
|
||||||
@@ -56,9 +56,52 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
[% END %]
|
[% END %]
|
||||||
<script type="text/javascript"> $('#nq').focus(); // set focus to navbar search </script>
|
|
||||||
[% END %]
|
[% END %]
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
[% IF session.logged_in_user %]
|
||||||
|
<div class="accordion" id="accordion-statistics">
|
||||||
|
<div class="accordion-group">
|
||||||
|
<div class="accordion-heading nd_sysinfo-heading">
|
||||||
|
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse-stats" href="#">
|
||||||
|
<i class="icon-chevron-up nd_chevron"></i> System Information
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="collapse-stats" class="accordion-body collapse">
|
||||||
|
<div class="accordion-inner">
|
||||||
|
<div id="nd_stats">
|
||||||
|
<div id="nd_stats_status" class="span2 offset4 alert">
|
||||||
|
<i class="icon-spinner icon-spin"></i> Compiling statistics...</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
[% END %]
|
||||||
</div> <!-- /container -->
|
</div> <!-- /container -->
|
||||||
|
|
||||||
|
[% IF session.logged_in_user %]
|
||||||
|
<script type="text/javascript">
|
||||||
|
var stats_loaded = 0;
|
||||||
|
$('#nq').focus(); // set focus to navbar search
|
||||||
|
|
||||||
|
$('.collapse').on('show', function() {
|
||||||
|
$('.nd_chevron').toggleClass('icon-chevron-up icon-chevron-down');
|
||||||
|
|
||||||
|
if (! stats_loaded) {
|
||||||
|
$('#nd_stats').load("[% uri_for('/ajax/content/statistics') %]", function(r,s,x) {
|
||||||
|
if (s == "error") {
|
||||||
|
$('#nd_stats_status').addClass('alert-error')
|
||||||
|
.html('<i class="icon-warning-sign"></i> Failed to retrieve system information.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
stats_loaded = 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.collapse').on('hide', function() {
|
||||||
|
$('.nd_chevron').toggleClass('icon-chevron-up icon-chevron-down');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
[% END %]
|
||||||
|
|||||||
@@ -59,7 +59,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
<div class="span4 alert alert-info">No devices found. Do you need to run a
|
<script type="text/javascript">
|
||||||
<a href="[% uri_for('/') %]">Discover?</a></div>
|
window.location = '[% uri_for("/") %]';
|
||||||
|
</script>
|
||||||
[% END %]
|
[% END %]
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user