Move system information to the Netdisco "home" page

This commit is contained in:
Oliver Gorwits
2014-02-22 17:43:22 +00:00
parent 5623422452
commit ae535a63d9
8 changed files with 75 additions and 30 deletions

View File

@@ -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 -->

View File

@@ -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 %]

View File

@@ -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>