Skip to content

Commit efe8d77

Browse files
RedundancyGroup: Don't wrap state msg into span and translate it with context
This msg should be handled same as the host <is/on> word, no element wrapping. This way, the margin arround the msg is applied properly. - Add the missing margin-right to subject in case of `.default-layout` list
1 parent ebdb48a commit efe8d77

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

library/Icingadb/Widget/Detail/RedundancyGroupHeader.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Icinga\Module\Icingadb\Model\RedundancyGroupSummary;
99
use Icinga\Module\Icingadb\Widget\DependencyNodeStatistics;
1010
use ipl\Html\BaseHtmlElement;
11+
use ipl\Html\Html;
1112
use ipl\Html\HtmlElement;
1213
use ipl\Html\Text;
1314
use ipl\Web\Widget\StateBall;
@@ -37,14 +38,18 @@ protected function assembleVisual(BaseHtmlElement $visual): void
3738

3839
protected function assembleTitle(BaseHtmlElement $title): void
3940
{
40-
$title->addHtml($this->createSubject());
41+
$subject = $this->createSubject();
4142
if ($this->object->state->failed) {
42-
$text = $this->translate('has no working objects');
43+
$title->addHtml(Html::sprintf(
44+
$this->translate('%s has no working objects', '<groupname> has ...'),
45+
$subject
46+
));
4347
} else {
44-
$text = $this->translate('has working objects');
48+
$title->addHtml(Html::sprintf(
49+
$this->translate('%s has working objects', '<groupname> has ...'),
50+
$subject
51+
));
4552
}
46-
47-
$title->addHtml(HtmlElement::create('span', null, Text::create($text)));
4853
}
4954

5055
protected function createStatistics(): BaseHtmlElement

library/Icingadb/Widget/ItemList/RedundancyGroupListItem.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Icinga\Module\Icingadb\Model\RedundancyGroupState;
1313
use Icinga\Module\Icingadb\Widget\DependencyNodeStatistics;
1414
use ipl\Html\BaseHtmlElement;
15+
use ipl\Html\Html;
1516
use ipl\Stdlib\Filter;
1617
use ipl\Web\Url;
1718
use ipl\Web\Widget\Link;
@@ -80,14 +81,18 @@ protected function assembleCaption(BaseHtmlElement $caption): void
8081

8182
protected function assembleTitle(BaseHtmlElement $title): void
8283
{
83-
$title->addHtml($this->createSubject());
84+
$subject = $this->createSubject();
8485
if ($this->state->failed) {
85-
$text = $this->translate('has no working objects');
86+
$title->addHtml(Html::sprintf(
87+
$this->translate('%s has no working objects', '<groupname> has ...'),
88+
$subject
89+
));
8690
} else {
87-
$text = $this->translate('has working objects');
91+
$title->addHtml(Html::sprintf(
92+
$this->translate('%s has working objects', '<groupname> has ...'),
93+
$subject
94+
));
8895
}
89-
90-
$title->addHtml(HtmlElement::create('span', null, Text::create($text)));
9196
}
9297

9398
protected function assemble(): void

public/css/list/redundancy-group-list-item.less

+6
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@
99
font-size: 0.75em;
1010
}
1111
}
12+
13+
.item-list.default-layout > .redundancy-group-list-item {
14+
.title > .subject {
15+
margin-right: .28125em;
16+
}
17+
}

0 commit comments

Comments
 (0)