LoadBalancerSection.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxVps\App\UI\Admin\Product\Sections;
  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\Sections\BoxSection;
  7. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Sections\HalfPageSection;
  8. class LoadBalancerSection extends BoxSection implements AdminArea
  9. {
  10. protected $id = 'loadBalancerSection';
  11. protected $name = 'loadBalancerSection';
  12. protected $title = 'loadBalancerSection';
  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. //Enable
  32. $field = new Switcher('customconfigoption[loadBalancer]');
  33. $field->setDescription('tip');
  34. $this->leftSection->addField($field);
  35. //On Upgrade
  36. $field = new Select('customconfigoption[loadBalancerOnUpgrade]');
  37. $field->setDescription('tip');
  38. $this->rightSection->addField($field);
  39. //Shutdown VM on Upgrade
  40. $field = new Switcher('customconfigoption[loadBalancerShutdownOnUpgrade]');
  41. $field->setDescription('tip');
  42. $this->leftSection->addField($field);
  43. //Stop VM If Shutdown Fails
  44. $field = new Switcher('customconfigoption[loadBalancerStopOnUpgrade]');
  45. $field->setDescription('tip');
  46. $this->rightSection->addField($field);
  47. }
  48. }