ContainerSection.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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\Sections\BoxSection;
  8. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Sections\HalfPageSection;
  9. class ContainerSection extends BoxSection implements AdminArea
  10. {
  11. protected $id = 'containerSection';
  12. protected $name = 'containerSection';
  13. protected $title = 'containerSection';
  14. /**
  15. * @var HalfPageSection
  16. */
  17. private $leftSection;
  18. /**
  19. * @var HalfPageSection
  20. */
  21. private $rightSection;
  22. public function initContent()
  23. {
  24. $this->leftSection = new HalfPageSection('leftSection');
  25. $this->rightSection = new HalfPageSection('rightSection');
  26. $this->addSection($this->leftSection)
  27. ->addSection($this->rightSection);
  28. $this->initFields();
  29. }
  30. private function initFields()
  31. {
  32. //Storage
  33. $field = new Select('customconfigoption[storage]');
  34. $field->setDescription('tip');
  35. $this->leftSection->addField($field);
  36. //OS Template
  37. $field = new Select('customconfigoption[osTemplate]');
  38. $field->setDescription('tip');
  39. $this->leftSection->addField($field);
  40. //CPU Limit
  41. $field = new Text('customconfigoption[cpulimit]');
  42. $field->setDescription('tip');
  43. $this->rightSection->addField($field);
  44. //Cores
  45. $field = new Text('customconfigoption[cores]');
  46. $field->setDescription('tip');
  47. $this->rightSection->addField($field);
  48. //SWAP For the VM in MB
  49. $field = new Text('customconfigoption[swap]');
  50. $field->setDescription('tip');
  51. $field->setDefaultValue(512);
  52. $this->rightSection->addField($field);
  53. //CPU Weight For The VM
  54. $field = new Text('customconfigoption[cpuunits]');
  55. $field->setDescription('tip');
  56. $field->setDefaultValue(1024);
  57. $this->leftSection->addField($field);
  58. //Memory
  59. $field = new Text('customconfigoption[memory]');
  60. $field->setDescription('tip');
  61. $field->setDefaultValue(512);
  62. $this->leftSection->addField($field);
  63. //Disk Size
  64. $field = new Text('customconfigoption[diskSize]');
  65. $field->setDescription('tip');
  66. $field->setDefaultValue(32);
  67. $this->leftSection->addField($field);
  68. //Additional Disks Size
  69. $field = new Text('customconfigoption[additionalDiskSize]');
  70. $field->setDescription('tip');
  71. $this->leftSection->addField($field);
  72. //Network Rate Limit
  73. $field = new Text('customconfigoption[rate]');
  74. $field->setDescription('tip');
  75. $this->rightSection->addField($field);
  76. //Minimum Network Rate Limit
  77. $field = new Text('customconfigoption[minimumRate]');
  78. $field->setDescription('tip');
  79. $this->leftSection->addField($field);
  80. //Amount of IPv4 Addresses
  81. $field = new Text('customconfigoption[ipv4]');
  82. $field->setDescription('tip');
  83. $this->rightSection->addField($field);
  84. //Amount of IPv6 Addresses
  85. $field = new Text('customconfigoption[ipv6]');
  86. $field->setDescription('tip');
  87. $this->leftSection->addField($field);
  88. //Backups Size Limit
  89. $field = new Text('customconfigoption[backupMaxSize]');
  90. $field->setDescription('tip');
  91. $this->rightSection->addField($field);
  92. //Backup Files Limit
  93. $field = new Text('customconfigoption[backupMaxFiles]');
  94. $field->setDescription('tip');
  95. $this->leftSection->addField($field);
  96. //Bandwidth Limit
  97. $field = new Text('customconfigoption[bandwidth]');
  98. $field->setDescription('tip');
  99. $this->rightSection->addField($field);
  100. //Snapshots Limit
  101. $field = new Text('customconfigoption[snapshotMaxFiles]');
  102. $field->setDescription('tip');
  103. $this->rightSection->addField($field);
  104. //snapshotJobs
  105. $field = new Text('customconfigoption[snapshotJobs]');
  106. $field->setDescription('tip');
  107. $field->setDefaultValue(1);
  108. $this->rightSection->addField($field);
  109. //randomHostname
  110. $field = new Switcher('customconfigoption[randomHostname]');
  111. $field->setDescription('tip');
  112. $this->rightSection->addField($field);
  113. }
  114. }