VmTabs.php 4.2 KB

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