mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Update os icon the handling. Add title to the os image (#5424)
This commit is contained in:
committed by
Neil Lathwood
parent
d7e695e065
commit
20dbda0829
@ -214,7 +214,8 @@ function interface_errors($rrd_file, $period = '-1d')
|
||||
|
||||
function getImage($device)
|
||||
{
|
||||
return '<img src="' . getImageSrc($device) . '" />';
|
||||
$title = $device['icon'] ? str_replace(array('.svg', '.png'), '', $device['icon']) : $device['os'];
|
||||
return '<img src="' . getImageSrc($device) . '" title="' . $title . '"/>';
|
||||
}
|
||||
|
||||
function getImageSrc($device)
|
||||
@ -229,7 +230,7 @@ function getImageName($device, $use_database = true)
|
||||
$device['os'] = strtolower($device['os']);
|
||||
|
||||
// fetch from the database
|
||||
if ($use_database && $device['icon'] != 'generic.png' && is_file($config['html_dir'] . '/images/os/' . $device['icon'])) {
|
||||
if ($use_database && is_file($config['html_dir'] . '/images/os/' . $device['icon'])) {
|
||||
return $device['icon'];
|
||||
}
|
||||
|
||||
@ -238,9 +239,6 @@ function getImageName($device, $use_database = true)
|
||||
if ($device['os'] == "linux") {
|
||||
$features = strtolower(trim($device['features']));
|
||||
list($distro) = explode(" ", $features);
|
||||
if (file_exists($config['html_dir'] . "/images/os/$distro" . ".png")) {
|
||||
return $distro;
|
||||
}
|
||||
}
|
||||
|
||||
$possibilities = array(
|
||||
@ -250,8 +248,8 @@ function getImageName($device, $use_database = true)
|
||||
);
|
||||
|
||||
foreach ($possibilities as $basename) {
|
||||
foreach (array("svg", "png") as $ext) {
|
||||
$name = $basename . '.' . $ext;
|
||||
foreach (array('.svg', '.png') as $ext) {
|
||||
$name = $basename . $ext;
|
||||
if (is_file($config['html_dir'] . '/images/os/' . $name)) {
|
||||
return $name;
|
||||
}
|
||||
|
Reference in New Issue
Block a user