Cleanup Port hover minigraph description when using "Interface Description Parsing" (#13143)

* Cleanup Port hover minigraph description.
Use port_descr_descr if exists or ifDescr.
Use the same generate_port_link() in:
- Devices - Ports
- Ports - All/Errored/Ignored
- Ports - "Types"

* Port-Customers, using Ajax Controller,  Util/Url

* make https://styleci.io/ check happy
This commit is contained in:
fbourqui
2021-08-18 13:02:01 +02:00
committed by GitHub
parent e9c89b3778
commit f1dc4435e3
4 changed files with 9 additions and 16 deletions

View File

@@ -101,19 +101,9 @@ if ($vars['view'] == 'minigraphs') {
echo "<div style='display: block; clear: both; margin: auto; min-height: 500px;'>";
unset($seperator);
// FIXME - FIX THIS. UGLY.
foreach (dbFetchRows('select * from ports WHERE device_id = ? AND `disabled` = 0 ORDER BY ifIndex', [$device['device_id']]) as $port) {
$port = cleanPort($port, $device);
echo "<div class='minigraph-div'><div style='font-weight: bold;'>" . makeshortif($port['ifDescr']) . '</div>
<a href="' . generate_port_url($port) . "\" onmouseover=\"return overlib('<div class=\'overlib-content\'>\
<div class=\'overlib-text\'>" . $device['hostname'] . ' - ' . $port['ifDescr'] . "</div>\
<span class=\'overlib-title\'>" . $port['ifAlias'] . "</span>\
<img src=\'graph.php?type=" . $graph_type . '&amp;id=' . $port['port_id'] . '&amp;from=' . $from . '&amp;to=' . \LibreNMS\Config::get('time.now') . "&amp;width=450&amp;height=150\'>\
</div>\
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<img src='graph.php?type=" . $graph_type . '&amp;id=' . $port['port_id'] . '&amp;from=' . $from . '&amp;to=' . \LibreNMS\Config::get('time.now') . "&amp;width=180&amp;height=45&amp;legend=no'>
</a>
<div style='font-size: 9px;'>" . substr(short_port_descr($port['ifAlias']), 0, 32) . '</div>
</div>';
echo "<div class='minigraph-div'><div style='font-weight: bold;'>" . generate_port_link($port) . '</div>';
}
echo '</div>';