diff --git a/html/includes/common/stp-ports.inc.php b/html/includes/common/stp-ports.inc.php new file mode 100644 index 0000000000..34b8639527 --- /dev/null +++ b/html/includes/common/stp-ports.inc.php @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + +
PortPriorityStateEnablePath costDesignated rootDesignated costDesignated bridgeDesignated portFwd trasitions
+ + + +'; diff --git a/html/includes/print-stp-ports.inc.php b/html/includes/print-stp-ports.inc.php deleted file mode 100644 index 83916b307b..0000000000 --- a/html/includes/print-stp-ports.inc.php +++ /dev/null @@ -1,64 +0,0 @@ -"; -echo "
"; -echo ''; -echo ' - - - - - - - - - - - '; -echo ''; -echo ''; - -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) { - - $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'])); - - $stp_ports = [ - generate_port_link($stp_ports_db, $stp_ports_db['ifName'])."
".$stp_ports_db['ifAlias'], - $stp_ports_db['priority'], - $stp_ports_db['state'], - $stp_ports_db['enable'], - $stp_ports_db['pathCost'], - generate_device_link($root_device, $root_device['hostname'])."
".$stp_ports_db['designatedRoot'], - $stp_ports_db['designatedCost'], - generate_device_link($bridge_device, $bridge_device['hostname'])."
".$stp_ports_db['designatedBridge'], - $stp_ports_db['designatedPort'], - $stp_ports_db['forwardTransitions'] - ]; - - echo ""; - foreach ($stp_ports as $value) { - echo ""; - } - echo ''; -} -echo ''; -echo '
PortPriorityStateEnablePath costDesignated rootDesignated costDesignated bridgeDesignated portFwd trasitions
$value
'; -echo ''; -// FIXME make table with links and searcheable -// -?> - - diff --git a/html/includes/table/stp-ports.inc.php b/html/includes/table/stp-ports.inc.php new file mode 100644 index 0000000000..f3e31b5fbf --- /dev/null +++ b/html/includes/table/stp-ports.inc.php @@ -0,0 +1,55 @@ + generate_port_link($stp_ports_db, $stp_ports_db['ifName'])."
".$stp_ports_db['ifAlias'], + 'priority' => $stp_ports_db['priority'], + 'state' => $stp_ports_db['state'], + 'enable' => $stp_ports_db['enable'], + 'pathCost' => $stp_ports_db['pathCost'], + 'designatedRoot' => generate_device_link($root_device, $root_device['hostname'])."
".$stp_ports_db['designatedRoot'], + 'designatedCost' => $stp_ports_db['designatedCost'], + 'designatedBridge' => generate_device_link($bridge_device, $bridge_device['hostname'])."
".$stp_ports_db['designatedBridge'], + 'designatedPort' => $stp_ports_db['designatedPort'], + 'forwardTransitions' => $stp_ports_db['forwardTransitions'] + ); +} + +$output = array( + 'current' => $current, + 'rowCount' => $rowCount, + 'rows' => $response, + 'total' => $total, +); +echo _json_encode($output); diff --git a/html/pages/device/stp.inc.php b/html/pages/device/stp.inc.php index 52dda80286..ad8733aa17 100644 --- a/html/pages/device/stp.inc.php +++ b/html/pages/device/stp.inc.php @@ -46,7 +46,8 @@ if ($vars['view'] == 'basic') { } if ($vars['view'] == 'ports') { - include 'includes/print-stp-ports.inc.php'; + include 'includes/common/stp-ports.inc.php'; + echo implode('',$common_output); } echo '';