-
Notifications
You must be signed in to change notification settings - Fork 29
Add more state pictograms #1271
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
base: feature/state-pictogram-tooltips
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,7 +96,7 @@ public function assembleVisual($item, HtmlDocument $visual, string $layout): voi | |
| } | ||
| } | ||
|
|
||
| $stateChange->setIcon($item->state->getIcon()); | ||
| $stateChange->setIcon($this->getStateBallIcon($item)); | ||
| $stateChange->setHandled( | ||
| $item->state->is_problem && ($item->state->is_handled || ! $item->state->is_reachable) | ||
| ); | ||
|
|
@@ -109,7 +109,7 @@ public function assembleVisual($item, HtmlDocument $visual, string $layout): voi | |
| $ballSize = $layout === 'minimal' ? StateBall::SIZE_BIG : StateBall::SIZE_LARGE; | ||
|
|
||
| $stateBall = new StateBall($item->state->getStateText(), $ballSize); | ||
| $stateBall->add($item->state->getIcon()); | ||
| $stateBall->add($this->getStateBallIcon($item)); | ||
| if ($item->state->is_problem && ($item->state->is_handled || ! $item->state->is_reachable)) { | ||
| $stateBall->getAttributes()->add('class', 'handled'); | ||
| } | ||
|
|
@@ -274,13 +274,13 @@ public function assembleFooter($item, HtmlDocument $footer, string $layout): voi | |
|
|
||
| if (! $item->notifications_enabled) { | ||
| $statusIcons->addHtml( | ||
| new Icon('bell-slash', ['title' => $this->translate('Notifications disabled')]) | ||
| new Icon(Icons::NO_NOTIFICATIONS, ['title' => $this->translate('Notifications disabled')]) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be consistent with other icons in the footer and improve accessibility, please add |
||
| ); | ||
| } | ||
|
|
||
| if (! $item->active_checks_enabled) { | ||
| $statusIcons->addHtml( | ||
| new Icon('eye-slash', ['title' => $this->translate('Active checks disabled')]) | ||
| new Icon(Icons::NO_ACTIVE_CHECKS, ['title' => $this->translate('Active checks disabled')]) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be consistent with other icons in the footer and improve accessibility, please add |
||
| ); | ||
| } | ||
|
|
||
|
|
@@ -336,4 +336,19 @@ public function assemble($item, string $name, HtmlDocument $element, string $lay | |
|
|
||
| return false; | ||
| } | ||
|
|
||
| protected function getStateBallIcon($item): ?Icon | ||
| { | ||
| $icon = $item->state->getIcon(); | ||
|
|
||
| if ($icon === null) { | ||
| if (! $item->notifications_enabled) { | ||
| $icon = new Icon(Icons::NO_NOTIFICATIONS, ['title' => $this->translate('Notifications disabled')]); | ||
| } elseif (! $item->active_checks_enabled) { | ||
| $icon = new Icon(Icons::NO_ACTIVE_CHECKS, ['title' => $this->translate('Active checks disabled')]); | ||
| } | ||
| } | ||
|
Comment on lines
+344
to
+350
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These icons are still missing in the specific |
||
|
|
||
| return $icon; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using
NOTIFICATIONS_DISABLED | ACTIVE_CHECKS_DISABLED, as it fits better and describes the variable more clearly.