index.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. import Layout from '@/layouts/RouterView'
  2. import { hasSetupKey } from '@/utils/auth'
  3. import i18n from '@/locales'
  4. import store from '@/store'
  5. import { isScopedPolicyMenuHidden } from '@/utils/scopedPolicy'
  6. const BackupStorage = () => import(/* webpackChunkName: "storage" */ /* webpackPrefetch: true */ '@Storage/views/backup-storage')
  7. const Tablestore = () => import(/* webpackChunkName: "storage" */ /* webpackPrefetch: true */ '@Storage/views/tablestore')
  8. const AccessGroup = () => import(/* webpackChunkName: "storage" */ /* webpackPrefetch: true */ '@Storage/views/access-group')
  9. const FileSystem = () => import(/* webpackChunkName: "storage" */ /* webpackPrefetch: true */ '@Storage/views/file-system')
  10. const Bucket = () => import(/* webpackChunkName: "storage" */ /* webpackPrefetch: true */ '@Storage/views/bucket')
  11. const BlockStorage = () => import(/* webpackChunkName: "storage" */ /* webpackPrefetch: true */ '@Storage/views/blockstorage')
  12. const BucketCreate = () => import(/* webpackChunkName: "storage" */ /* webpackPrefetch: true */ '@Storage/views/bucket/create')
  13. const BucketSetStaticWebsit = () => import(/* webpackChunkName: "storage" */ /* webpackPrefetch: true */ '@Storage/views/bucket/components/SetStaticWebsit')
  14. const FileSystemCreate = () => import(/* webpackChunkName: "storage" */ /* webpackPrefetch: true */ '@Storage/views/file-system/create/index')
  15. export default {
  16. index: 50,
  17. meta: {
  18. label: i18n.t('storage.text_16'),
  19. icon: 'menu-storage',
  20. },
  21. menus: [
  22. /**
  23. * 块存储
  24. */
  25. {
  26. meta: {
  27. label: i18n.t('dictionary.blockstorage'),
  28. t: 'dictionary.blockstorage',
  29. },
  30. submenus: [
  31. {
  32. path: '/blockstorage',
  33. meta: {
  34. label: i18n.t('dictionary.blockstorage'),
  35. permission: 'storages_list',
  36. t: 'dictionary.blockstorage',
  37. hidden: () => {
  38. if (isScopedPolicyMenuHidden('sub_hidden_menus.blockstorage')) {
  39. return true
  40. }
  41. return !hasSetupKey(['onestack', 'openstack', 'dstack', 'zstack', 'vmware', 'nutanix', 'bingocloud', 'proxmox'])
  42. },
  43. },
  44. component: Layout,
  45. children: [
  46. {
  47. name: 'BlockStorage',
  48. path: '',
  49. component: BlockStorage,
  50. },
  51. ],
  52. },
  53. ],
  54. },
  55. /**
  56. * 存储桶
  57. */
  58. {
  59. meta: {
  60. label: i18n.t('storage.object_storage'),
  61. },
  62. submenus: [
  63. {
  64. path: '/bucket',
  65. meta: {
  66. label: i18n.t('storage.text_18'),
  67. permission: 'buckets_list',
  68. hidden: () => {
  69. if (isScopedPolicyMenuHidden('sub_hidden_menus.bucket')) {
  70. return true
  71. }
  72. return !hasSetupKey(['aliyun', 'aws', 'azure', 'huawei', 'qcloud', 'google', 'storage', 'hcso', 'hcs', 'apsara'])
  73. },
  74. },
  75. component: Layout,
  76. children: [
  77. {
  78. name: 'Bucket',
  79. path: '',
  80. component: Bucket,
  81. },
  82. {
  83. name: 'BucketCreate',
  84. path: 'create',
  85. component: BucketCreate,
  86. },
  87. {
  88. name: 'BucketSetStaticWebsit',
  89. path: 'setstaticwebsit',
  90. component: BucketSetStaticWebsit,
  91. },
  92. ],
  93. },
  94. ],
  95. },
  96. /**
  97. * 表格存储
  98. */
  99. {
  100. meta: {
  101. label: i18n.t('dictionary.tablestore'),
  102. },
  103. submenus: [
  104. {
  105. path: '/table-storage',
  106. meta: {
  107. label: i18n.t('dictionary.tablestore'),
  108. permission: 'tablestores_list',
  109. hidden: () => {
  110. if (isScopedPolicyMenuHidden('sub_hidden_menus.table_storage')) {
  111. return true
  112. }
  113. if (store.getters.isProjectMode) return true
  114. return !hasSetupKey(['apsara', 'aliyun'])
  115. },
  116. },
  117. component: Layout,
  118. children: [
  119. {
  120. name: 'TableStorage',
  121. path: '',
  122. component: Tablestore,
  123. },
  124. ],
  125. },
  126. ],
  127. },
  128. /**
  129. * 文件存储
  130. */
  131. {
  132. meta: {
  133. label: i18n.t('storage.nas'),
  134. },
  135. submenus: [
  136. {
  137. path: '/nas',
  138. meta: {
  139. label: i18n.t('dictionary.filesystem'),
  140. permission: 'file_systems_list',
  141. hidden: () => {
  142. if (isScopedPolicyMenuHidden('sub_hidden_menus.nas')) {
  143. return true
  144. }
  145. return !hasSetupKey(['aliyun', 'huawei', 'hcs', 'cephfs'])
  146. },
  147. },
  148. component: Layout,
  149. children: [
  150. {
  151. name: 'FileSystem',
  152. path: '',
  153. component: FileSystem,
  154. },
  155. {
  156. name: 'FileSystemCreate',
  157. path: 'create',
  158. component: FileSystemCreate,
  159. },
  160. ],
  161. },
  162. {
  163. path: '/access-group',
  164. meta: {
  165. label: i18n.t('dictionary.access_group'),
  166. permission: 'access_groups_list',
  167. hidden: () => {
  168. if (isScopedPolicyMenuHidden('sub_hidden_menus.access_group')) {
  169. return true
  170. }
  171. return !hasSetupKey(['aliyun', 'huawei', 'hcs', 'cephfs'])
  172. },
  173. },
  174. component: Layout,
  175. children: [
  176. {
  177. name: 'AccessGroup',
  178. path: '',
  179. component: AccessGroup,
  180. },
  181. ],
  182. },
  183. ],
  184. },
  185. /**
  186. * 备份存储
  187. */
  188. {
  189. meta: {
  190. label: i18n.t('dictionary.backup_storage'),
  191. },
  192. submenus: [
  193. {
  194. path: '/backup-storage',
  195. meta: {
  196. label: i18n.t('dictionary.backup_storage'),
  197. permission: 'backupstorages_list',
  198. hidden: () => {
  199. if (isScopedPolicyMenuHidden('sub_hidden_menus.backup_storage')) {
  200. return true
  201. }
  202. if (store.getters.isProjectMode) return true
  203. return !hasSetupKey(['onestack'])
  204. },
  205. },
  206. component: Layout,
  207. children: [
  208. {
  209. name: 'BackupStorage',
  210. path: '',
  211. component: BackupStorage,
  212. },
  213. ],
  214. },
  215. ],
  216. },
  217. ],
  218. }