Restructure timeline layout and styles

refs #4190
This commit is contained in:
Johannes Meyer 2014-03-28 17:00:53 +01:00
parent c19791fdd7
commit e3be5dd255
2 changed files with 68 additions and 81 deletions

View File

@ -3,6 +3,7 @@ use Icinga\Util\Color;
$groupInfo = $timeline->getGroupInfo(); $groupInfo = $timeline->getGroupInfo();
$firstRow = true; $firstRow = true;
?> ?>
<div class="controls"> <div class="controls">
<div style="margin: 1em;" class="dontprint"> <div style="margin: 1em;" class="dontprint">
@ -18,11 +19,10 @@ $firstRow = true;
</div> </div>
</div> </div>
<div class="content" data-base-target="_next"> <div class="content" data-base-target="_next">
<table class="timeline"> <div class="timeline">
<tbody>
<?php foreach ($timeline as $timeInfo): ?> <?php foreach ($timeline as $timeInfo): ?>
<tr> <div class="timeframe">
<th> <span>
<a href="<?= $this->href( <a href="<?= $this->href(
'/monitoring/list/eventhistory', '/monitoring/list/eventhistory',
array( array(
@ -32,38 +32,30 @@ $firstRow = true;
); ?>"> ); ?>">
<?= $timeInfo[0]->end->format($intervalFormat); ?> <?= $timeInfo[0]->end->format($intervalFormat); ?>
</a> </a>
</th> </span>
<div class="circles">
<?php foreach ($groupInfo as $groupName => $labelAndColor): ?> <?php foreach ($groupInfo as $groupName => $labelAndColor): ?>
<td>
<div class="circle-box">
<?php if (array_key_exists($groupName, $timeInfo[1])): ?> <?php if (array_key_exists($groupName, $timeInfo[1])): ?>
<?php <?php
$circleWidth = $timeline->calculateCircleWidth($timeInfo[1][$groupName], 2); $circleWidth = $timeline->calculateCircleWidth($timeInfo[1][$groupName], 2);
$extrapolatedCircleWidth = $timeline->getExtrapolatedCircleWidth($timeInfo[1][$groupName], 2); $extrapolatedCircleWidth = $timeline->getExtrapolatedCircleWidth($timeInfo[1][$groupName], 2);
?> ?>
<?php if ($firstRow && $extrapolatedCircleWidth !== $circleWidth): ?> <?php if ($firstRow && $extrapolatedCircleWidth !== $circleWidth): ?>
<?php <div class="outer-circle extrapolated" style="<?= sprintf(
$inlineStyle = sprintf( 'width: %3$s; height: %3$s; border-color: %2$s; background-color: %1$s;',
'width: %4$s; height: %4$s; margin-top: -%2$s; margin-left: -%2$s; border-color: %3$s; background-color: %1$s;',
Color::changeBrightness($timeInfo[1][$groupName]->getColor(), 0.7), Color::changeBrightness($timeInfo[1][$groupName]->getColor(), 0.7),
((float) substr($extrapolatedCircleWidth, 0, -2) / 2) . 'em',
$timeInfo[1][$groupName]->getColor(), $timeInfo[1][$groupName]->getColor(),
$extrapolatedCircleWidth $extrapolatedCircleWidth
); ); ?>">
?>
<div class="outer-circle extrapolated" style="<?= $inlineStyle; ?>">
<?php else: ?> <?php else: ?>
<div class="outer-circle"> <div class="outer-circle" style="<?= sprintf('width: %1$s; height: %1$s;', $circleWidth); ?>">
<?php endif ?> <?php endif ?>
<?php <a class="inner-circle" style="<?= sprintf(
$inlineStyle = sprintf(
'width: %3$s; height: %3$s; background-color: %2$s; margin-top: -%1$s; margin-left: -%1$s;', 'width: %3$s; height: %3$s; background-color: %2$s; margin-top: -%1$s; margin-left: -%1$s;',
((float) substr($circleWidth, 0, -2) / 2) . 'em', ((float) substr($circleWidth, 0, -2) / 2) . 'em',
$timeInfo[1][$groupName]->getColor(), $timeInfo[1][$groupName]->getColor(),
$circleWidth $circleWidth
); ); ?>" href="<?= $this->href(
?>
<a class="inner-circle" style="<?= $inlineStyle; ?>" href="<?= $this->href(
sprintf( sprintf(
$timeInfo[1][$groupName]->getDetailUrl(), $timeInfo[1][$groupName]->getDetailUrl(),
$timeInfo[0]->start->getTimestamp(), $timeInfo[0]->start->getTimestamp(),
@ -72,15 +64,11 @@ $inlineStyle = sprintf(
) )
); ?>" title="<?= $timeInfo[1][$groupName]->getValue(); ?> <?= $labelAndColor['label']; ?>"></a> ); ?>" title="<?= $timeInfo[1][$groupName]->getValue(); ?> <?= $labelAndColor['label']; ?>"></a>
</div> </div>
<?php else: ?>
&nbsp;
<?php endif ?> <?php endif ?>
</div>
</td>
<?php endforeach ?> <?php endforeach ?>
</tr> </div>
</div>
<?php $firstRow = false; ?> <?php $firstRow = false; ?>
<?php endforeach ?> <?php endforeach ?>
</tbody> </div>
</table>
</div> </div>

View File

@ -660,16 +660,24 @@ div.timeline-legend {
} }
} }
table.timeline { div.timeline {
div.timeframe {
height: 7em;
margin-bottom: 1em;
clear: left; clear: left;
th { span {
width: 8em; width: 8em;
padding-right: 1.5em; margin-top: 2.3em;
margin-right: 1.5em;
display: block;
float: left;
text-align: center;
a { a {
color: black; color: black;
font-size: 0.8em; font-size: 0.8em;
font-weight: bold;
text-decoration: none; text-decoration: none;
white-space: nowrap; white-space: nowrap;
@ -679,26 +687,17 @@ table.timeline {
} }
} }
td { div.circles {
padding: 0.5em; float: left;
div.circle-box {
width: 6em;
height: 6em;
position: relative;
div.outer-circle { div.outer-circle {
width: 100%;
height: 100%;
position: absolute;
&.extrapolated {
// width: inline-style; // width: inline-style;
// height: inline-style; // height: inline-style;
top: 48%; // Compensate border margin: 0.5em;
left: 48%; // Compensate border position: relative;
// margin-top: inline-style; float: left;
// margin-left: inline-style;
&.extrapolated {
border-width: 2px; border-width: 2px;
border-style: dotted; border-style: dotted;
//border-color: inline-style; //border-color: inline-style;