some bugfixing

This commit is contained in:
vitalisator
2016-01-28 13:07:33 +01:00
parent 89f9e609b5
commit 0e66ddf088
5 changed files with 12 additions and 14 deletions

View File

@ -2,7 +2,7 @@
$common_output[] = '
<div class="table-responsive">
<table id="stp-ports" class="table table-condensed table-hover table-striped">
<table id="stp-ports" class="table table-condensed table-hover">
<thead>
<tr>
<th data-column-id="port">Port</th>
@ -14,16 +14,17 @@ $common_output[] = '
<th data-column-id="designatedCost">Designated cost</th>
<th data-column-id="designatedBridge">Designated bridge</th>
<th data-column-id="designatedPort">Designated port</th>
<th data-column-id="forwardTransitions">Fwd trasitions</th>
<th data-column-id="forwardTransitions">Forward transitions</th>
</tr>
</thead>
<table>
</table>
</div>
<script>
var grid = $("#stp-ports").bootgrid( {
ajax: true,
templates: {search: ""},
post: function ()
{
return {

View File

@ -1,5 +1,6 @@
<?php
echo '<table class="table table-condensed table-striped table-hover">';
$stp_raw = dbFetchRow('SELECT * FROM `stp` WHERE `device_id` = ?', array($device['device_id']));
$stp = array (
'Root bridge' => ($stp_raw['rootBridge'] == 1) ? 'Yes' : 'No',
@ -22,8 +23,9 @@ $stp = array (
foreach (array_keys($stp) as $key) {
echo "
<tr>
<td width=280 class=list-large>$key</td>
<td class=box-desc>$stp[$key]</td>
<td>$key</td>
<td>$stp[$key]</td>
</tr>
";
}
echo '</table>';

View File

@ -6,7 +6,7 @@ $param[] = $device_id;
$sql = " FROM `ports_stp` `ps` JOIN `ports` `p` ON `ps`.`port_id`=`p`.`port_id` WHERE `ps`.`device_id` = ?";
$count_sql = "SELECT COUNT(ports_stp_id) $sql";
$count_sql = "SELECT COUNT(*) $sql";
$total = dbFetchCell($count_sql, $param);
if (empty($total)) {
$total = 0;

View File

@ -35,14 +35,8 @@ unset($sep);
print_optionbar_end();
echo '<table border="0" cellspacing="0" cellpadding="5" width="100%">';
if ($vars['view'] == 'basic') {
//$i = '1';
foreach (dbFetchRows("SELECT * FROM `stp` WHERE `device_id` = ? ORDER BY 'stp_id'", array($device['device_id'])) as $stp) {
include 'includes/print-stp.inc.php';
// $i++;
}
}
if ($vars['view'] == 'ports') {
@ -50,6 +44,4 @@ if ($vars['view'] == 'ports') {
echo implode('',$common_output);
}
echo '</table>';
$pagetitle[] = 'STP';

3
sql-schema/095.sql Normal file
View File

@ -0,0 +1,3 @@
CREATE TABLE IF NOT EXISTS `ports_stp` (`port_stp_id` int(11) NOT NULL,`device_id` int(11) NOT NULL,`port_id` int(11) NOT NULL,`priority` tinyint(3) unsigned NOT NULL,`state` varchar(11) NOT NULL,`enable` varchar(8) NOT NULL,`pathCost` int(10) unsigned NOT NULL,`designatedRoot` varchar(32) NOT NULL,`designatedCost` smallint(5) unsigned NOT NULL,`designatedBridge` varchar(32) NOT NULL,`designatedPort` mediumint(9) NOT NULL,`forwardTransitions` int(10) unsigned NOT NULL) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
ALTER TABLE `ports_stp` ADD PRIMARY KEY (`port_stp_id`), ADD UNIQUE KEY `device_id` (`device_id`,`port_id`);
ALTER TABLE `ports_stp` MODIFY `port_stp_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;