From 5419d4428c86c488a43124f85e5407d7cbae6541 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:17:47 +0200 Subject: Adding upstream version 1.11.1. Signed-off-by: Daniel Baumann --- library/Director/Web/Widget/DeploymentInfo.php | 27 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'library/Director/Web/Widget/DeploymentInfo.php') diff --git a/library/Director/Web/Widget/DeploymentInfo.php b/library/Director/Web/Widget/DeploymentInfo.php index 110200f..1f87abc 100644 --- a/library/Director/Web/Widget/DeploymentInfo.php +++ b/library/Director/Web/Widget/DeploymentInfo.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Director\Web\Widget; +use Icinga\Module\Director\Auth\Permission; use ipl\Html\HtmlDocument; use Icinga\Authentication\Auth; use Icinga\Module\Director\IcingaConfig\IcingaConfig; @@ -55,7 +56,7 @@ class DeploymentInfo extends HtmlDocument 'url' => $request->getUrl() ))->activate('deployment'); - if ($dep->config_checksum !== null && $auth->hasPermission('director/showconfig')) { + if ($dep->config_checksum !== null && $auth->hasPermission(Permission::SHOW_CONFIG)) { $tabs->add('config', array( 'label' => $this->translate('Config'), 'url' => 'director/config/files', @@ -72,7 +73,8 @@ class DeploymentInfo extends HtmlDocument protected function createInfoTable() { $dep = $this->deployment; - $table = new NameValueTable(); + $table = (new NameValueTable()) + ->addAttributes(['class' => 'deployment-details']); $table->addNameValuePairs([ $this->translate('Deployment time') => $dep->start_time, $this->translate('Sent to') => $dep->peer_identity, @@ -135,16 +137,21 @@ class DeploymentInfo extends HtmlDocument } else { return [$this->translate('Unknown, failed to collect related information'), new Icon('help')]; } - } elseif ($dep->startup_succeeded === 'y') { - return $this->colored('green', [$this->translate('Succeeded'), new Icon('ok')]); } else { - return $this->colored('red', [$this->translate('Failed'), new Icon('cancel')]); - } - } + $div = Html::tag('div')->setSeparator(' '); - protected function colored($color, array $content) - { - return Html::tag('div', ['style' => "color: $color;"], $content)->setSeparator(' '); + if ($dep->startup_succeeded === 'y') { + $div + ->addAttributes(['class' => 'succeeded']) + ->add([$this->translate('Succeeded'), new Icon('ok')]); + } else { + $div + ->addAttributes(['class' => 'failed']) + ->add([$this->translate('Failed'), new Icon('cancel')]); + } + + return $div; + } } public function render() -- cgit v1.2.3