Move system information to the Netdisco "home" page
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
* Add a spinner to all waiting messages
|
||||
* Try to make the Job Queue page a little faster
|
||||
* Require the Net::LDAP module for all installs
|
||||
* Move system information to the Netdisco "home" page
|
||||
|
||||
[BUG FIXES]
|
||||
|
||||
|
||||
@@ -20,7 +20,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::About;
|
||||
use App::Netdisco::Web::Statistics;
|
||||
|
||||
sub _load_web_plugins {
|
||||
my $plugin_list = shift;
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package App::Netdisco::Web::About;
|
||||
package App::Netdisco::Web::Statistics;
|
||||
|
||||
use Dancer ':syntax';
|
||||
use Dancer::Plugin::DBIC;
|
||||
use Dancer::Plugin::Auth::Extensible;
|
||||
|
||||
get '/about' => require_login sub {
|
||||
get '/ajax/content/statistics' => require_login sub {
|
||||
|
||||
my $time1 = time;
|
||||
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 => '' } ],
|
||||
as => [qw/ version /],
|
||||
@@ -50,16 +53,15 @@ get '/about' => require_login sub {
|
||||
my $process_time = $time2 - $time1;
|
||||
|
||||
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 $dbdpg_ver = $DBD::Pg::VERSION;
|
||||
|
||||
eval 'require SNMP::Info';
|
||||
my $snmpinfo_ver = ($@ ? 'n/a' : $SNMP::Info::VERSION);
|
||||
|
||||
var( nav => 'about' );
|
||||
|
||||
template 'about',
|
||||
var( nav => 'statistics' );
|
||||
template 'ajax/statistics.tt',
|
||||
{
|
||||
device_count => $device_count,
|
||||
device_ip_count => $device_ip_count,
|
||||
@@ -76,7 +78,8 @@ get '/about' => require_login sub {
|
||||
dbdpg_ver => $dbdpg_ver,
|
||||
snmpinfo_ver => $snmpinfo_ver,
|
||||
schema_ver => $schema_version,
|
||||
};
|
||||
},
|
||||
{ layout => undef };
|
||||
};
|
||||
|
||||
true;
|
||||
@@ -110,6 +110,11 @@ div.content > div.tab-content table.nd_floatinghead thead {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* for System Information bar */
|
||||
.nd_sysinfo-heading {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
/* styles to adjust the hero box used for homepage + login */
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ function do_search (event, tab) {
|
||||
function(response, status, xhr) {
|
||||
if (status !== "success") {
|
||||
$(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>'
|
||||
);
|
||||
return;
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
[% 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="span5 offset1">
|
||||
<h4>Built using Open Source</h4>
|
||||
@@ -43,7 +35,7 @@
|
||||
</th>
|
||||
</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>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -53,7 +45,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="span5">
|
||||
<div class="span4 offset1">
|
||||
<h4>Statistics for this installation</h4>
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
@@ -67,19 +59,19 @@
|
||||
using [% device_count + device_ip_count | format_number %] IPs</th>
|
||||
</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>
|
||||
<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>
|
||||
<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>
|
||||
<th>Statistics took [% process_time %] seconds to process.</th>
|
||||
</tr>
|
||||
<tr><th></th></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- /container -->
|
||||
@@ -34,7 +34,7 @@
|
||||
[% END %]
|
||||
<div class="hero-unit">
|
||||
<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 %]
|
||||
<form class="nd_login-form" method="post" action="[% uri_for('/login') %]">
|
||||
<div class="form-horizontal">
|
||||
@@ -47,7 +47,7 @@
|
||||
[% END %]
|
||||
</form>
|
||||
[% ELSE %]
|
||||
[% IF user_has_role('admin') %]
|
||||
[% IF user_has_role('admin') %]
|
||||
<form class="nd_login-form" method="post" action="[% uri_for('/admin/discover') %]">
|
||||
<div class="form-horizontal">
|
||||
<input placeholder="Device hostname or IP" class="span4" name="device" type="text"/>
|
||||
@@ -55,10 +55,53 @@
|
||||
<button type="submit" class="btn btn-info">Discover</button>
|
||||
</div>
|
||||
</form>
|
||||
[% END %]
|
||||
<script type="text/javascript"> $('#nq').focus(); // set focus to navbar search </script>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</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 -->
|
||||
|
||||
[% 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>
|
||||
[% ELSE %]
|
||||
<div class="span4 alert alert-info">No devices found. Do you need to run a
|
||||
<a href="[% uri_for('/') %]">Discover?</a></div>
|
||||
<script type="text/javascript">
|
||||
window.location = '[% uri_for("/") %]';
|
||||
</script>
|
||||
[% END %]
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user