mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Configurable device display name (#13528)
* Configurable device display name You can just set the display name in device settings. It also accepts simple template format with the variables: hostname, sysName, sysName_fallback, ip Default controlled by device_display_default, (set from old force_hostname_to_sysname and force_ip_to_sysname settings * remove second argument to format_hostname() * Style fixes * Update schema * update phpstan baseline * Improved settings strings (and add for translation)
This commit is contained in:
@@ -42,10 +42,12 @@ if (! empty($device['overwrite_ip'])) {
|
||||
echo "<div class='row'><div class='col-sm-4'>Assigned IP</div><div class='col-sm-8'>{$device['overwrite_ip']}</div></div>";
|
||||
} elseif (! empty($device['ip'])) {
|
||||
echo "<div class='row'><div class='col-sm-4'>Resolved IP</div><div class='col-sm-8'>{$device['ip']}</div></div>";
|
||||
} elseif (Config::get('force_ip_to_sysname') === true) {
|
||||
} else {
|
||||
try {
|
||||
$ip = IP::parse($device['hostname']);
|
||||
echo "<div class='row'><div class='col-sm-4'>IP Address</div><div class='col-sm-8'>$ip</div></div>";
|
||||
$ip = (string) IP::parse($device['hostname']);
|
||||
if ($ip !== format_hostname($device)) {
|
||||
echo "<div class='row'><div class='col-sm-4'>IP Address</div><div class='col-sm-8'>$ip</div></div>";
|
||||
}
|
||||
} catch (InvalidIpException $e) {
|
||||
// don't add an ip line
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user