mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2026-06-04 14:22:26 -04:00
Introduce a first-class DirectorProperty concept that extends the existing
data-fields model with rich, structured variable types. Custom variables can
now be defined globally under a new "Custom Variables" section and assigned
to Icinga objects (hosts, services, commands, etc.).
Supported types: string, number, boolean, fixed-array, dynamic-array,
datalist-strict, datalist-non-strict, fixed-dictionary, and
dynamic-dictionary (one level of nesting allowed).
Key changes:
- DirectorProperty object with CRUD, inheritance, and apply-for rule support
- New form elements: Dictionary, DictionaryItem, NestedDictionary,
NestedDictionaryItem, ArrayElement, IplBoolean
- CustomvarController for managing global property definitions
- VariablesController for per-object variable assignment
- BasketSnapshotCustomVariableResolver for basket import/export of properties
- REST API: IcingaObjectHandler extended to expose and accept structured vars
- IcingaConfigHelper: renders dictionaries/arrays to valid Icinga 2 DSL
- CustomVarRenderer updated for icingadb hook display
- DB migration upgrade_192.sql: new director_property and related tables
- CLI: MigrateCommand for migrating legacy vars to properties;
HostsCommand for bulk host custom variable management
55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Icinga\Module\Director\Forms;
|
|
|
|
use Icinga\Module\Director\Objects\IcingaHost;
|
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
|
use Icinga\Module\Director\Objects\IcingaService;
|
|
|
|
class IcingaHostDictionaryMemberForm extends DirectorObjectForm
|
|
{
|
|
/** @var IcingaService */
|
|
protected $object;
|
|
|
|
private $succeeded;
|
|
|
|
/**
|
|
* @throws \Zend_Form_Exception
|
|
*/
|
|
public function setup()
|
|
{
|
|
$this->addHidden('object_type', 'object');
|
|
$this->addElement('text', 'object_name', [
|
|
'label' => $this->translate('Name'),
|
|
'required' => !$this->object()->isApplyRule(),
|
|
'description' => $this->translate(
|
|
'Name for the instance you are going to create'
|
|
)
|
|
]);
|
|
$this->groupMainProperties()->setButtons();
|
|
}
|
|
|
|
protected function isNew()
|
|
{
|
|
return $this->object === null;
|
|
}
|
|
|
|
protected function deleteObject($object)
|
|
{
|
|
}
|
|
|
|
protected function getObjectClassname()
|
|
{
|
|
return IcingaHost::class;
|
|
}
|
|
|
|
public function succeeded()
|
|
{
|
|
return $this->succeeded;
|
|
}
|
|
|
|
public function onSuccess()
|
|
{
|
|
$this->succeeded = true;
|
|
}
|
|
}
|