Skip to content

Commit

Permalink
RedundancyGroup: Don't wrap state msg into span and translate it wi…
Browse files Browse the repository at this point in the history
…th 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
  • Loading branch information
sukhwinder33445 committed Jan 22, 2025
1 parent 05ee3fc commit d185a1b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
15 changes: 10 additions & 5 deletions library/Icingadb/Widget/Detail/RedundancyGroupHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Icinga\Module\Icingadb\Model\RedundancyGroupSummary;
use Icinga\Module\Icingadb\Widget\DependencyNodeStatistics;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
use ipl\Web\Widget\StateBall;
Expand Down Expand Up @@ -37,14 +38,18 @@ protected function assembleVisual(BaseHtmlElement $visual): void

protected function assembleTitle(BaseHtmlElement $title): void
{
$title->addHtml($this->createSubject());
$subject = $this->createSubject();
if ($this->object->state->failed) {
$text = $this->translate('has no working objects');
$title->addHtml(Html::sprintf(
$this->translate('%s has no working objects', '<groupname> has ...'),
$subject
));
} else {
$text = $this->translate('has working objects');
$title->addHtml(Html::sprintf(
$this->translate('%s has working objects', '<groupname> has ...'),
$subject
));
}

$title->addHtml(HtmlElement::create('span', null, Text::create($text)));
}

protected function createStatistics(): BaseHtmlElement
Expand Down
15 changes: 10 additions & 5 deletions library/Icingadb/Widget/ItemList/RedundancyGroupListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Icinga\Module\Icingadb\Model\RedundancyGroupState;
use Icinga\Module\Icingadb\Widget\DependencyNodeStatistics;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Stdlib\Filter;
use ipl\Web\Url;
use ipl\Web\Widget\Link;
Expand Down Expand Up @@ -80,14 +81,18 @@ protected function assembleCaption(BaseHtmlElement $caption): void

protected function assembleTitle(BaseHtmlElement $title): void
{
$title->addHtml($this->createSubject());
$subject = $this->createSubject();
if ($this->state->failed) {
$text = $this->translate('has no working objects');
$title->addHtml(Html::sprintf(
$this->translate('%s has no working objects', '<groupname> has ...'),
$subject
));
} else {
$text = $this->translate('has working objects');
$title->addHtml(Html::sprintf(
$this->translate('%s has working objects', '<groupname> has ...'),
$subject
));
}

$title->addHtml(HtmlElement::create('span', null, Text::create($text)));
}

protected function assemble(): void
Expand Down
6 changes: 6 additions & 0 deletions public/css/list/redundancy-group-list-item.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@
font-size: 0.75em;
}
}

.item-list.default-layout .redundancy-group-list-item {
.title > .subject {
margin-right: .28125em;
}
}

0 comments on commit d185a1b

Please sign in to comment.