Add filter widget to StateHistorySummary and fix some minor bugs
fixes #6979
This commit is contained in:
parent
4ce71ef2f2
commit
6c8f324dd4
|
@ -121,7 +121,7 @@ class HistoryColorGrid extends AbstractWidget {
|
|||
*/
|
||||
private function renderDay($day)
|
||||
{
|
||||
if (array_key_exists($day, $this->data)) {
|
||||
if (array_key_exists($day, $this->data) && $this->data[$day]['value'] > 0) {
|
||||
$entry = $this->data[$day];
|
||||
return'<a ' .
|
||||
'style="background-color:' . $this->calculateColor($entry['value']) . '; '
|
||||
|
|
|
@ -39,15 +39,14 @@ class StatehistoryForm extends Form
|
|||
'cnt_unknown_hard' => Filter::expression('state', '=', '3'),
|
||||
'cnt_ok' => Filter::expression('state', '=', '0')
|
||||
);
|
||||
$stateFilter = $states[$this->getValue('state', 'cnt_critical_hard')];
|
||||
$state = $this->getValue('state', 'cnt_critical_hard');
|
||||
$stateFilter = $states[$state];
|
||||
if (in_array($state, array('cnt_ok', 'cnt_up'))) {
|
||||
return Filter::matchAll($objectTypeFilter, $stateFilter);
|
||||
}
|
||||
return Filter::matchAll($baseFilter, $objectTypeFilter, $stateFilter);
|
||||
}
|
||||
|
||||
public function relativeMonth($month)
|
||||
{
|
||||
$timestamp = strtotime('3 months ago');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the confirmation form
|
||||
*
|
||||
|
@ -100,7 +99,7 @@ class StatehistoryForm extends Form
|
|||
);
|
||||
if ($objectType === 'services') {
|
||||
$serviceState = $this->getRequest()->getParam('state', 'cnt_critical_hard');
|
||||
if (in_array($serviceState, array('cnt_down_hard', 'cnt_unreachable', 'cnt_up'))) {
|
||||
if (in_array($serviceState, array('cnt_down_hard', 'cnt_unreachable_hard', 'cnt_up'))) {
|
||||
$serviceState = 'cnt_critical_hard';
|
||||
}
|
||||
$this->addElement(
|
||||
|
@ -132,7 +131,7 @@ class StatehistoryForm extends Form
|
|||
'multiOptions' => array(
|
||||
'cnt_up' => t('Up'),
|
||||
'cnt_down_hard' => t('Down'),
|
||||
'cnt_unreachable' => t('Unreachable')
|
||||
'cnt_unreachable_hard' => t('Unreachable')
|
||||
),
|
||||
'class' => 'autosubmit'
|
||||
)
|
||||
|
|
|
@ -11,6 +11,10 @@ use Icinga\Web\Widget\Chart\HistoryColorGrid;
|
|||
<br />
|
||||
<?= $form ?>
|
||||
</div>
|
||||
<?php if (! $this->filterEditor): ?>
|
||||
<?= $this->filterPreview ?>
|
||||
<?php endif ?>
|
||||
<?= $this->filterEditor ?>
|
||||
</div>
|
||||
<? endif; ?>
|
||||
|
||||
|
@ -19,38 +23,39 @@ use Icinga\Web\Widget\Chart\HistoryColorGrid;
|
|||
|
||||
$settings = array(
|
||||
'cnt_up' => array(
|
||||
'tooltip' => t('%d ok states on %s'),
|
||||
'tooltip' => t('%d ok on %s'),
|
||||
'color' => '#49DF96',
|
||||
'opacity' => '0.55'
|
||||
),
|
||||
'cnt_down_hard' => array(
|
||||
'tooltip' => t('%d ok states on %s'),
|
||||
'color' => '#ff5566',
|
||||
'opacity' => '0.7'
|
||||
),
|
||||
'cnt_unreachable_hard' => array(
|
||||
'tooltip' => t('%d ok states on %s'),
|
||||
'tooltip' => t('%d unreachable on %s'),
|
||||
'color' => '#77AAFF',
|
||||
'opacity' => '0.55'
|
||||
),
|
||||
'cnt_critical_hard' => array(
|
||||
'tooltip' => t('%d critical states on %s'),
|
||||
'tooltip' => t('%d critical on %s'),
|
||||
'color' => '#ff5566',
|
||||
'opacity' => '0.9'
|
||||
),
|
||||
|
||||
'cnt_warning_hard' => array(
|
||||
'tooltip' => t('%d warning states on %s'),
|
||||
'tooltip' => t('%d warning on %s'),
|
||||
'color' => '#ffaa44',
|
||||
'opacity' => '1.0'
|
||||
),
|
||||
|
||||
'cnt_down_hard' => array(
|
||||
'tooltip' => t('%d down on %s'),
|
||||
'color' => '#ff5566',
|
||||
'opacity' => '0.9'
|
||||
),
|
||||
'cnt_unknown_hard' => array(
|
||||
'tooltip' => t('%d unknown states on %s'),
|
||||
'tooltip' => t('%d unknown on %s'),
|
||||
'color' => '#cc77ff',
|
||||
'opacity' => '0.7'
|
||||
),
|
||||
'cnt_ok' => array(
|
||||
'tooltip' => t('%d ok states on %s'),
|
||||
'tooltip' => t('%d ok on %s'),
|
||||
'color' => '#49DF96',
|
||||
'opacity' => '0.55'
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue