Various UI changes

This commit is contained in:
Arjit Chaudhary
2015-09-21 01:30:23 +05:30
parent ee21a773f7
commit e6965765f5
15 changed files with 108 additions and 125 deletions

View File

@@ -9,5 +9,5 @@
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
echo "<br>";
require_once 'includes/print-graph-alerts.inc.php';

View File

@@ -11,6 +11,5 @@
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
require_once 'includes/common/alerts.inc.php';
echo implode('',$common_output);

View File

@@ -107,4 +107,4 @@ require_once 'includes/modal/new_alert_rule.inc.php';
<div class="col-md-1 col-md-offset-3">
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-alert" data-device_id="<?php echo $device['device_id']; ?>"><i class="fa fa-plus"></i> Create new alert rule</button>
</div>
</div>
</div>

View File

@@ -62,7 +62,7 @@ echo "<div class='row'>
<div class='col-md-4'>
<form id='appedit' name='appedit' method='post' action='' role='form' class='form-horizontal'>
<input type=hidden name=device value='".$device['device_id']."'>
<table class='table table-hover table-condensed table-responsive'>
<table class='table table-hover table-responsive'>
<tr align=center>
<th>Enable</th>
<th>Application</th>
@@ -99,4 +99,4 @@ echo '<div class="row">
';
echo '</form>';
echo '</div>';
echo '</div>';
echo '</div>';

View File

