ShowController: let the object provide the config

This commit is contained in:
Thomas Gelf 2016-10-13 09:20:39 +00:00
parent e99568fffc
commit 18882324ee
1 changed files with 2 additions and 23 deletions

View File

@ -75,35 +75,14 @@ class ShowController extends ActionController
return $tabs; return $tabs;
} }
protected function getObjectConfig($object)
{
$config = new IcingaConfig($this->db());
if ($object->isExternal()) {
$object->object_type = 'object';
}
try {
$object->renderToConfig($config);
} catch (Exception $e) {
$config->configFile(
'failed-to-render'
)->prepend(
"/** Failed to render this object **/\n"
. '/* ' . $e->getMessage() . ' */'
);
}
return $config;
}
protected function newConfig($entry) protected function newConfig($entry)
{ {
return $this->getObjectConfig($this->newObject($entry)); return $this->newObject($entry)->toSingleIcingaConfig();
} }
protected function oldConfig($entry) protected function oldConfig($entry)
{ {
return $this->getObjectConfig($this->oldObject($entry)); return $this->oldObject($entry)->toSingleIcingaConfig();
} }
protected function showDiff($entry) protected function showDiff($entry)