NetworkSection.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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->setDecimal(1);
  57. $field->setDescription('tip');
  58. $this->rightSection->addField($field);
  59. //VLAN TAG Range To
  60. $field = new Text('customconfigoption[tagTo]');
  61. $field->setDecimal(4094);
  62. $field->setDescription('tip');
  63. $this->leftSection->addField($field);
  64. //Tag
  65. $field = new Select('customconfigoption[tags][]');
  66. $field->enableMultiple();
  67. $field->setDescription('tip');
  68. if(Utility::isIpManagerProxmoxVPSIntegration()){
  69. $field->setDescription('ip_manager_integration_tag');
  70. }
  71. $this->rightSection->addField($field);
  72. }
  73. }