index.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. // import ServerPriceComparatorCreate from '@Cloudenv/views/server-price-comparator/create'
  2. // import PriceComparatorList from '@Cloudenv/views/server-price-comparator'
  3. // import Policydefinition from '@Cloudenv/views/policydefinition'
  4. import Layout from '@/layouts/RouterView'
  5. import { hasSetupKey } from '@/utils/auth'
  6. import store from '@/store'
  7. import i18n from '@/locales'
  8. import { isScopedPolicyMenuHidden } from '@/utils/scopedPolicy'
  9. const ProjectMapping = () => import(/* webpackChunkName: "cloudenv" */ /* webpackPrefetch: true */ '@Cloudenv/views/projectmapping')
  10. const Cloudgroup = () => import(/* webpackChunkName: "cloudenv" */ /* webpackPrefetch: true */ '@Cloudenv/views/cloudgroup')
  11. const Cloudaccount = () => import(/* webpackChunkName: "cloudenv" */ /* webpackPrefetch: true */ '@Cloudenv/views/cloudaccount')
  12. const CloudaccountCreate = () => import(/* webpackChunkName: "cloudenv" */ /* webpackPrefetch: true */ '@Cloudenv/views/cloudaccount/create')
  13. const CloudaccountUpdateBill = () => import(/* webpackChunkName: "cloudenv" */ /* webpackPrefetch: true */ '@Cloudenv/views/cloudaccount/create/BillFileIndex')
  14. const Proxysetting = () => import(/* webpackChunkName: "cloudenv" */ /* webpackPrefetch: true */ '@Cloudenv/views/proxysetting')
  15. export default {
  16. index: 90,
  17. meta: {
  18. label: i18n.t('cloudenv.text_8'),
  19. icon: 'menu-multicloud',
  20. },
  21. menus: [
  22. {
  23. meta: {
  24. label: i18n.t('cloudenv.text_12'),
  25. },
  26. submenus: [
  27. {
  28. path: '/cloudaccount',
  29. meta: {
  30. label: i18n.t('cloudenv.text_12'),
  31. permission: 'cloudaccounts_list',
  32. hidden: () => {
  33. if (isScopedPolicyMenuHidden('sub_hidden_menus.cloudaccount')) {
  34. return true
  35. }
  36. if (!hasSetupKey(['onecloud', 'public', 'private', 'storage', 'k8s'])) {
  37. return !hasSetupKey(['bill'])
  38. } else {
  39. return !hasSetupKey(['public', 'private', 'vmware', 'storage'])
  40. }
  41. },
  42. },
  43. component: Layout,
  44. children: [
  45. {
  46. name: 'CloudaccountIndex',
  47. path: '',
  48. component: Cloudaccount,
  49. meta: {
  50. key: '/cloudaccount',
  51. keepAlive: true,
  52. keepAliveViews: ['CloudaccountUpdateBill'],
  53. },
  54. },
  55. {
  56. name: 'CloudaccountCreate',
  57. path: 'create',
  58. component: CloudaccountCreate,
  59. },
  60. {
  61. name: 'CloudaccountUpdateBill',
  62. path: 'updatebill',
  63. component: CloudaccountUpdateBill,
  64. },
  65. ],
  66. },
  67. {
  68. path: '/cloudgroup',
  69. meta: {
  70. label: i18n.t('cloudenv.text_491'),
  71. permission: 'cloudgroup_list',
  72. t: 'cloudenv.text_491',
  73. hidden: () => {
  74. if (isScopedPolicyMenuHidden('sub_hidden_menus.cloudgroup')) {
  75. return true
  76. }
  77. if (store.getters.isProjectMode) return true
  78. if (!hasSetupKey(['onecloud', 'public', 'private', 'storage', 'k8s'])) {
  79. return true
  80. } else {
  81. return !hasSetupKey(['aliyun', 'huawei', 'qcloud', 'aws', 'azure', 'google', 'hcso', 'hcs', 'ksyun'])
  82. }
  83. },
  84. },
  85. component: Layout,
  86. children: [
  87. {
  88. name: 'Cloudgroup',
  89. path: '',
  90. component: Cloudgroup,
  91. },
  92. ],
  93. },
  94. {
  95. path: '/proxysetting',
  96. meta: {
  97. label: i18n.t('cloudenv.text_14'),
  98. permission: 'proxysettings_list',
  99. hidden: () => {
  100. if (isScopedPolicyMenuHidden('sub_hidden_menus.proxysetting')) {
  101. return true
  102. }
  103. if (!hasSetupKey(['onecloud', 'public', 'private', 'storage', 'k8s'])) {
  104. return !hasSetupKey(['bill'])
  105. } else {
  106. return !hasSetupKey(['public', 'private', 'vmware', 'storage'])
  107. }
  108. },
  109. },
  110. component: Layout,
  111. children: [
  112. {
  113. name: 'Proxysetting',
  114. path: '',
  115. component: Proxysetting,
  116. },
  117. ],
  118. },
  119. {
  120. path: '/projectmapping',
  121. meta: {
  122. label: i18n.t('cloudenv.text_580'),
  123. permission: 'proxysettings_list',
  124. hidden: () => {
  125. if (isScopedPolicyMenuHidden('sub_hidden_menus.projectmapping')) {
  126. return true
  127. }
  128. if (!hasSetupKey(['onecloud', 'public', 'private', 'storage', 'k8s'])) {
  129. return !hasSetupKey(['bill'])
  130. } else {
  131. return !hasSetupKey(['public', 'jdcloud', 'ecloud'])
  132. }
  133. },
  134. },
  135. component: Layout,
  136. children: [
  137. {
  138. name: 'ProjectMapping',
  139. path: '',
  140. component: ProjectMapping,
  141. },
  142. ],
  143. },
  144. ],
  145. },
  146. // {
  147. // meta: {
  148. // label: i18n.t('cloudenv.price_comparison'),
  149. // hidden: () => {
  150. // return !hasSetupKey(['onestack', 'private', 'public', 'vmware'])
  151. // },
  152. // },
  153. // submenus: [
  154. // {
  155. // path: '/servercomparator',
  156. // meta: {
  157. // label: i18n.t('compute.text_91'),
  158. // },
  159. // component: Layout,
  160. // children: [
  161. // {
  162. // name: 'ServerPriceComparatorCreate',
  163. // path: '',
  164. // component: ServerPriceComparatorCreate,
  165. // },
  166. // ],
  167. // },
  168. // {
  169. // path: '/pricecomparator',
  170. // meta: {
  171. // label: i18n.t('cloudenv.price_list'),
  172. // },
  173. // component: Layout,
  174. // children: [
  175. // {
  176. // name: 'PriceComparatorList',
  177. // path: '',
  178. // component: PriceComparatorList,
  179. // },
  180. // ],
  181. // },
  182. // ],
  183. // },
  184. /* {
  185. meta: {
  186. label: i18n.t('cloudenv.text_499'),
  187. hidden: () => !hasSetupKey(['onestack', 'private', 'public', 'vmware']),
  188. },
  189. submenus: [
  190. {
  191. path: '/strategyallocation',
  192. meta: {
  193. label: i18n.t('cloudenv.text_500'),
  194. permission: 'scopedpolicies_list',
  195. },
  196. component: Layout,
  197. children: [
  198. {
  199. name: 'Strategyallocation',
  200. path: '',
  201. component: Strategyallocation,
  202. },
  203. ],
  204. },
  205. {
  206. path: '/strategydefinition',
  207. meta: {
  208. label: i18n.t('cloudenv.text_501'),
  209. permission: 'scopedpolicies_list',
  210. },
  211. component: Layout,
  212. children: [
  213. {
  214. name: 'Strategydefinition',
  215. path: '',
  216. component: Strategydefinition,
  217. },
  218. {
  219. name: 'StrategydefinitionCreate',
  220. path: 'create',
  221. component: StrategydefinitionCreate,
  222. },
  223. ],
  224. },
  225. ],
  226. }, */
  227. /* {
  228. meta: {
  229. label: i18n.t('cloudenv.text_21'),
  230. hidden: true,
  231. },
  232. submenus: [
  233. {
  234. path: '/policydefinition',
  235. meta: {
  236. label: i18n.t('cloudenv.text_21'),
  237. permission: 'policydefinitions_list',
  238. hidden: () => !hasSetupKey(['onestack', 'openstack', 'dstack', 'zstack', 'vmware']),
  239. },
  240. component: Layout,
  241. children: [
  242. {
  243. name: 'Policydefinition',
  244. path: '',
  245. component: Policydefinition,
  246. },
  247. ],
  248. },
  249. ],
  250. }, */
  251. ],
  252. }