mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
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)
|
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];
|
$entry = $this->data[$day];
|
||||||
return'<a ' .
|
return'<a ' .
|
||||||
'style="background-color:' . $this->calculateColor($entry['value']) . '; '
|
'style="background-color:' . $this->calculateColor($entry['value']) . '; '
|
||||||
|
@ -39,15 +39,14 @@ class StatehistoryForm extends Form
|
|||||||
'cnt_unknown_hard' => Filter::expression('state', '=', '3'),
|
'cnt_unknown_hard' => Filter::expression('state', '=', '3'),
|
||||||
'cnt_ok' => Filter::expression('state', '=', '0')
|
'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);
|
return Filter::matchAll($baseFilter, $objectTypeFilter, $stateFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function relativeMonth($month)
|
|
||||||
{
|
|
||||||
$timestamp = strtotime('3 months ago');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the confirmation form
|
* Create the confirmation form
|
||||||
*
|
*
|
||||||
@ -100,7 +99,7 @@ class StatehistoryForm extends Form
|
|||||||
);
|
);
|
||||||
if ($objectType === 'services') {
|
if ($objectType === 'services') {
|
||||||
$serviceState = $this->getRequest()->getParam('state', 'cnt_critical_hard');
|
$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';
|
$serviceState = 'cnt_critical_hard';
|
||||||
}
|
}
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
@ -132,7 +131,7 @@ class StatehistoryForm extends Form
|
|||||||
'multiOptions' => array(
|
'multiOptions' => array(
|
||||||
'cnt_up' => t('Up'),
|
'cnt_up' => t('Up'),
|
||||||
'cnt_down_hard' => t('Down'),
|
'cnt_down_hard' => t('Down'),
|
||||||
'cnt_unreachable' => t('Unreachable')
|
'cnt_unreachable_hard' => t('Unreachable')
|
||||||
),
|
),
|
||||||
'class' => 'autosubmit'
|
'class' => 'autosubmit'
|
||||||
)
|
)
|
||||||
|
@ -11,6 +11,10 @@ use Icinga\Web\Widget\Chart\HistoryColorGrid;
|
|||||||
<br />
|
<br />
|
||||||
<?= $form ?>
|
<?= $form ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php if (! $this->filterEditor): ?>
|
||||||
|
<?= $this->filterPreview ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<?= $this->filterEditor ?>
|
||||||
</div>
|
</div>
|
||||||
<? endif; ?>
|
<? endif; ?>
|
||||||
|
|
||||||
@ -19,38 +23,39 @@ use Icinga\Web\Widget\Chart\HistoryColorGrid;
|
|||||||
|
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'cnt_up' => array(
|
'cnt_up' => array(
|
||||||
'tooltip' => t('%d ok states on %s'),
|
'tooltip' => t('%d ok on %s'),
|
||||||
'color' => '#49DF96',
|
'color' => '#49DF96',
|
||||||
'opacity' => '0.55'
|
'opacity' => '0.55'
|
||||||
),
|
),
|
||||||
'cnt_down_hard' => array(
|
|
||||||
'tooltip' => t('%d ok states on %s'),
|
|
||||||
'color' => '#ff5566',
|
|
||||||
'opacity' => '0.7'
|
|
||||||
),
|
|
||||||
'cnt_unreachable_hard' => array(
|
'cnt_unreachable_hard' => array(
|
||||||
'tooltip' => t('%d ok states on %s'),
|
'tooltip' => t('%d unreachable on %s'),
|
||||||
'color' => '#77AAFF',
|
'color' => '#77AAFF',
|
||||||
'opacity' => '0.55'
|
'opacity' => '0.55'
|
||||||
),
|
),
|
||||||
'cnt_critical_hard' => array(
|
'cnt_critical_hard' => array(
|
||||||
'tooltip' => t('%d critical states on %s'),
|
'tooltip' => t('%d critical on %s'),
|
||||||
'color' => '#ff5566',
|
'color' => '#ff5566',
|
||||||
'opacity' => '0.9'
|
'opacity' => '0.9'
|
||||||
),
|
),
|
||||||
|
|
||||||
'cnt_warning_hard' => array(
|
'cnt_warning_hard' => array(
|
||||||
'tooltip' => t('%d warning states on %s'),
|
'tooltip' => t('%d warning on %s'),
|
||||||
'color' => '#ffaa44',
|
'color' => '#ffaa44',
|
||||||
'opacity' => '1.0'
|
'opacity' => '1.0'
|
||||||
),
|
),
|
||||||
|
|
||||||
|
'cnt_down_hard' => array(
|
||||||
|
'tooltip' => t('%d down on %s'),
|
||||||
|
'color' => '#ff5566',
|
||||||
|
'opacity' => '0.9'
|
||||||
|
),
|
||||||
'cnt_unknown_hard' => array(
|
'cnt_unknown_hard' => array(
|
||||||
'tooltip' => t('%d unknown states on %s'),
|
'tooltip' => t('%d unknown on %s'),
|
||||||
'color' => '#cc77ff',
|
'color' => '#cc77ff',
|
||||||
'opacity' => '0.7'
|
'opacity' => '0.7'
|
||||||
),
|
),
|
||||||
'cnt_ok' => array(
|
'cnt_ok' => array(
|
||||||
'tooltip' => t('%d ok states on %s'),
|
'tooltip' => t('%d ok on %s'),
|
||||||
'color' => '#49DF96',
|
'color' => '#49DF96',
|
||||||
'opacity' => '0.55'
|
'opacity' => '0.55'
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user