VmTabs.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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()->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. }