mirror of
https://github.com/Icinga/icingaweb2-module-graphite.git
synced 2026-04-28 01:28:43 -04:00
parent
2c6cd09fa2
commit
a9dae9e1b9
1 changed files with 23 additions and 0 deletions
|
|
@ -146,6 +146,10 @@ class CommonForm extends Form
|
|||
*/
|
||||
protected function urlToForm()
|
||||
{
|
||||
if ($this->preSelectDefault()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$params = $this->getRedirectUrl()->getParams();
|
||||
$seconds = $this->getRelativeSeconds($params);
|
||||
|
||||
|
|
@ -187,4 +191,23 @@ class CommonForm extends Form
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If no range is specified, pre-select "1 hour"
|
||||
*
|
||||
* @return bool Whether no range is specified
|
||||
*/
|
||||
protected function preSelectDefault()
|
||||
{
|
||||
$params = $this->getRedirectUrl()->getParams();
|
||||
foreach (static::getAllRangeParameters() as $parameter) {
|
||||
if ($params->has($parameter)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->getElement('hours')->setValue('1');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue