DaemonController: use Hint for errors, formatting

This commit is contained in:
Thomas Gelf 2020-12-01 05:49:19 +01:00
parent d47506724d
commit db51fb4280
1 changed files with 10 additions and 5 deletions

View File

@ -2,6 +2,7 @@
namespace Icinga\Module\Director\Controllers; namespace Icinga\Module\Director\Controllers;
use gipfl\Web\Widget\Hint;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Module\Director\Daemon\RunningDaemonInfo; use Icinga\Module\Director\Daemon\RunningDaemonInfo;
use Icinga\Module\Director\Web\Tabs\MainTabs; use Icinga\Module\Director\Web\Tabs\MainTabs;
@ -44,16 +45,20 @@ class DaemonController extends ActionController
'75-Background-Daemon', '75-Background-Daemon',
$this->translate('Icinga Director Background Daemon') $this->translate('Icinga Director Background Daemon')
)); ));
$this->content()->add(Html::tag('p', ['class' => 'state-hint error'], [ $this->content()->add(Hint::error([
$message, $message,
($error ? [Html::tag('br'), Html::tag('strong', $error)] : ''), ($error ? [Html::tag('br'), Html::tag('strong', $error)] : null),
])); ]));
return; return;
} }
try {
foreach ($daemons as $daemon) { foreach ($daemons as $daemon) {
$info = new RunningDaemonInfo($daemon); $info = new RunningDaemonInfo($daemon);
$this->content()->add([new BackgroundDaemonDetails($info, $daemon) /*, $logWindow*/]); $this->content()->add([new BackgroundDaemonDetails($info, $daemon) /*, $logWindow*/]);
} }
} catch (\Exception $e) {
$this->content()->add(Hint::error($e->getMessage()));
}
} }
} }