Skip to content

Commit d71601e

Browse files
Schedule detail: Introduce Timescale
1 parent 66923ce commit d71601e

File tree

2 files changed

+2
-74
lines changed

2 files changed

+2
-74
lines changed

library/Notifications/Widget/Timeline.php

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
use Icinga\Module\Notifications\Widget\TimeGrid\EntryProvider;
1313
use Icinga\Module\Notifications\Widget\TimeGrid\GridStep;
1414
use Icinga\Module\Notifications\Widget\TimeGrid\Timescale;
15-
use Icinga\Module\Notifications\Widget\TimeGrid\Util;
1615
use Icinga\Module\Notifications\Widget\Timeline\Entry;
1716
use Icinga\Module\Notifications\Widget\Timeline\MinimalGrid;
1817
use Icinga\Module\Notifications\Widget\Timeline\Rotation;
19-
use IntlDateFormatter;
2018
use ipl\Html\Attributes;
2119
use ipl\Html\BaseHtmlElement;
2220
use ipl\Html\HtmlElement;
@@ -26,7 +24,6 @@
2624
use ipl\Web\Url;
2725
use ipl\Web\Widget\Icon;
2826
use ipl\Web\Widget\Link;
29-
use Locale;
3027
use SplObjectStorage;
3128
use Traversable;
3229

@@ -321,41 +318,8 @@ protected function assemble()
321318
)
322319
);
323320

324-
$dateFormatter = new IntlDateFormatter(
325-
Locale::getDefault(),
326-
IntlDateFormatter::NONE,
327-
IntlDateFormatter::SHORT
328-
);
329-
330-
$now = new DateTime();
331-
$currentTime = new HtmlElement(
332-
'div',
333-
new Attributes(['class' => 'time-hand']),
334-
new HtmlElement(
335-
'div',
336-
new Attributes(['class' => 'now', 'title' => $dateFormatter->format($now)]),
337-
Text::create($this->translate('now'))
338-
)
339-
);
340-
341-
$now = Util::roundToNearestThirtyMinute($now);
342-
343-
$this->getStyle()->addFor($currentTime, [
344-
'--timeStartColumn' =>
345-
$now->format('G') * 2 // 2 columns per hour
346-
+ ($now->format('i') >= 30 ? 1 : 0) // 1 column for the half hour
347-
+ 1 // CSS starts counting columns from 1, not zero
348-
]);
349-
350-
$clock = new HtmlElement(
351-
'div',
352-
new Attributes(['class' => 'clock']),
353-
new HtmlElement('div', new Attributes(['class' => 'current-day']), $currentTime)
354-
);
355-
356321
$this->getGrid()
357-
->addHtml(new Timescale($this->days, $this->getStyle()))
358-
->addHtml($clock);
322+
->addHtml(new Timescale($this->days, $this->getStyle()));
359323
}
360324

361325
$this->addHtml(

public/css/timeline.less

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
.time-grid-header {
1616
box-sizing: border-box;
1717
position: sticky;
18-
z-index: 2; // overlap the .clock .time-hand
18+
z-index: 1;
1919
top: 0;
2020
}
2121

@@ -49,7 +49,6 @@
4949
.overlay .entry {
5050
margin-top: 1em;
5151
margin-bottom: 1em;
52-
z-index: 2; // overlap the .clock .time-hand
5352

5453
.title {
5554
height: 100%;
@@ -116,34 +115,6 @@
116115
grid-area: ~"1 / -2 / 1 / -1";
117116
}
118117
}
119-
120-
.clock {
121-
display: grid;
122-
grid-template-columns: repeat(var(--primaryColumns), 1fr);
123-
grid-area: ~"3 / 2 / 4 / 3";
124-
border-top: 1px solid transparent; // left not required, otherwise the .time-hand is not aligned properly
125-
126-
.current-day {
127-
display: grid;
128-
grid-template-columns: repeat(var(--columnsPerStep), 1fr);
129-
grid-area: ~"1 / 1 / 2 / 2";
130-
131-
.time-hand {
132-
grid-area: ~"1 / var(--timeStartColumn) / 2 / calc(var(--timeStartColumn) + 1)";
133-
display: flex;
134-
align-items: flex-end;
135-
width: 1px;
136-
border-left: 1px solid red;
137-
z-index: 1;
138-
139-
.now {
140-
.rounded-corners();
141-
padding: 0 .25em;
142-
transform: translate(-50%, 50%);
143-
}
144-
}
145-
}
146-
}
147118
}
148119
}
149120

@@ -214,13 +185,6 @@
214185
color: @gray-semilight;
215186
background: @body-bg-color;
216187
}
217-
218-
.clock .now {
219-
background-color: @gray-light;
220-
font-size: 0.75em;
221-
color: red;
222-
.user-select(none);
223-
}
224188
}
225189

226190
.timeline.minimal-layout .empty-notice {

0 commit comments

Comments
 (0)