IcingaServiceSet: improve work with imports

This commit is contained in:
Thomas Gelf 2016-10-20 07:22:08 +00:00
parent 1724a78da5
commit 7f34e4bdf3
3 changed files with 16 additions and 1 deletions

View File

@ -19,6 +19,16 @@ class ServicesetController extends ObjectController
parent::init(); parent::init();
} }
public function loadForm($name)
{
$form = parent::loadForm($name);
if ($name === 'icingaServiceSet' && $this->host) {
$form->setHost($this->host);
}
return $form;
}
protected function loadObject() protected function loadObject()
{ {
if ($this->object === null) { if ($this->object === null) {

View File

@ -50,7 +50,7 @@ class IcingaServiceSetTable extends IcingaObjectTable
array('h' => 'icinga_host'), array('h' => 'icinga_host'),
'h.id = sset.host_id', 'h.id = sset.host_id',
array() array()
)->order('sset.object_name'); )->where('sset.object_type = ?', 'template')->order('sset.object_name');
return $query; return $query;
} }

View File

@ -40,6 +40,11 @@ class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRen
$this->relatedObjectClass = $relatedObjectClass; $this->relatedObjectClass = $relatedObjectClass;
} }
public function getObjects()
{
return $this->relations;
}
public function count() public function count()
{ {
return count($this->relations); return count($this->relations);