Skip to content

Commit 541ce9b

Browse files
committed
Add extra icons for different states
1 parent 0f70dfa commit 541ce9b

File tree

1 file changed

+44
-5
lines changed

1 file changed

+44
-5
lines changed

library/Icingadb/View/BaseHostAndServiceRenderer.php

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,19 +220,58 @@ 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 = $item->state->is_handled
238+
? $this->translate('Service "%s" on "%s" is handled by Downtime')
239+
: $this->translate('Service "%s" on "%s" is in Downtime');
240+
241+
$title = sprintf($message, $item->display_name, $item->host->display_name);
242+
} else {
243+
$message = $item->state->is_handled
244+
? $this->translate('Host "%s" is handled by Downtime')
245+
: $this->translate('Host "%s" is in Downtime');
246+
247+
$title = sprintf($message, $item->display_name);
248+
}
249+
250+
$statusIcons->addHtml(new Icon(Icons::IN_DOWNTIME, ['title' => $title]));
251+
}
252+
223253
if ($item->state->is_flapping) {
224254
$title = $isService
225255
? sprintf(
226256
$this->translate('Service "%s" on "%s" is in flapping state'),
227257
$item->display_name,
228258
$item->host->display_name
229259
)
230-
: sprintf(
231-
$this->translate('Host "%s" is in flapping state'),
232-
$item->display_name
233-
);
260+
: sprintf($this->translate('Host "%s" is in flapping state'), $item->display_name);
261+
262+
$statusIcons->addHtml(new Icon(Icons::IS_FLAPPING, ['title' => $title]));
263+
}
264+
265+
if (! $item->state->is_reachable) {
266+
$title = $isService
267+
? sprintf(
268+
$this->translate('Service "%s" on "%s" is unreachable'),
269+
$item->display_name,
270+
$item->host->display_name
271+
)
272+
: sprintf($this->translate('Host "%s" is unreachable'), $item->display_name);
234273

235-
$statusIcons->addHtml(new Icon('random', ['title' => $title]));
274+
$statusIcons->addHtml(new Icon(Icons::HOST_DOWN, ['title' => $title]));
236275
}
237276

238277
if (! $item->notifications_enabled) {

0 commit comments

Comments
 (0)