Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions application/forms/DeploymentLinkForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Icinga\Exception\IcingaException;
use Icinga\Module\Director\Auth\Permission;
use Icinga\Module\Director\Core\DeploymentApiInterface;
use Icinga\Module\Director\Dashboard\Dashlet\DeploymentDashlet;
use Icinga\Module\Director\Db;
use Icinga\Module\Director\Deployment\DeploymentInfo;
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
Expand Down Expand Up @@ -83,20 +84,31 @@
);
}

$this->setAttrib('class', 'gipfl-inline-form');
$this->setAttrib('class', ['gipfl-inline-form', 'deployment-link-form']);
$this->addHtml(Icon::create('wrench'));

try {
// As this is shown for single objects, ignore errors caused by an
// unreachable core
$target = $this->shouldWarnAboutBug7530() ? '_self' : '_next';
} catch (\Exception $e) {
$target = '_next';
}
$this->addSubmitButton($this->translate('Deploy'), [

$lastDeploymentPending = (new DeploymentDashlet($this->db))->lastDeploymentPending();
$deployButtonAttributes = [
'class' => 'link-button icon-wrench',
'title' => $msg,
'data-base-target' => $target,
]);
];
if ($lastDeploymentPending) {
$deployButtonAttributes['disabled'] = 'disabled';
$deployButtonAttributes['title'] = $this->translate(
'There is an active deployment, please wait until it is finished'
);
}

$this->addSubmitButton($this->translate('Deploy'), $deployButtonAttributes);
}

protected function canDeploy()
Expand All @@ -104,7 +116,7 @@
return $this->auth->hasPermission(Permission::DEPLOY);
}

public function render(Zend_View_Interface $view = null)

Check failure on line 119 in application/forms/DeploymentLinkForm.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.4 on ubuntu-latest

Deprecated in PHP 8.4: Parameter #1 $view (Zend_View_Interface) is implicitly nullable via default value null.
{
if (! $this->canDeploy()) {
return '';
Expand Down
7 changes: 6 additions & 1 deletion library/Director/Web/Controller/ObjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Icinga\Exception\InvalidPropertyException;
use Icinga\Exception\NotFoundError;
use Icinga\Exception\ProgrammingError;
use Icinga\Module\Director\Dashboard\Dashlet\DeploymentDashlet;
use Icinga\Module\Director\Data\Db\DbObjectTypeRegistry;
use Icinga\Module\Director\Db\Branch\Branch;
use Icinga\Module\Director\Db\Branch\BranchedObject;
Expand Down Expand Up @@ -617,7 +618,11 @@ protected function addDeploymentLink()
$info,
$this->Auth(),
$this->api()
)->handleRequest()
)
->callOnSuccess(function (DeploymentLinkForm $form) {
$this->getResponse()->setHeader('X-Icinga-Extra-Updates', join(',', ['#col1']));
})
->handleRequest()
);
}
}
Expand Down
10 changes: 10 additions & 0 deletions public/css/module.less
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,16 @@ input[type=submit].icon-button {
}
}

form.deployment-link-form {
input[type=submit] {
&:disabled {
background-color: unset;
color: @disabled-gray;
cursor: default;
}
}
}

.breadcrumb {
> .critical a { color: @text-color-inverted; background: @color-critical; }
> .critical.handled a { color: @text-color-inverted; background: @color-critical-handled; }
Expand Down
Loading