@@ -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 }
@@ -275,15 +275,27 @@ public function assembleFooter($item, HtmlDocument $footer, string $layout): voi
275275 }
276276
277277 if (! $ item ->notifications_enabled ) {
278- $ statusIcons ->addHtml (
279- new Icon ('bell-slash ' , ['title ' => $ this ->translate ('Notifications disabled ' )])
280- );
278+ $ title = $ isService
279+ ? sprintf (
280+ $ this ->translate ('Service "%s" on "%s" has notifications disabled ' ),
281+ $ item ->display_name ,
282+ $ item ->host ->display_name
283+ )
284+ : sprintf ($ this ->translate ('Host "%s" has notifications disabled ' ), $ item ->display_name );
285+
286+ $ statusIcons ->addHtml (new Icon (Icons::NOTIFICATIONS_DISABLED , ['title ' => $ title ]));
281287 }
282288
283289 if (! $ item ->active_checks_enabled ) {
284- $ statusIcons ->addHtml (
285- new Icon ('eye-slash ' , ['title ' => $ this ->translate ('Active checks disabled ' )])
286- );
290+ $ title = $ isService
291+ ? sprintf (
292+ $ this ->translate ('Service "%s" on "%s" has active checks disabled ' ),
293+ $ item ->display_name ,
294+ $ item ->host ->display_name
295+ )
296+ : sprintf ($ this ->translate ('Host "%s" has active checks disabled ' ), $ item ->display_name );
297+
298+ $ statusIcons ->addHtml (new Icon (Icons::ACTIVE_CHECKS_DISABLED , ['title ' => $ title ]));
287299 }
288300
289301 $ performanceData = new HtmlElement ('div ' , Attributes::create (['class ' => 'performance-data ' ]));
@@ -338,4 +350,31 @@ public function assemble($item, string $name, HtmlDocument $element, string $lay
338350
339351 return false ;
340352 }
353+
354+ protected function getStateBallIcon ($ item ): ?Icon
355+ {
356+ $ icon = $ item ->state ->getIcon ();
357+
358+ if ($ icon === null ) {
359+ if (! $ item ->notifications_enabled ) {
360+ $ icon = new Icon (Icons::NOTIFICATIONS_DISABLED , [
361+ 'title ' => sprintf (
362+ '%s (%s) ' ,
363+ strtoupper ($ item ->state ->getStateTextTranslated ()),
364+ $ this ->translate ('has notifications disabled ' )
365+ )
366+ ]);
367+ } elseif (! $ item ->active_checks_enabled ) {
368+ $ icon = new Icon (Icons::ACTIVE_CHECKS_DISABLED , [
369+ 'title ' => sprintf (
370+ '%s (%s) ' ,
371+ strtoupper ($ item ->state ->getStateTextTranslated ()),
372+ $ this ->translate ('has active checks disabled ' )
373+ )
374+ ]);
375+ }
376+ }
377+
378+ return $ icon ;
379+ }
341380}
0 commit comments