mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 00:34:05 +02:00
IcingaObject: add new helper methods for seconds
This commit is contained in:
parent
d516a050ac
commit
d8d12d38b4
@ -74,11 +74,7 @@ class IcingaCommand extends IcingaObject
|
|||||||
|
|
||||||
protected function renderTimeout()
|
protected function renderTimeout()
|
||||||
{
|
{
|
||||||
$value = $this->timeout;
|
return $this->renderPropertyAsSecond('timeout');
|
||||||
if ($value % 60 === 0) {
|
|
||||||
$value = ((int) $value / 60) . 'm';
|
|
||||||
}
|
|
||||||
return c::renderKeyValue('timeout', $value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setPluginDir($pluginDir)
|
public static function setPluginDir($pluginDir)
|
||||||
|
@ -24,6 +24,6 @@ class IcingaEndpoint extends IcingaObject
|
|||||||
|
|
||||||
protected function renderLog_duration()
|
protected function renderLog_duration()
|
||||||
{
|
{
|
||||||
return c::renderKeyValue('log_duration', $this->log_duration);
|
return $this->renderPropertyAsSecond('log_duration');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -705,6 +705,17 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
return c::renderKeyValue($key, c::renderBoolean($this->$key));
|
return c::renderKeyValue($key, c::renderBoolean($this->$key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderPropertyAsSeconds($key)
|
||||||
|
{
|
||||||
|
$value = $this->$key;
|
||||||
|
|
||||||
|
if ($value % 60 === 0) {
|
||||||
|
$value = ((int) $value / 60) . 'm';
|
||||||
|
}
|
||||||
|
|
||||||
|
return c::renderKeyValue($key, $value);
|
||||||
|
}
|
||||||
|
|
||||||
protected function renderSuffix()
|
protected function renderSuffix()
|
||||||
{
|
{
|
||||||
return "}\n\n";
|
return "}\n\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user