webui: Added sysNames to pulldowns and the main page (#8137)

* Add dependency info for api

* webui: made dev dependency list more like devices page. Also added sysNames to pulldowns and the manin page

* Create common function for sysname display

* A better function name
This commit is contained in:
Aldemir Akpinar
2018-02-10 16:18:53 +03:00
committed by Neil Lathwood
parent 2018c9f804
commit 5880f06780
5 changed files with 36 additions and 17 deletions

View File

@ -1696,3 +1696,23 @@ function get_zfs_pools($device_id)
return array();
}
/**
* Returns the sysname of a device with a html line break prepended.
* if the device has an empty sysname it will return device's hostname instead
* And finally if the device has no hostname it will return an empty string
* @param device array
* @return string
*/
function get_device_name($device)
{
$ret_str = '';
if (format_hostname($device) !== $device['sysName']) {
$ret_str = $device['sysName'];
} elseif ($device['hostname'] !== $device['ip']) {
$ret_str = $device['hostname'];
}
return $ret_str;
}