mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
1st try to make bootgrid table
This commit is contained in:
@@ -1,31 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
echo "<div style='margin: 0px;'><table class='table'>";
|
echo "<div class='table-responsive'>";
|
||||||
|
echo "<table id='port-stp' class='table table-condensed table-hover table-striped'>";
|
||||||
|
echo '<thead>';
|
||||||
echo '<tr>
|
echo '<tr>
|
||||||
<th><a href="'.generate_url($vars, array('sort' => "port")).'">Port</a></th>
|
<th data-column-id="port">Port</th>
|
||||||
<th>Priority</th>
|
<th data-column-id="priority">Priority</th>
|
||||||
<th>State</th>
|
<th data-column-id="state">State</th>
|
||||||
<th>Enable</th>
|
<th data-column-id="enable">Enable</th>
|
||||||
<th>Path cost</th>
|
<th data-column-id="pathCost">Path cost</th>
|
||||||
<th>Designated root</th>
|
<th data-column-id="designatedRoot">Designated root</th>
|
||||||
<th>Designated cost</th>
|
<th data-column-id="designatedCost">Designated cost</th>
|
||||||
<th>Designated bridge</th>
|
<th data-column-id="designatedBridge">Designated bridge</th>
|
||||||
<th>Designated port</th>
|
<th data-column-id="designatedPort">Designated port</th>
|
||||||
<th><a href="'.generate_url($vars, array('sort' => "transitions")).'">Fwd trasitions</a></th>
|
<th data-column-id="forwardTransitions">Fwd trasitions</th>
|
||||||
</tr>';
|
</tr>';
|
||||||
|
echo '</thead>';
|
||||||
|
echo '<tbody>';
|
||||||
|
|
||||||
switch ($vars["sort"]) {
|
foreach (dbFetchRows("SELECT `ps`.*, `p`.* FROM `ports_stp` `ps` JOIN `ports` `p` ON `ps`.`port_id`=`p`.`port_id` WHERE `ps`.`device_id` = ?", array($device['device_id'])) as $stp_ports_db) {
|
||||||
case 'transitions':
|
|
||||||
$sort = "ps.forwardTransitions DESC";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$sort = "ps.port_id ASC";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$i='1';
|
|
||||||
|
|
||||||
// FIXME Table sorting don't working, why?
|
|
||||||
//echo "$sort";
|
|
||||||
foreach (dbFetchRows("SELECT `ps`.*, `p`.* FROM `ports_stp` `ps` JOIN `ports` `p` ON `ps`.`port_id`=`p`.`port_id` WHERE `ps`.`device_id` = ? ORDER BY ?", array($device['device_id'], $sort)) as $stp_ports_db) {
|
|
||||||
|
|
||||||
$bridge_device = dbFetchRow("SELECT `devices`.*, `stp`.`device_id`, `stp`.`bridgeAddress` FROM `devices` JOIN `stp` ON `devices`.`device_id`=`stp`.`device_id` WHERE `stp`.`bridgeAddress` = ?", array($stp_ports_db['designatedBridge']));
|
$bridge_device = dbFetchRow("SELECT `devices`.*, `stp`.`device_id`, `stp`.`bridgeAddress` FROM `devices` JOIN `stp` ON `devices`.`device_id`=`stp`.`device_id` WHERE `stp`.`bridgeAddress` = ?", array($stp_ports_db['designatedBridge']));
|
||||||
$root_device = dbFetchRow("SELECT `devices`.*, `stp`.`device_id`, `stp`.`bridgeAddress` FROM `devices` JOIN `stp` ON `devices`.`device_id`=`stp`.`device_id` WHERE `stp`.`bridgeAddress` = ?", array($stp_ports_db['designatedRoot']));
|
$root_device = dbFetchRow("SELECT `devices`.*, `stp`.`device_id`, `stp`.`bridgeAddress` FROM `devices` JOIN `stp` ON `devices`.`device_id`=`stp`.`device_id` WHERE `stp`.`bridgeAddress` = ?", array($stp_ports_db['designatedRoot']));
|
||||||
@@ -36,25 +28,37 @@ foreach (dbFetchRows("SELECT `ps`.*, `p`.* FROM `ports_stp` `ps` JOIN `ports` `p
|
|||||||
$stp_ports_db['state'],
|
$stp_ports_db['state'],
|
||||||
$stp_ports_db['enable'],
|
$stp_ports_db['enable'],
|
||||||
$stp_ports_db['pathCost'],
|
$stp_ports_db['pathCost'],
|
||||||
//$stp_ports_db['designatedRoot'],
|
|
||||||
generate_device_link($root_device, $root_device['hostname'])."<br>".$stp_ports_db['designatedRoot'],
|
generate_device_link($root_device, $root_device['hostname'])."<br>".$stp_ports_db['designatedRoot'],
|
||||||
$stp_ports_db['designatedCost'],
|
$stp_ports_db['designatedCost'],
|
||||||
generate_device_link($bridge_device, $bridge_device['hostname'])."<br>".$stp_ports_db['designatedBridge'],
|
generate_device_link($bridge_device, $bridge_device['hostname'])."<br>".$stp_ports_db['designatedBridge'],
|
||||||
$stp_ports_db['designatedPort'],
|
$stp_ports_db['designatedPort'],
|
||||||
$stp_ports_db['forwardTransitions']
|
$stp_ports_db['forwardTransitions']
|
||||||
];
|
];
|
||||||
$i++;
|
|
||||||
if (!is_integer($i / 2)) {
|
echo "<tr>";
|
||||||
$row_colour = $list_colour_b;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$row_colour = $list_colour_a;
|
|
||||||
}
|
|
||||||
echo "<tr style='background-color: $row_colour;'>";
|
|
||||||
|
|
||||||
foreach ($stp_ports as $value) {
|
foreach ($stp_ports as $value) {
|
||||||
echo "<td>$value</td>";
|
echo "<td>$value</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
|
echo '</tbody>';
|
||||||
|
echo '</table>';
|
||||||
|
echo '</div>';
|
||||||
|
// FIXME make table with links and searcheable
|
||||||
|
//
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//$("#port-stp").bootgrid();
|
||||||
|
/*
|
||||||
|
$("#port-stp").bootgrid( {
|
||||||
|
ajax: true,
|
||||||
|
post: function () {
|
||||||
|
return {
|
||||||
|
id: "port-stp"
|
||||||
|
};
|
||||||
|
},
|
||||||
|
url: "ajax_table.php"
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
</script>
|
||||||
|
Reference in New Issue
Block a user