mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	webui: Remove ifIndex from ports list and add debug button for data access (#5679)
This commit is contained in:
		
				
					committed by
					
						
						Tony Murray
					
				
			
			
				
	
			
			
			
						parent
						
							bea8a14ad3
						
					
				
				
					commit
					bc72ab916e
				
			@@ -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(',', ',<br />', $data);
 | 
			
		||||
    } else {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,8 @@
 | 
			
		||||
<script>
 | 
			
		||||
$(function () {
 | 
			
		||||
    $('[data-toggle="popover"]').popover()
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
// 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;'>
 | 
			
		||||
    <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 ($device['os'] == 'nos') {
 | 
			
		||||
if (is_admin() || is_read()) {
 | 
			
		||||
    $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>
 | 
			
		||||
        '.generate_port_link($port, $port['label'])." $error_img $mac
 | 
			
		||||
        </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']) {
 | 
			
		||||
    echo '<br />';
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user