VmTabs.php 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Vm\Pages;
  3. use ModulesGarden\ProxmoxAddon\App\Services\Cloud\ProductService;
  4. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Backup\Pages\BackupDataTable;
  5. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Disk\Pages\DiskDataTable;
  6. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\MountPoint\Pages\MountPointDataTable;
  7. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Network\Pages\NetworkLxcDataTable;
  8. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Network\Pages\NetworkQemuDataTable;
  9. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Reinstall\Pages\GraphsTab;
  10. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Reinstall\Pages\IsoDataTable;
  11. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Reinstall\Pages\ReinstallTab;
  12. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Reinstall\Pages\TemplateDataTable;
  13. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\TaskHistory\Pages\TaskHistoryDataTable;
  14. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VirtualInterface\Pages\VirtualInterfaceDataTable;
  15. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Interfaces\ClientArea;
  16. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\TabsWidget\TabsWidget;
  17. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Network\Pages\NetworkTab;
  18. class VmTabs extends TabsWidget implements ClientArea
  19. {
  20. use ProductService;
  21. public function initContent()
  22. {
  23. $this->addElement(new DetailTab);
  24. if(!$this->configuration()->isDetailsCombinedView()){
  25. //disk
  26. if ($this->configuration()->isQemu() && $this->configuration()->isPermissionDisk())
  27. {
  28. $this->addElement(new DiskDataTable());
  29. }
  30. //mount point
  31. if ($this->configuration()->isLxc() && $this->configuration()->isPermissionDisk())
  32. {
  33. $this->addElement(new MountPointDataTable());
  34. }
  35. //network
  36. if (($this->configuration()->isQemu() && $this->configuration()->isPermissionNetwork()) || ($this->configuration()->isLxc() && $this->configuration()->isPermissionNetwork()))
  37. {
  38. $this->addElement(new NetworkTab());
  39. }
  40. }
  41. //snapshot
  42. if ($this->configuration()->isPermissionSnapshot())
  43. {
  44. $this->addElement(new SnapshotTab());
  45. }
  46. //backup
  47. if ($this->configuration()->isPermissionBackupJob())
  48. {
  49. $this->addElement(new BackupTab());
  50. }
  51. elseif ($this->configuration()->isPermissionBackup())
  52. {
  53. $this->addElement(new BackupDataTable());
  54. }
  55. if ($this->configuration()->isPermissionFirewallOption() && $this->configuration()->isPermissionFirewall())
  56. {
  57. $this->addElement(new FirewallTab());
  58. }
  59. //task history
  60. if ($this->configuration()->isPermissionTaskHistory())
  61. {
  62. $this->addElement(new TaskHistoryDataTable());
  63. }
  64. /**
  65. * Graphs
  66. */
  67. if($this->configuration()->isPermissionGraph()){
  68. $this->addElement(new GraphsTab());
  69. }
  70. /**
  71. * Reinstall
  72. */
  73. if ($this->configuration()->isPermissionReinstall()) {
  74. if ($this->configuration()->isQemu() && $this->configuration()->isPermissionOsTemplate() && $this->configuration()->isPermissionIsoImage())
  75. {
  76. $this->addElement(ReinstallTab::class);
  77. }
  78. elseif ($this->configuration()->isQemu() && $this->configuration()->isPermissionOsTemplate())
  79. {
  80. $this->addElement(TemplateDataTable::class);
  81. }
  82. elseif ($this->configuration()->isQemu() && $this->configuration()->isPermissionIsoImage())
  83. {
  84. $this->addElement(IsoDataTable::class);
  85. //lxc
  86. }
  87. elseif ($this->configuration()->isLxc())
  88. {
  89. $this->addElement(TemplateDataTable::class);
  90. }
  91. }
  92. }
  93. }