From bc72ab916ec5bea01c239636765eb0c5393816c3 Mon Sep 17 00:00:00 2001 From: Neil Lathwood Date: Fri, 3 Feb 2017 21:20:25 +0000 Subject: [PATCH] webui: Remove ifIndex from ports list and add debug button for data access (#5679) --- html/includes/functions.inc.php | 14 ++++++++++++++ html/includes/print-interface.inc.php | 17 ++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 743dc035fc..0c0d6cc872 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -1409,3 +1409,17 @@ function search_oxidized_config($search_in_conf_textbox) $context = stream_context_create($opts); return json_decode(file_get_contents($oxidized_search_url, false, $context), true); } + +/** + * @param $data + * @return bool|mixed + */ +function array_to_htmljson($data) +{ + if (is_array($data)) { + $data = htmlentities(json_encode($data)); + return str_replace(',', ',
', $data); + } else { + return false; + } +} diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php index 306f7badc5..25b2444bea 100644 --- a/html/includes/print-interface.inc.php +++ b/html/includes/print-interface.inc.php @@ -1,3 +1,8 @@ + "; -// Don't echo out ports ifIndex if it's a NOS device since their ifIndex is, for lack of better words....different -if ($device['os'] == 'nos') { +if (is_admin() || is_read()) { + $port_data = array_to_htmljson($port); + echo ''; +} + echo ' '.generate_port_link($port, $port['label'])." $error_img $mac
".display($port['ifAlias']).''; -} else { - echo ' - '.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac -
".display($port['ifAlias']).''; -} if ($port['ifAlias']) { echo '
';