@@ -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 }
@@ -273,15 +273,27 @@ public function assembleFooter($item, HtmlDocument $footer, string $layout): voi
273273 }
274274
275275 if (! $ item ->notifications_enabled ) {
276- $ statusIcons ->addHtml (
277- new Icon ('bell-slash ' , ['title ' => $ this ->translate ('Notifications disabled ' )])
278- );
276+ $ title = $ isService
277+ ? sprintf (
278+ $ this ->translate ('Service "%s" on "%s" has notifications disabled ' ),
279+ $ item ->display_name ,
280+ $ item ->host ->display_name
281+ )
282+ : sprintf ($ this ->translate ('Host "%s" has notifications disabled ' ), $ item ->display_name );
283+
284+ $ statusIcons ->addHtml (new Icon (Icons::NOTIFICATIONS_DISABLED , ['title ' => $ title ]));
279285 }
280286
281287 if (! $ item ->active_checks_enabled ) {
282- $ statusIcons ->addHtml (
283- new Icon ('eye-slash ' , ['title ' => $ this ->translate ('Active checks disabled ' )])
284- );
288+ $ title = $ isService
289+ ? sprintf (
290+ $ this ->translate ('Service "%s" on "%s" has active checks disabled ' ),
291+ $ item ->display_name ,
292+ $ item ->host ->display_name
293+ )
294+ : sprintf ($ this ->translate ('Host "%s" has active checks disabled ' ), $ item ->display_name );
295+
296+ $ statusIcons ->addHtml (new Icon (Icons::ACTIVE_CHECKS_DISABLED , ['title ' => $ title ]));
285297 }
286298
287299 $ performanceData = new HtmlElement ('div ' , Attributes::create (['class ' => 'performance-data ' ]));
@@ -336,4 +348,31 @@ public function assemble($item, string $name, HtmlDocument $element, string $lay
336348
337349 return false ;
338350 }
351+
352+ protected function getStateBallIcon ($ item ): ?Icon
353+ {
354+ $ icon = $ item ->state ->getIcon ();
355+
356+ if ($ icon === null ) {
357+ if (! $ item ->notifications_enabled ) {
358+ $ icon = new Icon (Icons::NOTIFICATIONS_DISABLED , [
359+ 'title ' => sprintf (
360+ '%s (%s) ' ,
361+ strtoupper ($ item ->state ->getStateTextTranslated ()),
362+ $ this ->translate ('has notifications disabled ' )
363+ )
364+ ]);
365+ } elseif (! $ item ->active_checks_enabled ) {
366+ $ icon = new Icon (Icons::ACTIVE_CHECKS_DISABLED , [
367+ 'title ' => sprintf (
368+ '%s (%s) ' ,
369+ strtoupper ($ item ->state ->getStateTextTranslated ()),
370+ $ this ->translate ('has active checks disabled ' )
371+ )
372+ ]);
373+ }
374+ }
375+
376+ return $ icon ;
377+ }
339378}
0 commit comments