Merge pull request #3948 from Icinga/fix/missing-notifications-in-timeline-3947

Fix timeline
This commit is contained in:
Johannes Meyer 2019-09-26 14:33:47 +02:00 committed by GitHub
commit b4f1847ec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 81 additions and 11 deletions

View File

@ -46,10 +46,47 @@ class TimelineController extends Controller
)
),
array(
'notify' => array(
'class' => 'timeline-notification',
'detailUrl' => $detailUrl,
'label' => mt('monitoring', 'Notifications')
'notification_ack' => array(
'class' => 'timeline-notification',
'detailUrl' => $detailUrl,
'label' => mt('monitoring', 'Notifications'),
'groupBy' => 'notification_*'
),
'notification_flapping' => array(
'class' => 'timeline-notification',
'detailUrl' => $detailUrl,
'label' => mt('monitoring', 'Notifications'),
'groupBy' => 'notification_*'
),
'notification_flapping_end' => array(
'class' => 'timeline-notification',
'detailUrl' => $detailUrl,
'label' => mt('monitoring', 'Notifications'),
'groupBy' => 'notification_*'
),
'notification_dt_start' => array(
'class' => 'timeline-notification',
'detailUrl' => $detailUrl,
'label' => mt('monitoring', 'Notifications'),
'groupBy' => 'notification_*'
),
'notification_dt_end' => array(
'class' => 'timeline-notification',
'detailUrl' => $detailUrl,
'label' => mt('monitoring', 'Notifications'),
'groupBy' => 'notification_*'
),
'notification_custom' => array(
'class' => 'timeline-notification',
'detailUrl' => $detailUrl,
'label' => mt('monitoring', 'Notifications'),
'groupBy' => 'notification_*'
),
'notification_state' => array(
'class' => 'timeline-notification',
'detailUrl' => $detailUrl,
'label' => mt('monitoring', 'Notifications'),
'groupBy' => 'notification_*'
),
'hard_state' => array(
'class' => 'timeline-hard-state',

View File

@ -208,6 +208,10 @@ class TimeLine implements IteratorAggregate
{
$groupInfo = array();
foreach ($this->identifiers as $name => $attributes) {
if (isset($attributes['groupBy'])) {
$name = $attributes['groupBy'];
}
$groupInfo[$name]['class'] = $attributes['class'];
$groupInfo[$name]['label'] = $attributes['label'];
}
@ -436,16 +440,28 @@ class TimeLine implements IteratorAggregate
foreach ($data as $timestamp => $count) {
$dateTime = new DateTime();
$dateTime->setTimestamp($timestamp);
$groups[$timestamp][$name] = TimeEntry::fromArray(
array_merge(
$this->identifiers[$name],
$groupName = $name;
if (isset($this->identifiers[$name]['groupBy'])) {
$groupName = $this->identifiers[$name]['groupBy'];
}
if (isset($groups[$timestamp][$groupName])) {
$groups[$timestamp][$groupName]->setValue(
$groups[$timestamp][$groupName]->getValue() + $count
);
} else {
$groups[$timestamp][$groupName] = TimeEntry::fromArray(
array(
'name' => $name,
'name' => $groupName,
'value' => $count,
'dateTime' => $dateTime
'dateTime' => $dateTime,
'class' => $this->identifiers[$name]['class'],
'detailUrl' => $this->identifiers[$name]['detailUrl'],
'label' => $this->identifiers[$name]['label']
)
)
);
);
}
}
}

View File

@ -503,21 +503,38 @@ div.timeline {
}
div.circle-box {
// width: inline-style;
height: 100%;
margin-right: 0.5em;
position: relative;
float: left;
div.outer-circle {
// width: inline-style;
// height: inline-style;
position: absolute;
top: 50%;
// margin-top: inline-style;
&.extrapolated {
border-width: 2px;
border-style: dotted;
//border-color: inline-style;
border-radius: 100%;
// background-color: inline-style;
}
a.inner-circle {
// width: inline-style;
// height: inline-style;
display: block;
position: absolute;
top: 50%;
left: 50%;
// margin-top: inline-style;
// margin-left: inline-style;
border-radius: 100%;
// background-color: inline-style;
}
}
}