Skip to content

Commit 8f4401c

Browse files
sukhwinder33445nilmerg
authored andcommitted
Fix horitzontal scroll bar in object detail view caused by progress-bar
Position the `.right` elements with right css property and `.left` with left
1 parent 807c574 commit 8f4401c

3 files changed

Lines changed: 26 additions & 24 deletions

File tree

library/Icingadb/Widget/Detail/DowntimeCard.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected function assemble()
100100

101101
$scheduledEndBubble = new HtmlElement(
102102
'li',
103-
null,
103+
new Attributes(['class' => 'right']),
104104
new HtmlElement(
105105
'div',
106106
Attributes::create(['class' => ['bubble', 'upwards']]),
@@ -124,18 +124,16 @@ protected function assemble()
124124
'width' => sprintf('%F%%', $flexEndLeft - $flexStartLeft)
125125
]);
126126

127-
if (time() > $this->end) {
128-
$styleElement
129-
->addFor($markerEnd, [
130-
'left' => sprintf('%F%%', $hPadding + $this->calcRelativeLeft($this->end))
131-
])
132-
->addFor($scheduledEndBubble, [
133-
'left' => sprintf('%F%%', $hPadding + $this->calcRelativeLeft($this->end))
134-
]);
135-
} else {
136-
$scheduledEndBubble->getAttributes()
137-
->add('class', 'right');
138-
}
127+
$styleElement
128+
->addFor($markerEnd, [
129+
'left' => sprintf('%F%%', $hPadding + $this->calcRelativeLeft($this->end))
130+
])
131+
->addFor($scheduledEndBubble, [
132+
'right' => sprintf(
133+
'%F%%',
134+
100 - ($hPadding + $this->calcRelativeLeft($this->end))
135+
)
136+
]);
139137

140138
$below->add([
141139
Html::tag(
@@ -163,8 +161,8 @@ protected function assemble()
163161
));
164162

165163
$styleElement
166-
->addFor($aboveStart, ['left' => sprintf('%F%%', $flexStartLeft)])
167-
->addFor($aboveEnd, ['left' => sprintf('%F%%', $flexEndLeft)]);
164+
->addFor($aboveStart, ['right' => sprintf('%F%%', 100 - $flexStartLeft)])
165+
->addFor($aboveEnd, ['right' => sprintf('%F%%', 100 - $flexEndLeft)]);
168166

169167
$above->add([$aboveStart, $aboveEnd, $styleElement]);
170168
} elseif ($this->downtime->is_flexible) {

public/css/mixin/progress-bar.less

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
}
1515

1616
.below {
17-
> .left {
17+
> .left { // positions with left property
1818
position: absolute;
1919
left: var(--hPadding);
2020
top: 0;
2121
}
2222

23-
> .right {
23+
> .right { // positions with right property
2424
position: absolute;
25-
left: ~"calc(var(--hPadding) + var(--duration-scale))";
25+
right: ~"calc(100% - calc(var(--hPadding) + var(--duration-scale)))";
2626
top: 0;
2727
}
2828
}
@@ -43,7 +43,7 @@
4343
width: auto;
4444
// The wrapper of .bubble is dynamically moved to the left based on the value of the progress bar
4545
// This moves the center of the bubble to the beginning of the wrapper regardless of the size of the content.
46-
transform: translate(-50%, 0);
46+
transform: translate(50%, 0);
4747
z-index: 1;
4848

4949
> * {
@@ -79,8 +79,8 @@
7979
}
8080

8181
&.right-aligned {
82-
// This is (.675em (:before placement) + .5em (half :before width)) + 1px (:before border)
83-
transform: translate(~"calc(-1.175em - 1px)", 0);
82+
// entire width (moves the left border in place of the right) - (.675em (:before placement) + .5em (half :before width)) - 1px (:before border)
83+
transform: translate(~"calc(100% - 1.175em - 1px)", 0);
8484

8585
&::before {
8686
top: auto;
@@ -90,8 +90,8 @@
9090
}
9191

9292
&.left-aligned {
93-
// entire width (moves the right border in place of the left) + (.675em (:before placement) + .5em (half :before width)) + 1px (:before border)
94-
transform: translate(~"calc(-100% + 1.175em + 1px)", 0);
93+
// This is (.675em (:before placement) + .5em (half :before width)) + 1px (:before border)
94+
transform: translate(~"calc(1.175em + 1px)", 0);
9595

9696
&::before {
9797
top: auto;
@@ -102,6 +102,10 @@
102102
}
103103
}
104104

105+
.left .bubble {
106+
transform: translate(-50%, 0);
107+
}
108+
105109
.above .positioned {
106110
bottom: 0;
107111
}

public/css/widget/check-statistics.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
display: inline-flex;
88
}
99

10-
.bubble {
10+
&.progress-bar .bubble {
1111
&.top-left-aligned,
1212
&.top-right-aligned {
1313
&::before {

0 commit comments

Comments
 (0)