remove unneeded fetchHostVars and fetchCustomVars calls in detail view extension

This commit is contained in:
Marc DeTrano 2025-08-04 11:07:30 -06:00
parent 7c45a322ce
commit fe743086bc
2 changed files with 4 additions and 5 deletions

View file

@ -57,7 +57,6 @@ class ServiceDetailExtension extends ServiceDetailExtensionHook
'tree_var',
'icingaweb_businessprocess_as_tree'
);
} catch (\Exception $e) {
// Ignore and don't display anything
}

View file

@ -76,9 +76,9 @@ class DetailviewExtension extends DetailviewExtensionHook
return '';
}
$customvars = array_merge($object->fetchHostVariables()->hostVariables, $object->fetchCustomvars()->customvars); #Must grab customvars with this method, object access will not work with coalesce operator
$bpName = $customvars[$this->configVar] ?? null;
# Grab custom vars first, merge service over host vars
$customvars = array_merge($object->hostVariables, $object->customvars);
$bpName = $customvars[$this->configVar] ?? null;
if (! $bpName) {
$bpName = key($this->storage->listProcessNames());
}
@ -93,7 +93,7 @@ class DetailviewExtension extends DetailviewExtensionHook
MonitoringState::apply($bp);
if (filter_var( $customvars[$this->treeVar] ?? false, FILTER_VALIDATE_BOOLEAN)) {
if (filter_var($customvars[$this->treeVar] ?? false, FILTER_VALIDATE_BOOLEAN)) {
$renderer = new TreeRenderer($bp, $node);
$tag = 'ul';
} else {