diff --git a/library/Icingadb/Model/State.php b/library/Icingadb/Model/State.php index c346cd262..2f934864f 100644 --- a/library/Icingadb/Model/State.php +++ b/library/Icingadb/Model/State.php @@ -151,31 +151,30 @@ public function getIcon(): ?Icon $icon = null; switch (true) { case $this->is_acknowledged: - $icon = new Icon(Icons::IS_ACKNOWLEDGED); + $icon = new Icon(Icons::IS_ACKNOWLEDGED, [ + 'title' => sprintf('%s (%s)', strtoupper($this->getStateTextTranslated()), t('is acknowledged')) + ]); break; case $this->in_downtime: - $icon = new Icon( - Icons::IN_DOWNTIME, - ['title' => sprintf( + $icon = new Icon(Icons::IN_DOWNTIME, [ + 'title' => sprintf( '%s (%s)', strtoupper($this->getStateTextTranslated()), $this->is_handled ? t('handled by Downtime') : t('in Downtime') - )] - ); + ) + ]); break; case $this->is_flapping: - $icon = new Icon(Icons::IS_FLAPPING); + $icon = new Icon(Icons::IS_FLAPPING, [ + 'title' => sprintf('%s (%s)', strtoupper($this->getStateTextTranslated()), t('is flapping')) + ]); break; case ! $this->is_reachable: $icon = new Icon(Icons::HOST_DOWN, [ - 'title' => sprintf( - '%s (%s)', - strtoupper($this->getStateTextTranslated()), - t('is unreachable') - ) + 'title' => sprintf('%s (%s)', strtoupper($this->getStateTextTranslated()), t('is unreachable')) ]); break; diff --git a/library/Icingadb/View/BaseHostAndServiceRenderer.php b/library/Icingadb/View/BaseHostAndServiceRenderer.php index 91a969a74..a3f293817 100644 --- a/library/Icingadb/View/BaseHostAndServiceRenderer.php +++ b/library/Icingadb/View/BaseHostAndServiceRenderer.php @@ -220,6 +220,36 @@ public function assembleFooter($item, HtmlDocument $footer, string $layout): voi ); } + if ($item->state->is_acknowledged) { + $title = $isService + ? sprintf( + $this->translate('Service "%s" on "%s" is acknowledged'), + $item->display_name, + $item->host->display_name + ) + : sprintf($this->translate('Host "%s" is acknowledged'), $item->display_name); + + $statusIcons->addHtml(new Icon(Icons::IS_ACKNOWLEDGED, ['title' => $title])); + } + + if ($item->state->in_downtime) { + if ($isService) { + $message = $item->state->is_handled + ? $this->translate('Service "%s" on "%s" is handled by Downtime') + : $this->translate('Service "%s" on "%s" is in Downtime'); + + $title = sprintf($message, $item->display_name, $item->host->display_name); + } else { + $message = $item->state->is_handled + ? $this->translate('Host "%s" is handled by Downtime') + : $this->translate('Host "%s" is in Downtime'); + + $title = sprintf($message, $item->display_name); + } + + $statusIcons->addHtml(new Icon(Icons::IN_DOWNTIME, ['title' => $title])); + } + if ($item->state->is_flapping) { $title = $isService ? sprintf( @@ -227,12 +257,21 @@ public function assembleFooter($item, HtmlDocument $footer, string $layout): voi $item->display_name, $item->host->display_name ) - : sprintf( - $this->translate('Host "%s" is in flapping state'), - $item->display_name - ); + : sprintf($this->translate('Host "%s" is in flapping state'), $item->display_name); + + $statusIcons->addHtml(new Icon(Icons::IS_FLAPPING, ['title' => $title])); + } + + if (! $item->state->is_reachable) { + $title = $isService + ? sprintf( + $this->translate('Service "%s" on "%s" is unreachable'), + $item->display_name, + $item->host->display_name + ) + : sprintf($this->translate('Host "%s" is unreachable'), $item->display_name); - $statusIcons->addHtml(new Icon('random', ['title' => $title])); + $statusIcons->addHtml(new Icon(Icons::HOST_DOWN, ['title' => $title])); } if (! $item->notifications_enabled) {