Allow cloning service sets in Director Branches
This commit is contained in:
parent
d56ca2c235
commit
6c766dff43
|
@ -29,7 +29,12 @@ class IcingaCloneObjectForm extends DirectorForm
|
||||||
{
|
{
|
||||||
$isBranch = $this->branch && $this->branch->isBranch();
|
$isBranch = $this->branch && $this->branch->isBranch();
|
||||||
$branchOnly = $this->object->get('id') === null;
|
$branchOnly = $this->object->get('id') === null;
|
||||||
if ($isBranch && $this->object instanceof IcingaObject && $this->object->isTemplate()) {
|
|
||||||
|
if (
|
||||||
|
$isBranch
|
||||||
|
&& $this->object->isTemplate()
|
||||||
|
&& ! $this->object instanceof IcingaServiceSet
|
||||||
|
) {
|
||||||
$this->addHtml(Hint::error($this->translate(
|
$this->addHtml(Hint::error($this->translate(
|
||||||
'Templates cannot be cloned in Configuration Branches'
|
'Templates cannot be cloned in Configuration Branches'
|
||||||
)));
|
)));
|
||||||
|
@ -149,7 +154,12 @@ class IcingaCloneObjectForm extends DirectorForm
|
||||||
);
|
);
|
||||||
|
|
||||||
$isBranch = $this->branch && $this->branch->isBranch();
|
$isBranch = $this->branch && $this->branch->isBranch();
|
||||||
if ($object->isTemplate() && $isBranch) {
|
|
||||||
|
if (
|
||||||
|
$isBranch
|
||||||
|
&& $this->object->isTemplate()
|
||||||
|
&& ! $this->object instanceof IcingaServiceSet
|
||||||
|
) {
|
||||||
throw new IcingaException('Cloning templates is not available for Branches');
|
throw new IcingaException('Cloning templates is not available for Branches');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,8 +228,13 @@ class IcingaCloneObjectForm extends DirectorForm
|
||||||
$clone->set('host_id', $newId);
|
$clone->set('host_id', $newId);
|
||||||
}
|
}
|
||||||
} elseif ($new instanceof IcingaServiceSet) {
|
} elseif ($new instanceof IcingaServiceSet) {
|
||||||
$clone->set('service_set_id', $newId);
|
if ($isBranch) {
|
||||||
|
$clone->set('service_set', $newName);
|
||||||
|
} else {
|
||||||
|
$clone->set('service_set_id', $newId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$store->store($clone);
|
$store->store($clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,12 +218,14 @@ abstract class ObjectController extends ActionController
|
||||||
$this->addTitle($this->translate('Clone: %s'), $object->getObjectName())
|
$this->addTitle($this->translate('Clone: %s'), $object->getObjectName())
|
||||||
->addBackToObjectLink();
|
->addBackToObjectLink();
|
||||||
|
|
||||||
if ($object->isTemplate() && $this->showNotInBranch($this->translate('Cloning Templates'))) {
|
if (! $object instanceof IcingaServiceSet) {
|
||||||
return;
|
if ($object->isTemplate() && $this->showNotInBranch($this->translate('Cloning Templates'))) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($object->isTemplate() && $this->showNotInBranch($this->translate('Cloning Apply Rules'))) {
|
if ($object->isTemplate() && $this->showNotInBranch($this->translate('Cloning Apply Rules'))) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$form = IcingaCloneObjectForm::load()
|
$form = IcingaCloneObjectForm::load()
|
||||||
|
|
Loading…
Reference in New Issue