ConfigurationSection.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxVps\App\UI\Admin\Product\Sections\Qemu;
  3. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Interfaces\AdminArea;
  4. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Select;
  5. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Switcher;
  6. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Text;
  7. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Textarea;
  8. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Sections\BoxSection;
  9. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Sections\HalfPageSection;
  10. class ConfigurationSection extends BoxSection implements AdminArea
  11. {
  12. protected $id = 'configurationSection';
  13. protected $name = 'configurationSection';
  14. protected $title = 'configurationSection';
  15. /**
  16. * @var HalfPageSection
  17. */
  18. private $leftSection;
  19. /**
  20. * @var HalfPageSection
  21. */
  22. private $rightSection;
  23. public function initContent()
  24. {
  25. $this->leftSection = new HalfPageSection('leftSection');
  26. $this->rightSection = new HalfPageSection('rightSection');
  27. $this->addSection($this->leftSection)
  28. ->addSection($this->rightSection);
  29. $this->initFields();
  30. }
  31. private function initFields()
  32. {
  33. //OS Type - default 2.6/3.x
  34. $field = new Select('customconfigoption[ostype]');
  35. $field->setDescription('tip');
  36. $field->setDefaultValue("l26");
  37. $this->leftSection->addField($field);
  38. //ACPI - switch, default off
  39. $field = new Switcher('customconfigoption[acpi]');
  40. $field->setDescription('tip');
  41. $field->setDefaultValue("off");
  42. $this->rightSection->addField($field);
  43. //Automatic Restart After Crash
  44. $field = new Switcher('customconfigoption[autostart]');
  45. $field->setDescription('tip');
  46. $this->rightSection->addField($field);
  47. //cdrom
  48. $field = new Text('customconfigoption[cdrom]');
  49. $field->setDescription('tip');
  50. $this->leftSection->addField($field);
  51. //CD/DVD-ROM Type
  52. $field = new Select('customconfigoption[cdromType]');
  53. $field->setDescription('tip');
  54. $this->leftSection->addField($field);
  55. //PCID
  56. $field = new Switcher('customconfigoption[pcid]');
  57. $field->setDescription('tip');
  58. $this->rightSection->addField($field);
  59. //Numa
  60. $field = new Switcher('customconfigoption[numa]');
  61. $field->setDescription('tip');
  62. $this->leftSection->addField($field);
  63. //SPEC-CTRL
  64. $field = new Switcher('customconfigoption[spec-ctrl]');
  65. $field->setDescription('tip');
  66. $this->leftSection->addField($field);
  67. //Container Notes
  68. $field = new Textarea('customconfigoption[description]');
  69. $field->setDescription('tip');
  70. $field->setDefaultValue("Client: {\$client_name} (ID: {\$client_id})\nEmail: {\$client_email}\nService ID: {\$service_id}\nHostname: {\$service_domain}\nMain IP: {\$service_dedicated_ip}\n{if \$service_assigned_ips}IP address allocation: {\$service_assigned_ips}\n{/if}\nProduct: {\$product_name} (ID: {\$product_id})");
  71. $this->rightSection->addField($field);
  72. //Startup Freeze CPU
  73. $field = new Switcher('customconfigoption[freeze]');
  74. $field->setDescription('tip');
  75. $this->leftSection->addField($field);
  76. //Hotplug
  77. $field = new Select('customconfigoption[hotplug][]');
  78. $field->setDescription('tip');
  79. $field->enableMultiple();
  80. $this->rightSection->addField($field);
  81. //Keyboard
  82. $field = new Select('customconfigoption[keyboard]');
  83. $field->setDescription('tip');
  84. $this->leftSection->addField($field);
  85. //KVM Hardware Virtualization
  86. $field = new Switcher('customconfigoption[kvm]');
  87. $field->setDescription('tip');
  88. $field->setDefaultValue("on");
  89. $this->rightSection->addField($field);
  90. //Start At Boot
  91. $field = new Switcher('customconfigoption[onboot]');
  92. $field->setDescription('tip');
  93. $this->rightSection->addField($field);
  94. //Add The VM To The Specific Pool
  95. $field = new Select('customconfigoption[pool]');
  96. $field->setDescription('tip');
  97. $this->leftSection->addField($field);
  98. //Allow Reboot
  99. $field = new Switcher('customconfigoption[reboot]');
  100. $field->setDescription('tip');
  101. $this->rightSection->addField($field);
  102. //USB Tablet Device
  103. $field = new Switcher('customconfigoption[tablet]');
  104. $field->setDescription('tip');
  105. $this->rightSection->addField($field);
  106. //VGA Type
  107. $field = new Select('customconfigoption[vga]');
  108. $field->setDescription('tip');
  109. $this->leftSection->addField($field);
  110. //Default KVM Container Prefix
  111. $field = new Text('customconfigoption[containerPrefix]');
  112. $field->setDescription('tip');
  113. $this->rightSection->addField($field);
  114. //Use Client Name For VPS
  115. $field = new Select('customconfigoption[clientNameForContainer]');
  116. $field->setDescription('tip');
  117. $this->leftSection->addField($field);
  118. //Search For Templates In All Nodes
  119. $field = new Switcher('customconfigoption[osTemplatesInAllNodes]');
  120. $field->setDescription('tip');
  121. $field->setDefaultValue("on");
  122. $this->leftSection->addField($field);
  123. //Clone Mode
  124. $field = new Select('customconfigoption[cloneMode]');
  125. $field->setDescription('tip');
  126. $field->setDefaultValue("full");
  127. $this->rightSection->addField($field);
  128. //Start after created
  129. $field = new Switcher('customconfigoption[start]');
  130. $field->setDescription('tip');
  131. $field->setDefaultValue("on");
  132. $this->leftSection->addField($field);
  133. //Clone On The Same Storage As Source
  134. $field = new Switcher('customconfigoption[cloneOnTheSameStorage]');
  135. $field->setDescription('tip');
  136. $this->rightSection->addField($field);
  137. //md-clear
  138. $field = new Switcher('customconfigoption[md-clear]');
  139. $field->setDescription('tip');
  140. $this->leftSection->addField($field);
  141. //ssbd
  142. $field = new Switcher('customconfigoption[ssbd]');
  143. $field->setDescription('tip');
  144. $this->rightSection->addField($field);
  145. //ibpb
  146. $field = new Switcher('customconfigoption[ibpb]');
  147. $field->setDescription('tip');
  148. $this->leftSection->addField($field);
  149. //virt-ssbd
  150. $field = new Switcher('customconfigoption[virt-ssbd]');
  151. $field->setDescription('tip');
  152. $this->rightSection->addField($field);
  153. //amd-ssbd
  154. $field = new Switcher('customconfigoption[amd-ssbd]');
  155. $field->setDescription('tip');
  156. $this->leftSection->addField($field);
  157. //amd-no-ssb
  158. $field = new Switcher('customconfigoption[amd-no-ssb]');
  159. $field->setDescription('tip');
  160. $this->rightSection->addField($field);
  161. //pdpe1gb
  162. $field = new Switcher('customconfigoption[pdpe1gb]');
  163. $field->setDescription('tip');
  164. $this->leftSection->addField($field);
  165. //hv-tlbflush
  166. $field = new Switcher('customconfigoption[hv-tlbflush]');
  167. $field->setDescription('tip');
  168. $this->rightSection->addField($field);
  169. //hv-evmcs
  170. $field = new Switcher('customconfigoption[hv-evmcs]');
  171. $field->setDescription('tip');
  172. $this->leftSection->addField($field);
  173. //aes
  174. $field = new Switcher('customconfigoption[aes]');
  175. $field->setDescription('tip');
  176. $this->rightSection->addField($field);
  177. }
  178. }