mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
IcingaCommandArgumentForm: branch support
This commit is contained in:
parent
09c9a9db72
commit
b59dab535e
@ -134,16 +134,22 @@ class IcingaCommandArgumentForm extends DirectorObjectForm
|
|||||||
$cmd = $this->commandObject;
|
$cmd = $this->commandObject;
|
||||||
|
|
||||||
$msg = sprintf(
|
$msg = sprintf(
|
||||||
'%s argument "%s" has been removed',
|
$this->translate('%s argument "%s" has been removed'),
|
||||||
$this->translate($this->getObjectShortClassName()),
|
$this->translate($this->getObjectShortClassName()),
|
||||||
$object->argument_name
|
$object->argument_name
|
||||||
);
|
);
|
||||||
|
|
||||||
$url = $this->getSuccessUrl()->without('argument_id');
|
// TODO: remove argument_id, once verified that it is no longer in use
|
||||||
|
$url = $this->getSuccessUrl()->without('argument_id')->without('argument');
|
||||||
|
|
||||||
$cmd->arguments()->remove($object->argument_name);
|
$cmd->arguments()->remove($object->argument_name);
|
||||||
if ($cmd->store()) {
|
if ($this->branch->isBranch()) {
|
||||||
|
$this->getDbObjectStore()->store($cmd);
|
||||||
$this->setSuccessUrl($url);
|
$this->setSuccessUrl($url);
|
||||||
|
} else {
|
||||||
|
if ($cmd->store()) {
|
||||||
|
$this->setSuccessUrl($url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirectOnSuccess($msg);
|
$this->redirectOnSuccess($msg);
|
||||||
@ -167,20 +173,17 @@ class IcingaCommandArgumentForm extends DirectorObjectForm
|
|||||||
$this->translate('The argument %s has successfully been stored'),
|
$this->translate('The argument %s has successfully been stored'),
|
||||||
$object->get('argument_name')
|
$object->get('argument_name')
|
||||||
);
|
);
|
||||||
$cmd->store($this->db);
|
$this->getDbObjectStore()->store($cmd);
|
||||||
} else {
|
} else {
|
||||||
if ($this->isApiRequest()) {
|
if ($this->isApiRequest()) {
|
||||||
$this->setHttpResponseCode(304);
|
$this->setHttpResponseCode(304);
|
||||||
}
|
}
|
||||||
$msg = $this->translate('No action taken, object has not been modified');
|
$msg = $this->translate('No action taken, object has not been modified');
|
||||||
}
|
}
|
||||||
$this->setSuccessUrl(
|
$this->setSuccessUrl('director/command/arguments', [
|
||||||
'director/command/arguments',
|
'argument' => $object->get('argument_name'),
|
||||||
[
|
'name' => $cmd->getObjectName()
|
||||||
'argument_id' => $object->get('id'),
|
]);
|
||||||
'name' => $cmd->getObjectName()
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->redirectOnSuccess($msg);
|
$this->redirectOnSuccess($msg);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user