IcingaService: fix redirection for host services

This commit is contained in:
Thomas Gelf 2016-03-20 12:04:06 +01:00
parent 3e016311d6
commit 99302d40f4
2 changed files with 18 additions and 8 deletions

View File

@ -189,4 +189,13 @@ class IcingaService extends IcingaObject
{
return $this->getResolvedProperty('check_command_id') !== null;
}
public function getOnDeleteUrl()
{
if ($this->host_id) {
return 'director/host/services?name=' . rawurlencode($this->host);
} else {
return parent::getOnDeleteUrl();
}
}
}

View File

@ -752,15 +752,16 @@ abstract class DirectorObjectForm extends QuickForm
);
}
if ($object instanceof IcingaObject && $object->hasProperty('object_name')) {
$url = $object->getOnDeleteUrl();
} else {
$url = $this->getSuccessUrl()->without(
array('field_id', 'argument_id')
);
}
if ($object->delete()) {
// fields? $this->setSuccessUrl($this->getSuccessUrl()->without($key));
if ($object instanceof IcingaObject && $object->hasProperty('object_name')) {
$this->setSuccessUrl('director/' . strtolower($object->getShortTableName()) . 's');
} else {
$this->setSuccessUrl($this->getSuccessUrl()->without(
array('field_id', 'argument_id')
));
}
$this->setSuccessUrl($url);
}
// TODO: show object name and so
$this->redirectOnSuccess($msg);