| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- /* * ********************************************************************
- * Wordpress_Manager Product developed. (Dec 11, 2017)
- * *
- *
- * CREATED BY MODULESGARDEN -> 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 <pawelk@modulesgarden.com>
- */
- 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'];
- }
- }
|