VmTabs.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. 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. $this->addElement(new SnapshotTab());
  47. }
  48. //backup
  49. if ($this->configuration()->isPermissionBackupJob())
  50. {
  51. $this->addElement(new BackupTab());
  52. }
  53. elseif ($this->configuration()->isPermissionBackup())
  54. {
  55. $this->addElement(new BackupDataTable());
  56. }
  57. if ($this->configuration()->isPermissionFirewallOption() && $this->configuration()->isPermissionFirewall())
  58. {
  59. $this->addElement(new FirewallTab());
  60. }
  61. //task history
  62. if ($this->configuration()->isPermissionTaskHistory())
  63. {
  64. $this->addElement(new TaskHistoryDataTable());
  65. }
  66. /**
  67. * Graphs
  68. */
  69. if($this->configuration()->isPermissionGraph()){
  70. $this->addElement(new GraphsTab());
  71. }
  72. /**
  73. * Reinstall
  74. */
  75. if ($this->configuration()->isPermissionReinstall()) {
  76. if ($this->configuration()->isQemu() && $this->configuration()->isPermissionOsTemplate() && $this->configuration()->isPermissionIsoImage())
  77. {
  78. $this->addElement(ReinstallTab::class);
  79. }
  80. elseif ($this->configuration()->isQemu() && $this->configuration()->isPermissionOsTemplate())
  81. {
  82. $this->addElement(TemplateDataTable::class);
  83. }
  84. elseif ($this->configuration()->isQemu() && $this->configuration()->isPermissionIsoImage())
  85. {
  86. $this->addElement(IsoDataTable::class);
  87. //lxc
  88. }
  89. elseif ($this->configuration()->isLxc())
  90. {
  91. $this->addElement(TemplateDataTable::class);
  92. }
  93. }
  94. }
  95. }