Check if service_name is empty or equal to service_type (#14499)

* Check if name empty or name == service

* Linting ("" → '')
This commit is contained in:
Lucas Gasenzer
2022-10-23 20:00:29 +02:00
committed by GitHub
parent 056dbc9a57
commit 707f2cd29f

View File

@@ -13,8 +13,9 @@ if (ObjectCache::serviceCounts(['total'], $device['device_id'])['total'] > 0) {
$color = $colors->get($service->service_status, 'grey');
$type = strtolower($service->service_type);
$name = $service->service_name;
$name_type = ($name == '' || $name == $type) ? $type : $name . ' (' . $type . ')';
return "<span title='$message' class='$color'>$name ($type)</span>";
return "<span title='$message' class='$color'>$name_type</span>";
})->implode(', ');
$services = ObjectCache::serviceCounts(['total', 'ok', 'warning', 'critical'], $device['device_id']); ?>