From db51fb4280abb59786ccaa59a78f75150da57cf3 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 1 Dec 2020 05:49:19 +0100 Subject: [PATCH] DaemonController: use Hint for errors, formatting --- application/controllers/DaemonController.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/application/controllers/DaemonController.php b/application/controllers/DaemonController.php index 3d17c682..ab0038fd 100644 --- a/application/controllers/DaemonController.php +++ b/application/controllers/DaemonController.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Director\Controllers; +use gipfl\Web\Widget\Hint; use Icinga\Application\Icinga; use Icinga\Module\Director\Daemon\RunningDaemonInfo; use Icinga\Module\Director\Web\Tabs\MainTabs; @@ -44,16 +45,20 @@ class DaemonController extends ActionController '75-Background-Daemon', $this->translate('Icinga Director Background Daemon') )); - $this->content()->add(Html::tag('p', ['class' => 'state-hint error'], [ + $this->content()->add(Hint::error([ $message, - ($error ? [Html::tag('br'), Html::tag('strong', $error)] : ''), + ($error ? [Html::tag('br'), Html::tag('strong', $error)] : null), ])); return; } - foreach ($daemons as $daemon) { - $info = new RunningDaemonInfo($daemon); - $this->content()->add([new BackgroundDaemonDetails($info, $daemon) /*, $logWindow*/]); + try { + foreach ($daemons as $daemon) { + $info = new RunningDaemonInfo($daemon); + $this->content()->add([new BackgroundDaemonDetails($info, $daemon) /*, $logWindow*/]); + } + } catch (\Exception $e) { + $this->content()->add(Hint::error($e->getMessage())); } } }