Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Affected objects indicator should not use StateBadge class #1077

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions library/Icingadb/Widget/ItemList/StateListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
use Icinga\Module\Icingadb\Widget\CheckAttempt;
use Icinga\Module\Icingadb\Widget\IconImage;
use Icinga\Module\Icingadb\Widget\PluginOutputContainer;
use ipl\Html\Attributes;
use ipl\Html\HtmlElement;
use ipl\Web\Common\BaseListItem;
use ipl\Web\Widget\EmptyState;
use ipl\Web\Widget\StateBadge;
use ipl\Web\Widget\TimeSince;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
Expand Down Expand Up @@ -96,7 +96,7 @@
));

if ($this->state->affects_children) {
$total = $this->item->affected_children;

Check failure on line 99 in library/Icingadb/Widget/ItemList/StateListItem.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Access to an undefined property object::$affected_children.

Check failure on line 99 in library/Icingadb/Widget/ItemList/StateListItem.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Access to an undefined property object::$affected_children.

Check failure on line 99 in library/Icingadb/Widget/ItemList/StateListItem.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Access to an undefined property object::$affected_children.

Check failure on line 99 in library/Icingadb/Widget/ItemList/StateListItem.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Access to an undefined property object::$affected_children.

Check failure on line 99 in library/Icingadb/Widget/ItemList/StateListItem.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Access to an undefined property object::$affected_children.

Check failure on line 99 in library/Icingadb/Widget/ItemList/StateListItem.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Access to an undefined property object::$affected_children.

Check failure on line 99 in library/Icingadb/Widget/ItemList/StateListItem.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Access to an undefined property object::$affected_children.

if ((int) $total > 1000) {
$total = '1000+';
Expand All @@ -104,12 +104,15 @@

$icon = new Icon(Icons::UNREACHABLE);

$title->addHtml((new StateBadge([$icon, Text::create($total)], ''))
->addAttributes([
$title->addHtml(new HtmlElement(
'span',
Attributes::create([
'class' => 'affected-objects',
'title' => sprintf(t('Up to %s affected objects'), $total)
])
);
]),
$icon,
Text::create($total)
));
}
}

Expand Down
1 change: 1 addition & 0 deletions public/css/common.less
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ form[name="form_confirm_removal"] {
.affected-objects {
display: inline-flex;
align-items: baseline;
border-radius: 0.4em;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a mixin for this, why not use it?

background-color: @state-critical;
color: @text-color-inverted;
padding: 0 0.25em;
Expand Down
Loading