mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-09-25 18:59:05 +02:00
IcingaServiceSetForm: prepare custom fields
This commit is contained in:
parent
c41009992e
commit
dedaea0319
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Forms;
|
namespace Icinga\Module\Director\Forms;
|
||||||
|
|
||||||
use Icinga\Module\Director\Object\IcingaHost;
|
use Icinga\Module\Director\Objects\IcingaHost;
|
||||||
|
use Icinga\Module\Director\Objects\IcingaService;
|
||||||
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
||||||
|
|
||||||
class IcingaServiceSetForm extends DirectorObjectForm
|
class IcingaServiceSetForm extends DirectorObjectForm
|
||||||
@ -43,12 +44,26 @@ class IcingaServiceSetForm extends DirectorObjectForm
|
|||||||
'rows' => '5',
|
'rows' => '5',
|
||||||
'multiOptions' => $this->enumServices(),
|
'multiOptions' => $this->enumServices(),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
|
'class' => 'autosubmit',
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
$this->addHidden('object_type', 'object');
|
$this->addHidden('object_type', 'object');
|
||||||
$this->addHidden('host_id', $this->host->id);
|
$this->addHidden('host_id', $this->host->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$services = array();
|
||||||
|
foreach ($this->getSentOrObjectValue('service') as $name) {
|
||||||
|
$services[] = IcingaService::load(array(
|
||||||
|
'object_name' => $name,
|
||||||
|
'object_type' => 'template'
|
||||||
|
), $this->db);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->assertResolvedImports()) {
|
||||||
|
$loader = $this->fieldLoader($this->object);
|
||||||
|
$loader->loadFieldsForMultipleObjects($services);
|
||||||
|
}
|
||||||
|
|
||||||
$this->setButtons();
|
$this->setButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +78,8 @@ class IcingaServiceSetForm extends DirectorObjectForm
|
|||||||
$db = $this->db->getDbAdapter();
|
$db = $this->db->getDbAdapter();
|
||||||
$query = $db->select()
|
$query = $db->select()
|
||||||
->from('icinga_service', 'object_name')
|
->from('icinga_service', 'object_name')
|
||||||
->where('object_type = ?', 'template');
|
->where('object_type = ?', 'template')
|
||||||
|
->order('object_name');
|
||||||
$names = $db->fetchCol($query);
|
$names = $db->fetchCol($query);
|
||||||
|
|
||||||
return array_combine($names, $names);
|
return array_combine($names, $names);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user