mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 08:14:03 +02:00
ProcessCheckResultCommandForm: Use getHostMultiOptions method
refs #9672
This commit is contained in:
parent
dfbcc066a7
commit
18f382e85e
@ -52,11 +52,7 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'label' => $this->translate('Status'),
|
'label' => $this->translate('Status'),
|
||||||
'description' => $this->translate('The state this check result should report'),
|
'description' => $this->translate('The state this check result should report'),
|
||||||
'multiOptions' => $object->getType() === $object::TYPE_HOST ? array(
|
'multiOptions' => $object->getType() === $object::TYPE_HOST ? $this->getHostMultiOptions() : array(
|
||||||
ProcessCheckResultCommand::HOST_UP => $this->translate('UP', 'icinga.state'),
|
|
||||||
ProcessCheckResultCommand::HOST_DOWN => $this->translate('DOWN', 'icinga.state'),
|
|
||||||
ProcessCheckResultCommand::HOST_UNREACHABLE => $this->translate('UNREACHABLE', 'icinga.state')
|
|
||||||
) : array(
|
|
||||||
ProcessCheckResultCommand::SERVICE_OK => $this->translate('OK', 'icinga.state'),
|
ProcessCheckResultCommand::SERVICE_OK => $this->translate('OK', 'icinga.state'),
|
||||||
ProcessCheckResultCommand::SERVICE_WARNING => $this->translate('WARNING', 'icinga.state'),
|
ProcessCheckResultCommand::SERVICE_WARNING => $this->translate('WARNING', 'icinga.state'),
|
||||||
ProcessCheckResultCommand::SERVICE_CRITICAL => $this->translate('CRITICAL', 'icinga.state'),
|
ProcessCheckResultCommand::SERVICE_CRITICAL => $this->translate('CRITICAL', 'icinga.state'),
|
||||||
@ -115,4 +111,23 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the available host options based on the program version
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getHostMultiOptions()
|
||||||
|
{
|
||||||
|
$options = array(
|
||||||
|
ProcessCheckResultCommand::HOST_UP => $this->translate('UP', 'icinga.state'),
|
||||||
|
ProcessCheckResultCommand::HOST_DOWN => $this->translate('DOWN', 'icinga.state')
|
||||||
|
);
|
||||||
|
|
||||||
|
if (! preg_match('~^v2\.\d+\.\d+.*$~', $this->getBackend()->getProgramVersion())) {
|
||||||
|
$options[ProcessCheckResultCommand::HOST_UNREACHABLE] = $this->translate('UNREACHABLE', 'icinga.state');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user