ConfigurationSection.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxVps\App\UI\Admin\Product\Sections\Lxc;
  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 = 'lxcConfigurationSection';
  13. protected $name = 'lxcConfigurationSection';
  14. protected $title = 'lxcConfigurationSection';
  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 Architecture Type
  34. $field = new Select('customconfigoption[arch]');
  35. $field->setDescription('tip');
  36. $this->rightSection->addField($field);
  37. //Console Type
  38. $field = new Select('customconfigoption[cmode]');
  39. $field->setDescription('tip');
  40. $this->leftSection->addField($field);
  41. //Console
  42. $field = new Switcher('customconfigoption[console]');
  43. $field->setDescription('tip');
  44. $field->setDefaultValue("on");
  45. $this->rightSection->addField($field);
  46. //OS Type
  47. $field = new Select('customconfigoption[ostype]');
  48. $field->setDescription('tip');
  49. $this->leftSection->addField($field);
  50. //Start At Boot
  51. $field = new Switcher('customconfigoption[onboot]');
  52. $this->rightSection->addField($field);
  53. //Add The VM To The Specific Pool
  54. $field = new Select('customconfigoption[pool]');
  55. $field->setDescription('tip');
  56. $this->leftSection->addField($field);
  57. //Protection
  58. $field = new Switcher('customconfigoption[protection]');
  59. $field->setDescription('tip');
  60. $this->rightSection->addField($field);
  61. //Container Notes
  62. $field = new Textarea('customconfigoption[description]');
  63. $field->setDescription('tip');
  64. $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})");
  65. $this->leftSection->addField($field);
  66. //Startup
  67. $field = new Text('customconfigoption[startup]');
  68. $field->setDescription('tip');
  69. $this->rightSection->addField($field);
  70. //Amount of tty For The VM
  71. $field = new Text('customconfigoption[tty]');
  72. $field->setDescription('tip');
  73. $this->leftSection->addField($field);
  74. //Unprivileged
  75. $field = new Switcher('customconfigoption[unprivileged]');
  76. $field->setDescription('tip');
  77. $this->rightSection->addField($field);
  78. //SSH Key Pairs
  79. $field = new Switcher('customconfigoption[sshKeyPairs]');
  80. $field->setDescription('tip');
  81. $this->leftSection->addField($field);
  82. //Delete Private Key
  83. $field = new Switcher('customconfigoption[sshDeletePrivateKey]');
  84. $field->setDescription('tip');
  85. $this->rightSection->addField($field);
  86. //Start after created
  87. $field = new Switcher('customconfigoption[start]');
  88. $field->setDescription('tip');
  89. $this->leftSection->addField($field);
  90. //featureKeyctl
  91. $field = new Switcher('customconfigoption[featureKeyctl]');
  92. $field->setDescription('tip');
  93. $this->rightSection->addField($field);
  94. //featureNesting
  95. $field = new Switcher('customconfigoption[featureNesting]');
  96. $field->setDescription('tip');
  97. $this->rightSection->addField($field);
  98. //featureNfs
  99. $field = new Switcher('customconfigoption[featureNfs]');
  100. $field->setDescription('tip');
  101. $this->rightSection->addField($field);
  102. //featureCifs
  103. $field = new Switcher('customconfigoption[featureCifs]');
  104. $field->setDescription('tip');
  105. $this->rightSection->addField($field);
  106. //featureFuse
  107. $field = new Switcher('customconfigoption[featureFuse]');
  108. $field->setDescription('tip');
  109. $this->rightSection->addField($field);
  110. //featureMknod
  111. $field = new Switcher('customconfigoption[featureMknod]');
  112. $field->setDescription('tip');
  113. $this->rightSection->addField($field);
  114. }
  115. }