@@ -96,7 +96,7 @@ public function assembleVisual($item, HtmlDocument $visual, string $layout): voi
9696 }
9797 }
9898
99- $ stateChange ->setIcon ($ item -> state -> getIcon ( ));
99+ $ stateChange ->setIcon ($ this -> getStateBallIcon ( $ item ));
100100 $ stateChange ->setHandled (
101101 $ item ->state ->is_problem && ($ item ->state ->is_handled || ! $ item ->state ->is_reachable )
102102 );
@@ -109,7 +109,7 @@ public function assembleVisual($item, HtmlDocument $visual, string $layout): voi
109109 $ ballSize = $ layout === 'minimal ' ? StateBall::SIZE_BIG : StateBall::SIZE_LARGE ;
110110
111111 $ stateBall = new StateBall ($ item ->state ->getStateText (), $ ballSize );
112- $ stateBall ->add ($ item -> state -> getIcon ( ));
112+ $ stateBall ->add ($ this -> getStateBallIcon ( $ item ));
113113 if ($ item ->state ->is_problem && ($ item ->state ->is_handled || ! $ item ->state ->is_reachable )) {
114114 $ stateBall ->getAttributes ()->add ('class ' , 'handled ' );
115115 }
@@ -274,13 +274,13 @@ public function assembleFooter($item, HtmlDocument $footer, string $layout): voi
274274
275275 if (! $ item ->notifications_enabled ) {
276276 $ statusIcons ->addHtml (
277- new Icon (' bell-slash ' , ['title ' => $ this ->translate ('Notifications disabled ' )])
277+ new Icon (Icons:: NO_NOTIFICATIONS , ['title ' => $ this ->translate ('Notifications disabled ' )])
278278 );
279279 }
280280
281281 if (! $ item ->active_checks_enabled ) {
282282 $ statusIcons ->addHtml (
283- new Icon (' eye-slash ' , ['title ' => $ this ->translate ('Active checks disabled ' )])
283+ new Icon (Icons:: NO_ACTIVE_CHECKS , ['title ' => $ this ->translate ('Active checks disabled ' )])
284284 );
285285 }
286286
@@ -336,4 +336,19 @@ public function assemble($item, string $name, HtmlDocument $element, string $lay
336336
337337 return false ;
338338 }
339+
340+ protected function getStateBallIcon ($ item ): ?Icon
341+ {
342+ $ icon = $ item ->state ->getIcon ();
343+
344+ if ($ icon === null ) {
345+ if (! $ item ->notifications_enabled ) {
346+ $ icon = new Icon (Icons::NO_NOTIFICATIONS , ['title ' => $ this ->translate ('Notifications disabled ' )]);
347+ } elseif (! $ item ->active_checks_enabled ) {
348+ $ icon = new Icon (Icons::NO_ACTIVE_CHECKS , ['title ' => $ this ->translate ('Active checks disabled ' )]);
349+ }
350+ }
351+
352+ return $ icon ;
353+ }
339354}
0 commit comments