VmCloneForm.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmClone\Forms;
  3. use ModulesGarden\ProxmoxAddon\App\Models\VirtualNetwork;
  4. use ModulesGarden\ProxmoxAddon\App\Services\Cloud\ProductService;
  5. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmClone\Providers\VmCloneProvider;
  6. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmClone\Sections\AdditionalDiskSection;
  7. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmClone\Sections\DnsSection;
  8. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmClone\Sections\Lxc;
  9. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmClone\Sections\Qemu;
  10. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmClone\Sections\TopSection;
  11. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VmClone\Sections\VirtualNetworkSection;
  12. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Interfaces\ClientArea;
  13. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\BaseStandaloneFormExtSections;
  14. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields\Text;
  15. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Sections\HalfPageSection;
  16. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Sections\RawSection;
  17. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Sections\BaseSection;
  18. class VmCloneForm extends BaseStandaloneFormExtSections implements ClientArea
  19. {
  20. use ProductService;
  21. public function initContent()
  22. {
  23. $this->setFormType('create');
  24. $this->setProvider(new VmCloneProvider());
  25. $this->addSection(new TopSection());
  26. if ($this->configuration()->isQemu())
  27. {
  28. $this->addSection((new Qemu\GeneralSection())->setMainContainer($this->mainContainer));
  29. }
  30. if ($this->configuration()->isLxc())
  31. {
  32. $this->addSection((new Lxc\GeneralSection())->setMainContainer($this->mainContainer));
  33. }
  34. $net = new HalfPageSection('netdisk');
  35. $net->setMainContainer($this->mainContainer);
  36. $networks = (new VirtualNetworkSection())->setMainContainer($this->mainContainer);
  37. $net->addSection($networks);
  38. $dns = (new DnsSection())->setMainContainer($this->mainContainer);
  39. $net->addSection($dns);
  40. $this->addSection($net);
  41. $this->loadDataToForm();
  42. }
  43. }