@@ -1,13 +1,5 @@
<?php
echo '<table cellspacing="0" cellpadding="5" width="100%">';
// echo("<tr class=tablehead>
// <th width=250>Drive</th>
// <th width=420>Usage</th>
// <th width=50>Free</th>
// <th></th>
// </tr>");
$row = 1;
foreach (dbFetchRows('SELECT * FROM `ucd_diskio` WHERE device_id = ? ORDER BY diskio_descr', array($device['device_id'])) as $drive) {
@@ -27,9 +19,7 @@ foreach (dbFetchRows('SELECT * FROM `ucd_diskio` WHERE device_id = ? ORDER BY di
$graph_array_zoom['from'] = $config['time']['twoday'];
$graph_array_zoom['to'] = $config['time']['now'];
echo "<tr bgcolor='$row_colour'><th>";
echo overlib_link($fs_url, $drive['diskio_descr'], generate_graph_tag($graph_array_zoom), null);
echo '</th></tr>';
$overlib_link = overlib_link($fs_url, $drive['diskio_descr'], generate_graph_tag($graph_array_zoom), null);
$types = array(
'diskio_bits',
@@ -37,18 +27,24 @@ foreach (dbFetchRows('SELECT * FROM `ucd_diskio` WHERE device_id = ? ORDER BY di
);
foreach ($types as $graph_type) {
echo '<tr bgcolor="'.$row_colour.'"><td colspan=5>';
$graph_array = array();
$graph_array['id'] = $drive['diskio_id'];
$graph_array['type'] = $graph_type;
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
if($graph_array['type']=="diskio_ops") {
$graph_type_title="Ops/sec";
}
if($graph_array['type']=="diskio_bits") {
$graph_type_title="bps";
}
echo "<div class='panel panel-default'>
<div class='panel-heading'>
<h3 class='panel-title'>$overlib_link - $graph_type_title</h3>
</div>";
echo "<div class='panel-body'>";
include 'includes/print-graphrow.inc.php';
echo '</div></div>';
}
$row++;
}
echo '</table>';
}

View File

@@ -2,9 +2,6 @@
$graph_type = 'mempool_usage';
echo "<div style='margin-top: 5px; padding: 0px;'>";
echo '<table width=100% cellpadding=6 cellspacing=0>';
$i = '1';
// FIXME css alternating colours
@@ -46,25 +43,16 @@ foreach (dbFetchRows('SELECT * FROM `mempools` WHERE device_id = ?', array($devi
$right_background = $background['right'];
$left_background = $background['left'];
echo "<tr bgcolor=$row_colour><td class=tablehead><a href='".$mempool_url."' $mempool_popup>".$text_descr."</a></td>
<td width=90><a href='".$mempool_url."' $mempool_popup><img src='$mini_url'></a></td>
<td width=200><a href='".$mempool_url."' $mempool_popup>
".print_percentage_bar(400, 20, $perc, "$used / $total", 'ffffff', $left_background, $free, 'ffffff', $right_background).'
</a></td>
<td width=50>'.$perc.'%</td>
</tr>';
echo "<tr bgcolor='$row_colour'><td colspan=5>";
$graph_array['id'] = $mempool['mempool_id'];
$graph_array['type'] = $graph_type;
echo "<div class='panel panel-default'>
<div class='panel-heading'>
<h3 class='panel-title'>$text_descr <div class='pull-right'>$used/$total - $perc% used</div></h3>
</div>";
echo "<div class='panel-body'>";
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
echo "</div></div>";
$i++;
}//end foreach
echo '</table>';
echo '</div>';
}//end foreach

View File

@@ -2,9 +2,6 @@
$graph_type = 'processor_usage';
echo "<div style='margin-top: 5px; padding: 0px;'>";
echo '<table width=100% cellpadding=6 cellspacing=0>';
$i = '1';
foreach (dbFetchRows('SELECT * FROM `processors` WHERE device_id = ?', array($device['device_id'])) as $proc) {
$proc_url = 'graphs/id='.$proc['processor_id'].'/type=processor_usage/';
@@ -18,26 +15,16 @@ foreach (dbFetchRows('SELECT * FROM `processors` WHERE device_id = ?', array($de
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname'].' - '.$text_descr;
$proc_popup .= "</div><img src=\'graph.php?id=".$proc['processor_id'].'&amp;type='.$graph_type.'&amp;from='.$config['time']['month'].'&amp;to='.$config['time']['now']."&amp;width=400&amp;height=125\'>";
$proc_popup .= "', RIGHT".$config['overlib_defaults'].');" onmouseout="return nd();"';
$percent = round($proc['processor_usage']);
$background = get_percentage_colours($percent);
echo ("<tr bgcolor=$row_colour>
<td class=tablehead><a href='".$proc_url."' $proc_popup>".$text_descr."</a></td>
<td width=90><a href='".$proc_url."' $proc_popup><img src='$mini_url'></a></td>
<td width=200><a href='".$proc_url."' $proc_popup>
".print_percentage_bar(400, 20, $percent, $percent.'%', 'ffffff', $background['left'], (100 - $percent).'%', 'ffffff', $background['right']).'
</a></td>
</tr>');
echo "<tr bgcolor='$row_colour'><td colspan=5>";
$graph_array['id'] = $proc['processor_id'];
$graph_array['type'] = $graph_type;
echo "<div class='panel panel-default'>
<div class='panel-heading'>
<h3 class='panel-title'>$text_descr <div class='pull-right'>$percent% used</div></h3>
</div>";
echo "<div class='panel-body'>";
include 'includes/print-graphrow.inc.php';
}//end foreach
echo '</table>';
echo '</div>';
echo "</div></div>";
}//end foreach

View File

@@ -1,6 +1,6 @@
<?php
echo '<table cellspacing=0 cellpadding=5 width=100%>';
//echo '<table cellspacing=0 cellpadding=5 width=100%>';
$row = 1;
@@ -11,24 +11,24 @@ foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `devi
else {
$row_colour = $list_colour_b;
}
echo "<tr class=list-large style=\"background-color: $row_colour; padding: 5px;\">
<td width=500>".$sensor['sensor_descr'].'</td>
<td>'.$sensor['sensor_type'].'</td>
<td width=50>'.format_si($sensor['sensor_current']).$unit.'</td>
<td width=50>'.format_si($sensor['sensor_limit']).$unit.'</td>
<td width=50>'.format_si($sensor['sensor_limit_low']).$unit."</td>
</tr>\n";
echo "<tr bgcolor=$row_colour><td colspan='5'>";
$sensor_descr = $sensor['sensor_descr'];
$sensor_current = format_si($sensor['sensor_current']).$unit;
$sensor_limit = format_si($sensor['sensor_limit']).$unit;
$sensor_limit_low = format_si($sensor['sensor_limit_low']).$unit;
echo "<div class='panel panel-default'>
<div class='panel-heading'>
<h3 class='panel-title'>$sensor_descr <div class='pull-right'>$sensor_current | $sensor_limit_low <> $sensor_limit</div></h3>
</div>";
echo "<div class='panel-body'>";
$graph_array['id'] = $sensor['sensor_id'];
$graph_array['type'] = $graph_type;
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
echo '</div></div>';
$row++;
}
echo '</table>';
//echo '</table>';

View File

@@ -2,15 +2,6 @@
$graph_type = 'storage_usage';
echo '<table cellspacing=0 cellpadding=5 width=100%>';
echo '<tr class=tablehead>
<th width=250>Drive</th>
<th width=420>Usage</th>
<th width=50>Free</th>
<th></th>
</tr>';
$row = 1;
foreach (dbFetchRows('SELECT * FROM `storage` WHERE device_id = ? ORDER BY storage_descr', array($device['device_id'])) as $drive) {
@@ -28,6 +19,7 @@ foreach (dbFetchRows('SELECT * FROM `storage` WHERE device_id = ? ORDER BY stora
$used = formatStorage($used);
$total = formatStorage($total);
$free = formatStorage($free);
$storage_descr = $drive['storage_descr'];
$fs_url = 'graphs/id='.$drive['storage_id'].'/type=storage_usage/';
@@ -35,22 +27,17 @@ foreach (dbFetchRows('SELECT * FROM `storage` WHERE device_id = ? ORDER BY stora
$fs_popup .= "</div><img src=\'graph.php?id=".$drive['storage_id'].'&amp;type='.$graph_type.'&amp;from='.$config['time']['month'].'&amp;to='.$config['time']['now']."&amp;width=400&amp;height=125\'>";
$fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"";
$background = get_percentage_colours($percent);
echo "<tr bgcolor='$row_colour'><td><a href='$fs_url' $fs_popup>".$drive['storage_descr']."</a></td><td>
<a href='$fs_url' $fs_popup>".print_percentage_bar(400, 20, $perc, "$used / $total", 'ffffff', $background['left'], $perc.'%', 'ffffff', $background['right']).'</a>
</td><td>'.$free.'</td><td></td></tr>';
$graph_array['id'] = $drive['storage_id'];
$graph_array['type'] = $graph_type;
echo "<tr bgcolor='$row_colour'><td colspan=4>";
echo "<div class='panel panel-default'>
<div class='panel-heading'>
<h3 class='panel-title'>$storage_descr <div class='pull-right'>$used/$total - $perc% used</div></h3>
</div>";
echo "<div class='panel-body'>";
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
echo "</div></div>";
$row++;
}//end foreach
echo '</table>';

View File

@@ -1,6 +1,7 @@
<?php
echo '<table width="100%">';
echo '<h3>Inventory</h3>';
echo '<hr>';
echo '<table class="table table-condensed" width="100%">';
// FIXME missing heading
foreach (dbFetchRows('SELECT * FROM `hrDevice` WHERE `device_id` = ? ORDER BY `hrDeviceIndex`', array($device['device_id'])) as $hrdevice) {

View File

@@ -35,19 +35,19 @@ if (empty($vars['dtpickerto'])) {
?>
<hr />
<div class="center-block">
<form method="post" role="form" id="map" class="form-inline">
<div class="form-group">
<label for="dtpickerfrom">From</label>
<input type="text" class="form-control" id="dtpickerfrom" name="dtpickerfrom" maxlength="16" value="<?php echo $vars['dtpickerfrom']; ?>" data-date-format="YYYY-MM-DD HH:mm">
</div>
<div class="form-group">
<label for="dtpickerto">To</label>
<input type="text" class="form-control" id="dtpickerto" name="dtpickerto" maxlength=16 value="<?php echo $vars['dtpickerto']; ?>" data-date-format="YYYY-MM-DD HH:mm">
</div>
<input type="submit" class="btn btn-default" id="submit" value="Update">
</form>
</div>
<center>
<form method="post" role="form" id="map" class="form-inline">
<div class="form-group">
<label for="dtpickerfrom">From</label>
<input type="text" class="form-control" id="dtpickerfrom" name="dtpickerfrom" maxlength="16" value="<?php echo $vars['dtpickerfrom']; ?>" data-date-format="YYYY-MM-DD HH:mm">
</div>
<div class="form-group">
<label for="dtpickerto">To</label>
<input type="text" class="form-control" id="dtpickerto" name="dtpickerto" maxlength=16 value="<?php echo $vars['dtpickerto']; ?>" data-date-format="YYYY-MM-DD HH:mm">
</div>
<input type="submit" class="btn btn-default" id="submit" value="Update">
</form>
</center>
<hr />
<script type="text/javascript">
$(function () {

View File

@@ -1,7 +1,8 @@
<?php
$entries = dbFetchRows("SELECT *,DATE_FORMAT(datetime, '".$config['dateformat']['mysql']['compact']."') as humandate FROM `eventlog` WHERE `host` = ? AND `type` = 'interface' AND `reference` = '".$port['port_id']."' ORDER BY `datetime` DESC LIMIT 0,250", array($device['device_id']));
echo '<table cellspacing="0" cellpadding="2" width="100%">';
echo '<table class="table table-condensed">';
echo '<th>Timestamp</th><th>Port</th><th>Event</th>';
foreach ($entries as $entry) {
include 'includes/print-event.inc.php';

View File

@@ -2,30 +2,54 @@
if (file_exists($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'.rrd')) {
$iid = $id;
echo '<div class=graphhead>Interface Traffic</div>';
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Interface Traffic</h3>
</div>';
$graph_type = 'port_bits';
include 'includes/print-interface-graphs.inc.php';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
echo '<div class=graphhead>Interface Packets</div>';
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Interface Packets</h3>
</div>';
$graph_type = 'port_upkts';
include 'includes/print-interface-graphs.inc.php';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
echo '<div class=graphhead>Interface Non Unicast</div>';
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Interface Non Unicast</h3>
</div>';
$graph_type = 'port_nupkts';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
include 'includes/print-interface-graphs.inc.php';
echo '<div class=graphhead>Interface Errors</div>';
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Interface Errors</h3>
</div>';
$graph_type = 'port_errors';
include 'includes/print-interface-graphs.inc.php';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/port-'.$port['ifIndex'].'-dot3.rrd')) {
echo '<div class=graphhead>Ethernet Errors</div>';
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Ethernet Errors</h3>
</div>';
$graph_type = 'port_etherlike';
include 'includes/print-interface-graphs.inc.php';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
}
}

View File

@@ -122,7 +122,7 @@ else {
$port_details = 1;
}
echo "<div style='margin: 0px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>";
echo "<div style='margin: 0px;'><table class='table'>";
$i = '1';
global $port_cache, $port_index_cache;

View File

@@ -1,6 +1,6 @@
<?php
echo '<table border="0" cellspacing="0" cellpadding="5" width="100%">';
echo '<table class="table table-condensed">';
echo '<tr><th>Port</th><th>MAC address</th><th>IPv4 address</th><th>Remote device</th><th>Remote port</th></tr>';
$i = '1';