webui: Remove ifIndex from ports list and add debug button for data access (#5679)

This commit is contained in:
Neil Lathwood
2017-02-03 21:20:25 +00:00
committed by Tony Murray
parent bea8a14ad3
commit bc72ab916e
2 changed files with 24 additions and 7 deletions

View File

@ -1409,3 +1409,17 @@ function search_oxidized_config($search_in_conf_textbox)
$context = stream_context_create($opts); $context = stream_context_create($opts);
return json_decode(file_get_contents($oxidized_search_url, false, $context), true); 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(',', ',<br />', $data);
} else {
return false;
}
}

View File

@ -1,3 +1,8 @@
<script>
$(function () {
$('[data-toggle="popover"]').popover()
})
</script>
<?php <?php
// This file prints a table row for each interface // This file prints a table row for each interface
@ -35,16 +40,14 @@ if (dbFetchCell('SELECT COUNT(*) FROM `mac_accounting` WHERE `port_id` = ?', arr
echo "<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" style='cursor: pointer;'> echo "<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" style='cursor: pointer;'>
<td valign=top width=350>"; <td valign=top width=350>";
// Don't echo out ports ifIndex if it's a NOS device since their ifIndex is, for lack of better words....different if (is_admin() || is_read()) {
if ($device['os'] == 'nos') { $port_data = array_to_htmljson($port);
echo '<i class="fa fa-tag" data-toggle="popover" data-content="'.$port_data.'" data-html="true"></i>';
}
echo ' <span class=list-large> echo ' <span class=list-large>
'.generate_port_link($port, $port['label'])." $error_img $mac '.generate_port_link($port, $port['label'])." $error_img $mac
</span><br /><span class=interface-desc>".display($port['ifAlias']).'</span>'; </span><br /><span class=interface-desc>".display($port['ifAlias']).'</span>';
} else {
echo ' <span class=list-large>
'.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac
</span><br /><span class=interface-desc>".display($port['ifAlias']).'</span>';
}
if ($port['ifAlias']) { if ($port['ifAlias']) {
echo '<br />'; echo '<br />';