VmTabs.php 4.1 KB

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