http://modulesgarden.com * CONTACT -> contact@modulesgarden.com * * * This software is furnished under a license and may be used and copied * only in accordance with the terms of such license and with the * inclusion of the above copyright notice. This software or any other * copies thereof may not be provided or otherwise made available to any * other person. No title to and ownership of the software is hereby * transferred. * * * ******************************************************************** */ namespace ModulesGarden\ProxmoxAddon\App\UI\Cluster\Forms; use ModulesGarden\ProxmoxAddon\App\UI\Cluster\Providers\NodeSettingProvider; use ModulesGarden\ProxmoxAddon\App\UI\Validators\NumberValidator; use ModulesGarden\ProxmoxAddon\Core\UI\Interfaces\AdminArea; use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\BaseForm; use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Fields; /** * Description of CreateForm * * @author Pawel Kopec */ class UpdateForm extends BaseForm implements AdminArea { public function initContent() { $this->initIds('nodeUpdateForm'); $this->setFormType('update'); $this->setProvider(new NodeSettingProvider); $this->initFields(); $this->loadDataToForm(); } protected function initFields() { //Server ID $this->addField(new Fields\Hidden('server_id')); //Node $this->addField(new Fields\Hidden('node')); //VM create $field = (new Fields\Switcher('vmCreate'))->setDefaultValue('on')->setDescription('description'); $this->addField($field); //VMs max $field = ((new Fields\Text('vmsMax'))->addValidator(new NumberValidator(1, null))->setDescription('description')); $this->addField($field); //CPU max $field = ((new Fields\Text('cpuMax'))->addValidator(new NumberValidator(1, null))->setDescription('description')); $this->addField($field); //Disk max $field = ((new Fields\Text('diskMax'))->addValidator(new NumberValidator(1, null))->setDescription('description')); $this->addField($field); //RAM max $field = ((new Fields\Text('ramMax'))->addValidator(new NumberValidator(1, null))->setDescription('description')); $this->addField($field); //Default Storage $field = ((new Fields\Select('defaultStorage'))->setDescription('description')); $this->addField($field); } protected function getDefaultActions() { return ['update']; } }