From 9d3935f15b0846ccdb549ef503ebfcaf05bedd22 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 25 Oct 2013 11:25:20 +0200 Subject: [PATCH] Improve timeline layout refs #4190 --- library/Icinga/Timeline/TimeLine.php | 30 ++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/library/Icinga/Timeline/TimeLine.php b/library/Icinga/Timeline/TimeLine.php index b968f15b7..438cd480f 100644 --- a/library/Icinga/Timeline/TimeLine.php +++ b/library/Icinga/Timeline/TimeLine.php @@ -294,36 +294,50 @@ class TimeLine extends Form $elements = array(); foreach ($this->range as $timestamp => $timeframe) { $elementGroups = array(); + $biggestWidth = 0; if (array_key_exists($timestamp, $timelineGroups)) { foreach ($timelineGroups[$timestamp] as $group) { - $eventCount = empty($elements) ? $this->extrapolateEventCount($group, 4) : $group->getValue(); + $circleWidth = $this->calculateCircleWidth( + empty($elements) ? $this->extrapolateEventCount($group, 4) : $group->getValue() + ); $groupColor = $group->getColor() !== null ? $group->getColor() : $this->getRandomCssColor(); $elementGroups[] = sprintf( - '
' . - ' ' . - '
' . + ' ' . + '
' . - ' %4$s' . + ' %3$s' . '
' . '
' . '
', - $this->calculateCircleWidth($eventCount), $group->getDetailUrl(), $this->diameterUnit, $group->getValue(), + $circleWidth, $groupColor ); + + if ($circleWidth > $biggestWidth) { + $biggestWidth = $circleWidth; + } } } $timeframeUrl = $this->getRequest()->getBaseUrl() . '/monitoring/list/eventhistory?timestamp<=' . $timeframe->start->getTimestamp() . '×tamp>=' . $timeframe->end->getTimestamp(); - $elements[] = '
' . implode('', $elementGroups) . '
'; + $elements[] = sprintf( + '
%1$s
', + implode('', $elementGroups), + $this->diameterUnit, + $biggestWidth + ); + $elements[] = '
'; $elements[] = '
' . - $timeframe->end->format($this->getIntervalFormat()) . '
'; + $timeframe->end->format($this->getIntervalFormat()) . '' . + '
'; } return implode('', $elements);