IcingaServiceForm: no deactivate in branch for now

This commit is contained in:
Thomas Gelf 2022-09-20 12:04:46 +02:00
parent 1fbb4d93b6
commit 758b99126a

View File

@ -128,6 +128,8 @@ class IcingaServiceForm extends DirectorObjectForm
if (! $this->providesOverrides()) { if (! $this->providesOverrides()) {
return; return;
} }
$hasDeleteButton = false;
$isBranch = $this->branch && $this->branch->isBranch();
if ($this->hasBeenBlacklisted()) { if ($this->hasBeenBlacklisted()) {
$this->addHtml( $this->addHtml(
@ -135,7 +137,10 @@ class IcingaServiceForm extends DirectorObjectForm
['name' => 'HINT_blacklisted'] ['name' => 'HINT_blacklisted']
); );
$group = null; $group = null;
$this->addDeleteButton($this->translate('Reactivate')); if (! $isBranch) {
$this->addDeleteButton($this->translate('Reactivate'));
$hasDeleteButton = true;
}
$this->setSubmitLabel(false); $this->setSubmitLabel(false);
} else { } else {
$this->addOverrideHint(); $this->addOverrideHint();
@ -164,10 +169,13 @@ class IcingaServiceForm extends DirectorObjectForm
$this->setSubmitLabel(false); $this->setSubmitLabel(false);
} }
$this->addDeleteButton($this->translate('Deactivate')); if (! $isBranch) {
$this->addDeleteButton($this->translate('Deactivate'));
$hasDeleteButton = true;
}
} }
if (! $this->hasSubmitButton()) { if (! $this->hasSubmitButton() && $hasDeleteButton) {
$this->addDisplayGroup([$this->deleteButtonName], 'buttons', [ $this->addDisplayGroup([$this->deleteButtonName], 'buttons', [
'decorators' => [ 'decorators' => [
'FormElements', 'FormElements',