icingaweb2-module-director/application/forms/IcingaHostDictionaryMemberForm.php
Ravi Srinivasa 6198cd8d9b
Alternative custom property support with dictionary handling
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
2026-05-15 13:41:00 +02:00

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;
}
}