mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
parent
b0709d8cba
commit
66c3dd26e5
@ -38,6 +38,7 @@ class Monitoring_TimelineController extends ActionController
|
||||
);
|
||||
$timeline->setDisplayRange($displayRange);
|
||||
$timeline->setForecastRange($forecastRange);
|
||||
$timeline->setSession($this->getWindowSession('timeline'));
|
||||
|
||||
$this->view->timeline = $timeline;
|
||||
$this->view->intervalFormat = $this->getIntervalFormat();
|
||||
|
@ -9,6 +9,8 @@ use \Exception;
|
||||
use \ArrayIterator;
|
||||
use \IteratorAggregate;
|
||||
use Icinga\Web\Hook;
|
||||
use Icinga\Web\Session;
|
||||
use Icinga\Web\Session\SessionNamespace;
|
||||
use Icinga\Module\Monitoring\DataView\DataView;
|
||||
|
||||
/**
|
||||
@ -30,6 +32,13 @@ class TimeLine implements IteratorAggregate
|
||||
*/
|
||||
private $displayGroups;
|
||||
|
||||
/**
|
||||
* The session to use
|
||||
*
|
||||
* @var SessionNamespace
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
* The base that is used to calculate each circle's diameter
|
||||
*
|
||||
@ -105,6 +114,16 @@ class TimeLine implements IteratorAggregate
|
||||
$this->identifiers = $identifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the session to use
|
||||
*
|
||||
* @param SessionNamespace $session The session to use
|
||||
*/
|
||||
public function setSession(SessionNamespace $session)
|
||||
{
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the range of time for which to display elements
|
||||
*
|
||||
@ -201,12 +220,20 @@ class TimeLine implements IteratorAggregate
|
||||
public function getCalculationBase($create)
|
||||
{
|
||||
if ($this->calculationBase === null) {
|
||||
// TODO: get base from session
|
||||
if ($this->session !== null) {
|
||||
// TODO: Do not use this if the interval has changed or the user did a reload
|
||||
$this->calculationBase = $this->session->get('calculationBase');
|
||||
}
|
||||
|
||||
if ($create) {
|
||||
$new = $this->generateCalculationBase();
|
||||
if ($new > $this->calculationBase) {
|
||||
// TODO: save base in session
|
||||
$this->calculationBase = $new;
|
||||
|
||||
if ($this->session !== null) {
|
||||
$this->session->calculationBase = $new;
|
||||
Session::getSession()->write(); // TODO: Should it be possible to call write() on the namespace?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -242,7 +269,7 @@ class TimeLine implements IteratorAggregate
|
||||
}
|
||||
}
|
||||
|
||||
return pow($highestValue, 1 / 100);
|
||||
return pow($highestValue, 1 / 100); // 100 == 100%
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user