ObjectController: allow to clone external objects

fixes #854
This commit is contained in:
Thomas Gelf 2017-08-18 16:13:09 +02:00
parent e6279d87e3
commit bd157b865b
2 changed files with 12 additions and 1 deletions

View File

@ -75,6 +75,10 @@ class IcingaCloneObjectForm extends DirectorForm
$connection
)->set('object_name', $newname);
if ($new->isExternal()) {
$new->set('object_type', 'object');
}
if ($object instanceof IcingaHost) {
$new->set('api_key', null);
if ($this->getValue('clone_services') === 'y') {

View File

@ -102,6 +102,9 @@ abstract class ObjectController extends ActionController
$this->assertPermission('director/showconfig');
$this->tabs()->activate('render');
$preview = new ObjectPreview($this->requireObject(), $this->getRequest());
if ($this->object->isExternal()) {
$this->addActionClone();
}
$preview->renderTo($this);
}
@ -113,7 +116,11 @@ abstract class ObjectController extends ActionController
->setObject($object)
->handleRequest();
$this->tabs()->activate('modify');
if ($object->isExternal()) {
$this->tabs()->activate('render');
} else {
$this->tabs()->activate('modify');
}
$this->addTitle($this->translate('Clone: %s'), $object->getObjectName())
->addBackToObjectLink()
->content()->add($form);