monitoring: Fix timeline

* Fixes extrapolation style
* Fixes missing notifications

fixes #3947
This commit is contained in:
Johannes Meyer 2019-09-12 10:30:49 +02:00
parent c3603c991d
commit bfa5f9610b
3 changed files with 81 additions and 11 deletions

View File

@ -46,10 +46,47 @@ class TimelineController extends Controller
) )
), ),
array( array(
'notify' => array( 'notification_ack' => array(
'class' => 'timeline-notification', 'class' => 'timeline-notification',
'detailUrl' => $detailUrl, 'detailUrl' => $detailUrl,
'label' => mt('monitoring', 'Notifications') '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( 'hard_state' => array(
'class' => 'timeline-hard-state', 'class' => 'timeline-hard-state',

View File

@ -208,6 +208,10 @@ class TimeLine implements IteratorAggregate
{ {
$groupInfo = array(); $groupInfo = array();
foreach ($this->identifiers as $name => $attributes) { foreach ($this->identifiers as $name => $attributes) {
if (isset($attributes['groupBy'])) {
$name = $attributes['groupBy'];
}
$groupInfo[$name]['class'] = $attributes['class']; $groupInfo[$name]['class'] = $attributes['class'];
$groupInfo[$name]['label'] = $attributes['label']; $groupInfo[$name]['label'] = $attributes['label'];
} }
@ -436,18 +440,30 @@ class TimeLine implements IteratorAggregate
foreach ($data as $timestamp => $count) { foreach ($data as $timestamp => $count) {
$dateTime = new DateTime(); $dateTime = new DateTime();
$dateTime->setTimestamp($timestamp); $dateTime->setTimestamp($timestamp);
$groups[$timestamp][$name] = TimeEntry::fromArray(
array_merge( $groupName = $name;
$this->identifiers[$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( array(
'name' => $name, 'name' => $groupName,
'value' => $count, 'value' => $count,
'dateTime' => $dateTime 'dateTime' => $dateTime,
) 'class' => $this->identifiers[$name]['class'],
'detailUrl' => $this->identifiers[$name]['detailUrl'],
'label' => $this->identifiers[$name]['label']
) )
); );
} }
} }
}
return $groups; return $groups;
} }

View File

@ -503,21 +503,38 @@ div.timeline {
} }
div.circle-box { div.circle-box {
// width: inline-style;
height: 100%; height: 100%;
margin-right: 0.5em; margin-right: 0.5em;
position: relative; position: relative;
float: left; float: left;
div.outer-circle { div.outer-circle {
// width: inline-style;
// height: inline-style;
position: absolute; position: absolute;
top: 50%; 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 { a.inner-circle {
// width: inline-style;
// height: inline-style;
display: block; display: block;
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
// margin-top: inline-style;
// margin-left: inline-style;
border-radius: 100%; border-radius: 100%;
// background-color: inline-style;
} }
} }
} }