DiskSection.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Admin\Product\Sections\Qemu;
  3. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Interfaces\AdminArea;
  4. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields\Select;
  5. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields\Switcher;
  6. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Sections\BoxSection;
  7. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Sections\HalfPageSection;
  8. class DiskSection extends BoxSection implements AdminArea
  9. {
  10. protected $id = 'diskSection';
  11. protected $name = 'diskSection';
  12. protected $title = 'diskSection';
  13. /**
  14. * @var HalfPageSection
  15. */
  16. private $leftSection;
  17. /**
  18. * @var HalfPageSection
  19. */
  20. private $rightSection;
  21. public function initContent()
  22. {
  23. $this->leftSection = new HalfPageSection('leftSection');
  24. $this->rightSection = new HalfPageSection('rightSection');
  25. $this->addSection($this->leftSection)
  26. ->addSection($this->rightSection);
  27. $this->initFields();
  28. }
  29. private function initFields()
  30. {
  31. //Storage
  32. $field = new Select('customconfigoption[diskStorage]');
  33. $field->setDescription('tip');
  34. $field->setDefaultValue('local-lvm');
  35. $this->leftSection->addField($field);
  36. //Disk Type
  37. $field = new Select('customconfigoption[diskType]');
  38. $field->setDescription('tip');
  39. $this->rightSection->addField($field);
  40. //Disk Format
  41. $field = new Select('customconfigoption[diskFormat]');
  42. $field->setDescription('tip');
  43. $this->leftSection->addField($field);
  44. //Cache
  45. $field = new Select('customconfigoption[diskCache]');
  46. $field->setDescription('tip');
  47. $this->rightSection->addField($field);
  48. //SCSI Controller Model
  49. $field = new Select('customconfigoption[scsihw]');
  50. $field->setDescription('tip');
  51. $this->leftSection->addField($field);
  52. //Discard
  53. $field = new Switcher('customconfigoption[discard]');
  54. $field->setDescription('tip');
  55. $this->rightSection->addField($field);
  56. //Skip Replication
  57. $field = new Switcher('customconfigoption[replicate]');
  58. $field->setDescription('tip');
  59. $this->leftSection->addField($field);
  60. //IO Thread
  61. $field = new Switcher('customconfigoption[ioThread]');
  62. $field->setDescription('tip');
  63. $this->rightSection->addField($field);
  64. //Limits
  65. $field = new Switcher('customconfigoption[diskSpeed]');
  66. $field->setDescription('tip');
  67. $this->leftSection->addField($field);
  68. //ssd
  69. $field = new Switcher('customconfigoption[ssd]');
  70. $field->setDescription('tip');
  71. $this->rightSection->addField($field);
  72. }
  73. }