VmTabs.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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()->isPermissionSnapshotJob())
  43. {
  44. $this->addElement(new SnapshotTab());
  45. }
  46. elseif ($this->configuration()->isPermissionSnapshot())
  47. {
  48. $this->addElement(new SnapshotDataTable());
  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()->isPermissionReinstall()) {
  78. if ($this->configuration()->isQemu() && $this->configuration()->isPermissionOsTemplate() && $this->configuration()->isPermissionIsoImage())
  79. {
  80. $this->addElement(ReinstallTab::class);
  81. }
  82. elseif ($this->configuration()->isQemu() && $this->configuration()->isPermissionOsTemplate())
  83. {
  84. $this->addElement(TemplateDataTable::class);
  85. }
  86. elseif ($this->configuration()->isQemu() && $this->configuration()->isPermissionIsoImage())
  87. {
  88. $this->addElement(IsoDataTable::class);
  89. //lxc
  90. }
  91. elseif ($this->configuration()->isLxc())
  92. {
  93. $this->addElement(TemplateDataTable::class);
  94. }
  95. }
  96. }
  97. }