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\SnapshotDataTable;
  14. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Snapshot\Pages\SnapshotTab;
  15. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\TaskHistory\Pages\TaskHistoryDataTable;
  16. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VirtualInterface\Pages\VirtualInterfaceDataTable;
  17. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Interfaces\ClientArea;
  18. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\TabsWidget\TabsWidget;
  19. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Network\Pages\NetworkTab;
  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() && !$this->configuration()->isPermissionSnapshotJob() )
  45. {
  46. $this->addElement(new SnapshotDataTable());
  47. }else if($this->configuration()->isPermissionSnapshot() && $this->configuration()->isPermissionSnapshotJob() ){
  48. $this->addElement(new SnapshotTab());
  49. }
  50. //backup
  51. if ($this->configuration()->isPermissionBackupJob())
  52. {
  53. $this->addElement(new BackupTab());
  54. }
  55. elseif ($this->configuration()->isPermissionBackup())
  56. {
  57. $this->addElement(new BackupDataTable());
  58. }
  59. if ($this->configuration()->isPermissionFirewallOption() && $this->configuration()->isPermissionFirewall())
  60. {
  61. $this->addElement(new FirewallTab());
  62. }
  63. //task history
  64. if ($this->configuration()->isPermissionTaskHistory())
  65. {
  66. $this->addElement(new TaskHistoryDataTable());
  67. }
  68. /**
  69. * Graphs
  70. */
  71. if($this->configuration()->isPermissionGraph()){
  72. $this->addElement(new GraphsTab());
  73. }
  74. /**
  75. * Reinstall
  76. */
  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. }