Skip to content

Commit 6a39bfc

Browse files
committed
Add extra icons for different states
1 parent ebc5d86 commit 6a39bfc

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

library/Icingadb/Common/Icons.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Icons
1616

1717
const IS_ACKNOWLEDGED = 'check';
1818

19-
const IS_FLAPPING = 'bolt';
19+
const IS_FLAPPING = 'random';
2020

2121
const IS_PERSISTENT = 'thumbtack';
2222

library/Icingadb/View/BaseHostAndServiceRenderer.php

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,19 +220,56 @@ 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+
? 'Service "%s" on "%s" is handled by Downtime'
239+
: 'Service "%s" on "%s" is in Downtime';
240+
241+
$title = sprintf($this->translate($message), $item->display_name, $item->host->display_name);
242+
} else {
243+
$message = $item->state->is_handled ? 'Host "%s" is handled by Downtime' : 'Host "%s" is in Downtime';
244+
245+
$title = sprintf($this->translate($message), $item->display_name);
246+
}
247+
248+
$statusIcons->addHtml(new Icon(Icons::IN_DOWNTIME, ['title' => $title]));
249+
}
250+
223251
if ($item->state->is_flapping) {
224252
$title = $isService
225253
? sprintf(
226254
$this->translate('Service "%s" on "%s" is in flapping state'),
227255
$item->display_name,
228256
$item->host->display_name
229257
)
230-
: sprintf(
231-
$this->translate('Host "%s" is in flapping state'),
232-
$item->display_name
233-
);
258+
: sprintf($this->translate('Host "%s" is in flapping state'), $item->display_name);
259+
260+
$statusIcons->addHtml(new Icon(Icons::IS_FLAPPING, ['title' => $title]));
261+
}
262+
263+
if (! $item->state->is_reachable) {
264+
$title = $isService
265+
? sprintf(
266+
$this->translate('Service "%s" on "%s" is unreachable'),
267+
$item->display_name,
268+
$item->host->display_name
269+
)
270+
: sprintf($this->translate('Host "%s" is unreachable'), $item->display_name);
234271

235-
$statusIcons->addHtml(new Icon('random', ['title' => $title]));
272+
$statusIcons->add(new Icon(Icons::HOST_DOWN, ['title' => $title]));
236273
}
237274

238275
if (! $item->notifications_enabled) {

0 commit comments

Comments
 (0)