diff --git a/library/Director/Web/Table/DbHelper.php b/library/Director/Web/Table/DbHelper.php index 0febf717..6e5d9b83 100644 --- a/library/Director/Web/Table/DbHelper.php +++ b/library/Director/Web/Table/DbHelper.php @@ -50,6 +50,10 @@ trait DbHelper public function getShortChecksum($checksum) { + if ($checksum === null) { + return null; + } + return substr($this->getChecksum($checksum), 0, 7); } } diff --git a/library/Director/Web/Table/DeploymentLogTable.php b/library/Director/Web/Table/DeploymentLogTable.php index 74bd7d0b..9c24e416 100644 --- a/library/Director/Web/Table/DeploymentLogTable.php +++ b/library/Director/Web/Table/DeploymentLogTable.php @@ -30,7 +30,7 @@ class DeploymentLogTable extends ZfQueryBasedTable $shortSum = $this->getShortChecksum($row->config_checksum); $tr = $this::tr([ $this::td(Link::create( - [$row->peer_identity, " ($shortSum)"], + $shortSum === null ? $row->peer_identity : [$row->peer_identity, " ($shortSum)"], 'director/deployment', ['id' => $row->id] )), diff --git a/library/Director/Web/Widget/DeploymentInfo.php b/library/Director/Web/Widget/DeploymentInfo.php index a9310386..8d6576ac 100644 --- a/library/Director/Web/Widget/DeploymentInfo.php +++ b/library/Director/Web/Widget/DeploymentInfo.php @@ -33,18 +33,18 @@ class DeploymentInfo extends HtmlDocument public function __construct(DirectorDeploymentLog $deployment) { $this->deployment = $deployment; - $this->config = IcingaConfig::load( - $deployment->config_checksum, - $deployment->getConnection() - ); + if ($deployment->get('config_checksum') !== null) { + $this->config = IcingaConfig::load( + $deployment->get('config_checksum'), + $deployment->getConnection() + ); + } } /** * @param Auth $auth * @param Request $request * @return Tabs - * @throws \Icinga\Exception\Http\HttpNotFoundException - * @throws \Icinga\Exception\ProgrammingError */ public function getTabs(Auth $auth, Request $request) { @@ -76,8 +76,14 @@ class DeploymentInfo extends HtmlDocument $table->addNameValuePairs([ $this->translate('Deployment time') => $dep->start_time, $this->translate('Sent to') => $dep->peer_identity, - $this->translate('Configuration') => $this->getConfigDetails(), - $this->translate('Duration') => $this->getDurationInfo(), + ]); + if ($this->config !== null) { + $table->addNameValuePairs([ + $this->translate('Configuration') => $this->getConfigDetails(), + $this->translate('Duration') => $this->getDurationInfo(), + ]); + } + $table->addNameValuePairs([ $this->translate('Stage name') => $dep->stage_name, $this->translate('Startup') => $this->getStartupInfo() ]); @@ -151,9 +157,6 @@ class DeploymentInfo extends HtmlDocument return parent::render(); } - /** - * @throws \Icinga\Exception\IcingaException - */ protected function addStartupLog() { $this->add(Html::tag('h2', null, $this->translate('Startup Log')));