NetworkSection.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Admin\Product\Sections\Lxc;
  3. use ModulesGarden\ProxmoxAddon\App\Services\Utility;
  4. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Interfaces\AdminArea;
  5. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields\Select;
  6. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields\Switcher;
  7. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields\Text;
  8. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Sections\BoxSection;
  9. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Sections\HalfPageSection;
  10. class NetworkSection extends BoxSection implements AdminArea
  11. {
  12. protected $id = 'networkSection';
  13. protected $name = 'networkSection';
  14. protected $title = 'networkSection';
  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. //IPv4 Network Mode
  34. $field = new Select('customconfigoption[ipv4NetworkMode]');
  35. $field->setDescription('tip');
  36. $this->leftSection->addField($field);
  37. //IPv6 Network Mode
  38. $field = new Select('customconfigoption[ipv6NetworkMode]');
  39. $field->setDescription('tip');
  40. $field->setDefaultValue('static');
  41. $this->rightSection->addField($field);
  42. //Bridge
  43. $field = new Select('customconfigoption[bridge]');
  44. $field->setDescription('tip');
  45. $this->leftSection->addField($field);
  46. //Private Bridge
  47. $field = new Select('customconfigoption[privateBridge]');
  48. $field->setDescription('tip');
  49. $this->rightSection->addField($field);
  50. //Firewall
  51. $field = new Switcher('customconfigoption[networkFirewall]');
  52. $field->setDescription('tip');
  53. $this->leftSection->addField($field);
  54. //VLAN TAG Range From
  55. $field = new Text('customconfigoption[tagFrom]');
  56. $field->setDescription('tip');
  57. $this->rightSection->addField($field);
  58. //VLAN TAG Range To
  59. $field = new Text('customconfigoption[tagTo]');
  60. $field->setDescription('tip');
  61. $this->leftSection->addField($field);
  62. //Tag
  63. $field = new Select('customconfigoption[tags][]');
  64. $field->enableMultiple();
  65. $field->setDescription('tip');
  66. if(Utility::isIpManagerProxmoxVPSIntegration()){
  67. $field->setDescription('ip_manager_integration_tag');
  68. }
  69. $this->rightSection->addField($field);
  70. }
  71. }