Skip to content

Commit e5a62f7

Browse files
authored
Merge pull request #164 from Icinga/fix/icinga-state-reason-shifts
Fix icinga state reason shift problems
2 parents c8841d3 + dce3f52 commit e5a62f7

4 files changed

Lines changed: 40 additions & 21 deletions

File tree

library/Kubernetes/Web/Widget/HighlightDelta.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ class HighlightDelta extends BaseHtmlElement
1616

1717
public function __construct(
1818
protected string $long,
19-
protected string $short
19+
protected string $short,
20+
?Attributes $attributes = null
2021
) {
2122
if (!str_contains($long, $short)) {
2223
throw new InvalidArgumentException('Short name must be part of long name');
2324
}
25+
26+
$this->addAttributes($attributes);
2427
}
2528

2629
public function assemble(): void

library/Kubernetes/Web/Widget/IcingaStateReason/IcingaStateReasonRow.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,21 @@ public function __construct(
3131
public function assemble(): void
3232
{
3333
$this->addHtml(
34-
new StateBall(strtolower($this->state), StateBall::SIZE_MEDIUM),
35-
Factory::createIcon($this->kind),
3634
new HtmlElement(
3735
'span',
38-
new Attributes(['class' => 'text']),
39-
(new HighlightDelta($this->name, $this->parentName ?? ''))
40-
->addAttributes(['class' => 'tooltip-holder', 'title' => $this->tooltip]),
41-
new HtmlElement('span', new Attributes(['class' => 'reason']), new Text($this->reason))
36+
new Attributes(['class' => 'icon-container']),
37+
new StateBall(strtolower($this->state), StateBall::SIZE_MEDIUM),
38+
Factory::createIcon($this->kind)
39+
),
40+
new HtmlElement(
41+
'span',
42+
new Attributes(['class' => 'reason']),
43+
new HighlightDelta(
44+
$this->name,
45+
$this->parentName ?? '',
46+
new Attributes(['class' => 'tooltip-holder', 'title' => $this->tooltip])
47+
),
48+
new Text(' ' . $this->reason)
4249
)
4350
);
4451
}

public/css/common.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ pre {
2424
}
2525

2626
.container-list-item > .visual > .state-ball,
27-
.container-list-item .caption .icinga-state-reason > .state-ball,
28-
.container-row > .state-ball,
27+
.container-list-item .caption .icinga-state-reason > .icon-container > .state-ball,
28+
.container-row > .icon-container > .state-ball,
2929
.container-detail > .details > .horizontal-key-value > .value > .state-ball,
30-
.container-detail > section > .icinga-state-reason > .state-ball {
30+
.container-detail > section > .icinga-state-reason > .icon-container > .state-ball {
3131
// Display squares instead of balls for containers.
3232
border-radius: initial;
3333
}
Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
.icinga-state-reason {
2+
.icon-container {
3+
display: flex;
4+
align-items: center;
5+
}
26
.state-ball {
37
flex-shrink: 0;
48
margin-right: .4em;
59
}
610

711
.row {
812
display: flex;
9-
align-items: center;
13+
align-items: flex-start;
1014

11-
.text {
12-
display: flex;
13-
gap: .25em;
15+
.reason {
1416
color: @text-color-light;
15-
.text-ellipsis();
1617
}
1718

1819
.highlight-text {
@@ -24,15 +25,23 @@
2425
.object-detail :not(.caption) > .icinga-state-reason {
2526
line-height: 1.75em;
2627

27-
.reason {
28-
color: @text-color-light;
28+
.icon-container {
29+
height: 1.75em;
2930
}
3031
}
3132

3233
.caption > .icinga-state-reason {
3334
font-size: 0.91666667em;
3435
line-height: 1.63636364em;
3536

37+
.icon-container {
38+
height: 1.63636364em;
39+
}
40+
41+
.reason {
42+
.text-ellipsis();
43+
}
44+
3645
.tooltip-holder {
3746
pointer-events: none;
3847
}
@@ -41,17 +50,17 @@
4150
.workload-rows,
4251
.pod-rows,
4352
.container-rows {
44-
transform: translateX(.75em);
53+
margin-left: .75em;
4554

4655
.row:before {
4756
content: '';
4857

49-
width: 1em;
58+
min-width: 1em;
5059
height: 1em;
5160
border-left: 1px solid @gray-light;
5261
border-bottom: 1px solid @gray-light;
5362

54-
transform: translateX(~"calc(-.375em - 0.5px)") translateY(~"calc(-0.5em + 0.5px)");
63+
transform: translateX(~"calc(-.375em - 0.5px)") translateY(-1px);
5564
}
5665
}
5766

@@ -65,5 +74,5 @@
6574
.workload-rows .pod-rows,
6675
.pod-rows .container-rows {
6776
// level-indicator (1em) + state-ball margin (0.4em) + half state-ball size m (0.375em)
68-
transform: translateX(~"calc(" 1em + .4em + .375em ~"- 0.5px)");
77+
margin-left: ~"calc(" 1em + .4em + .375em ~"- 0.5px)";
6978
}

0 commit comments

Comments
 (0)