Skip to content

Commit 066cae1

Browse files
committed
Add extra icons for different states
1 parent 85b3c6e commit 066cae1

File tree

1 file changed

+48
-5
lines changed

1 file changed

+48
-5
lines changed

library/Icingadb/View/BaseHostAndServiceRenderer.php

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,19 +220,62 @@ public function assembleFooter($item, HtmlDocument $footer, string $layout): voi
220220
);
221221
}
222222

223+
if ($item->state->is_acknowledged) {
224+
$title = $isService
225+
? sprintf(
226+
$this->translate('Service "%s" on "%s" is acknowledged'),
227+
$item->display_name,
228+
$item->host->display_name
229+
)
230+
: sprintf($this->translate('Host "%s" is acknowledged'), $item->display_name);
231+
232+
$statusIcons->addHtml(new Icon(Icons::IS_ACKNOWLEDGED, ['title' => $title]));
233+
}
234+
235+
if ($item->state->in_downtime) {
236+
if ($isService) {
237+
$message = $this->translate(
238+
$item->state->is_handled
239+
? 'Service "%s" on "%s" is handled by Downtime'
240+
: 'Service "%s" on "%s" is in Downtime'
241+
);
242+
243+
$title = sprintf($message, $item->display_name, $item->host->display_name);
244+
} else {
245+
$message = $this->translate(
246+
$item->state->is_handled
247+
? 'Host "%s" is handled by Downtime'
248+
: 'Host "%s" is in Downtime'
249+
);
250+
251+
$title = sprintf($message, $item->display_name);
252+
}
253+
254+
$statusIcons->addHtml(new Icon(Icons::IN_DOWNTIME, ['title' => $title]));
255+
}
256+
223257
if ($item->state->is_flapping) {
224258
$title = $isService
225259
? sprintf(
226260
$this->translate('Service "%s" on "%s" is in flapping state'),
227261
$item->display_name,
228262
$item->host->display_name
229263
)
230-
: sprintf(
231-
$this->translate('Host "%s" is in flapping state'),
232-
$item->display_name
233-
);
264+
: sprintf($this->translate('Host "%s" is in flapping state'), $item->display_name);
265+
266+
$statusIcons->addHtml(new Icon(Icons::IS_FLAPPING, ['title' => $title]));
267+
}
268+
269+
if (! $item->state->is_reachable) {
270+
$title = $isService
271+
? sprintf(
272+
$this->translate('Service "%s" on "%s" is unreachable'),
273+
$item->display_name,
274+
$item->host->display_name
275+
)
276+
: sprintf($this->translate('Host "%s" is unreachable'), $item->display_name);
234277

235-
$statusIcons->addHtml(new Icon('random', ['title' => $title]));
278+
$statusIcons->addHtml(new Icon(Icons::HOST_DOWN, ['title' => $title]));
236279
}
237280

238281
if (! $item->notifications_enabled) {

0 commit comments

Comments
 (0)