mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
parent
52e412002f
commit
54643fe5cd
@ -102,6 +102,25 @@ class IcingaCommandArgumentForm extends DirectorObjectForm
|
||||
$this->setButtons();
|
||||
}
|
||||
|
||||
protected function deleteObject($object)
|
||||
{
|
||||
$cmd = $this->commandObject;
|
||||
|
||||
$msg = sprintf(
|
||||
'%s argument "%s" has been removed',
|
||||
$this->translate($this->getObjectName()),
|
||||
$object->argument_name
|
||||
);
|
||||
|
||||
$url = $this->getSuccessUrl()->without('argument_id');
|
||||
|
||||
$cmd->arguments()->remove($object->argument_name);
|
||||
if ($cmd->store()) {
|
||||
$this->setSuccessUrl($url);
|
||||
}
|
||||
|
||||
$this->redirectOnSuccess($msg);
|
||||
}
|
||||
|
||||
public function onSuccess()
|
||||
{
|
||||
|
@ -228,11 +228,12 @@ class IcingaArguments implements Iterator, Countable, IcingaConfigRenderer
|
||||
public function remove($argument)
|
||||
{
|
||||
if (array_key_exists($argument, $this->arguments)) {
|
||||
unset($this->arguments[$argument]);
|
||||
$this->arguments[$argument]->markForRemoval();
|
||||
$this->modified = true;
|
||||
$this->refreshIndex();
|
||||
}
|
||||
|
||||
$this->modified = true;
|
||||
$this->refreshIndex();
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function refreshIndex()
|
||||
@ -340,8 +341,6 @@ class IcingaArguments implements Iterator, Countable, IcingaConfigRenderer
|
||||
$deleted = array();
|
||||
foreach ($this->arguments as $key => $argument) {
|
||||
if ($argument->shouldBeRemoved()) {
|
||||
$argument->delete();
|
||||
unset($this->arguments[$key]);
|
||||
$deleted[] = $key;
|
||||
} else {
|
||||
$argument->command_id = $this->object->id;
|
||||
@ -350,6 +349,7 @@ class IcingaArguments implements Iterator, Countable, IcingaConfigRenderer
|
||||
}
|
||||
|
||||
foreach ($deleted as $key) {
|
||||
$this->arguments[$key]->delete();
|
||||
unset($this->arguments[$key]);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user