icingaweb2-module-director/application/forms/IcingaHostDictionaryMemberForm.php
Ravi Srinivasa dc4b9cb80f
feat(ui): Add forms, controllers, and REST API handler for custom variable management
Introduce the full UI layer for creating, editing, and assigning custom
variables (DirectorProperties) to Icinga objects:

- CustomvarController: CRUD for global custom variable definitions
- VariablesController: per-object variable assignment
- HostController: host-specific dictionary member management
- SuggestionsController: datalist suggestions with PostgreSQL support
- CustomVariableForm / CustomVariablesForm / DeleteCustomVariableForm:
  forms for managing variables on objects with multipart update support
- DictionaryElements (Dictionary, DictionaryItem, NestedDictionary,
  NestedDictionaryItem): composable form elements for structured types
- ArrayElement, IplBoolean: new reusable form elements
- DatalistEntryValidator: validates datalist-constrained variable values
- ObjectController: fetchNestedDictionaryKeys, multipart reload handling
- IcingaObjectHandler (REST API): expose and accept structured custom
  variables in PUT/POST requests; support PostgreSQL UUID binaries
- ObjectTabs: add Variables tab to all object types
- CSS / JS: styles for item lists, action lists, custom variable forms,
  and host-service deactivation; JS fix for multipart form reloads
- configuration.php: register new routes and the Custom Variables dashlet
2026-06-01 12:32:15 +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;
}
}