index.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. import Layout from '@/layouts/RouterView'
  2. import { setupKeys, hasServices } from '@/utils/auth'
  3. import i18n from '@/locales'
  4. import store from '@/store'
  5. import { isScopedPolicyMenuHidden } from '@/utils/scopedPolicy'
  6. const Overview = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/overview')
  7. const CommonalertsIndex = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/commonalert')
  8. const commonalertsCreate = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/commonalert/create')
  9. const commonalertsUpdate = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/commonalert/update')
  10. const commonalertsClone = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/commonalert/clone')
  11. // const MonitorresourcesIndex = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/monitorresource')
  12. const AlertresourceIndex = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/alertresource')
  13. const AlertrecordIndex = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/alertrecord')
  14. const Explorer = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/explorer')
  15. const Dashboard = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/dashboard')
  16. const MonitorDashboardChartCreate = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/dashboard/create')
  17. const AlertRecordShieldsIndex = () => import(/* webpackChunkName: "monitor" */ /* webpackPrefetch: true */ '@Monitor/views/alertrecordshields')
  18. const Notification = () => import(/* webpackChunkName: "iam" */ /* webpackPrefetch: true */ '@IAM/views/notification')
  19. const NotifyTopic = () => import(/* webpackChunkName: "iam" */ /* webpackPrefetch: true */ '@IAM/views/notify-topic')
  20. const Robots = () => import(/* webpackChunkName: "iam" */ /* webpackPrefetch: true */ '@IAM/views/robots')
  21. const NotifyConfigs = () => import(/* webpackChunkName: "iam" */ /* webpackPrefetch: true */ '@IAM/views/notifyconfig')
  22. const NotifyConfigCreate = () => import(/* webpackChunkName: "iam" */ /* webpackPrefetch: true */ '@IAM/views/notifyconfig/create')
  23. const Contact = () => import(/* webpackChunkName: "iam" */ /* webpackPrefetch: true */ '@IAM/views/contact')
  24. export default {
  25. index: 65,
  26. meta: {
  27. label: i18n.t('monitor.text_0'),
  28. icon: 'menu-monitor',
  29. },
  30. menus: [
  31. {
  32. path: '/monitoroverview',
  33. meta: {
  34. label: i18n.t('monitor.text_18'),
  35. permission: 'commonalerts_list',
  36. hidden: () => {
  37. if (isScopedPolicyMenuHidden('sub_hidden_menus.monitoroverview')) {
  38. return true
  39. }
  40. return !setupKeys.hasVersionedSetupKey({ '3.0': ['monitor'] }, true)
  41. },
  42. },
  43. component: Overview,
  44. },
  45. // {
  46. // meta: {
  47. // label: i18n.t('monitor.monitorresources'),
  48. // t: 'dictionary.monitorresources',
  49. // },
  50. // submenus: [
  51. // {
  52. // path: '/monitorresources-guest',
  53. // meta: {
  54. // label: i18n.t('common.server'),
  55. // permission: 'monitorresources_list',
  56. // hidden: () => {
  57. // if (isScopedPolicyMenuHidden('sub_hidden_menus.monitorresources_guest')) {
  58. // return true
  59. // }
  60. // return process.env.VUE_APP_IS_PRIVATE ? !setupKeys.hasVersionedSetupKey({
  61. // '3.0': ['monitor'],
  62. // default: ['onestack', 'openstack', 'dstack', 'zstack', 'public', 'vmware', 'hcso', 'hcs'],
  63. // }) : false
  64. // },
  65. // },
  66. // component: Layout,
  67. // children: [
  68. // {
  69. // name: 'MonitorresourcesGuest',
  70. // path: '',
  71. // props: { res_type: 'guest' },
  72. // component: MonitorresourcesIndex,
  73. // },
  74. // ],
  75. // },
  76. // {
  77. // path: '/monitorresources-host',
  78. // meta: {
  79. // label: i18n.t('dictionary.host'),
  80. // permission: 'monitorresources_list',
  81. // hidden: () => {
  82. // if (isScopedPolicyMenuHidden('sub_hidden_menus.monitorresources_host')) {
  83. // return true
  84. // }
  85. // if (!(store.getters.isAdminMode || store.getters.isDomainMode)) {
  86. // return true
  87. // }
  88. // return process.env.VUE_APP_IS_PRIVATE ? !setupKeys.hasVersionedSetupKey({
  89. // '3.0': ['monitor'],
  90. // default: ['onestack', 'openstack', 'dstack', 'zstack', 'public', 'vmware', 'hcso', 'hcs'],
  91. // }) : false
  92. // },
  93. // },
  94. // component: Layout,
  95. // children: [
  96. // {
  97. // name: 'MonitorresourcesHost',
  98. // path: '',
  99. // props: { res_type: 'host' },
  100. // component: MonitorresourcesIndex,
  101. // },
  102. // ],
  103. // },
  104. // ],
  105. // },
  106. {
  107. meta: {
  108. label: i18n.t('monitor.monitor_metric'),
  109. t: 'dictionary.monitor_metrics',
  110. },
  111. submenus: [
  112. {
  113. name: 'Query',
  114. meta: {
  115. label: i18n.t('monitor.dashboard.title'),
  116. permission: 'unifiedmonitors_get',
  117. hidden: () => {
  118. if (isScopedPolicyMenuHidden('sub_hidden_menus.monitor_dashboard')) {
  119. return true
  120. }
  121. return process.env.VUE_APP_IS_PRIVATE ? !setupKeys.hasVersionedSetupKey({
  122. '3.0': ['monitor'],
  123. default: ['onestack', 'openstack', 'dstack', 'zstack', 'public', 'vmware', 'hcso', 'hcs'],
  124. }) : false
  125. },
  126. },
  127. path: '/monitor-dashboard',
  128. component: Layout,
  129. children: [
  130. {
  131. name: 'MonitorDashboard',
  132. path: '',
  133. component: Dashboard,
  134. },
  135. {
  136. name: 'MonitorDashboardChartCreate',
  137. path: 'create',
  138. component: MonitorDashboardChartCreate,
  139. },
  140. {
  141. name: 'MonitorDashboardChartUpdate',
  142. path: ':id/update',
  143. component: MonitorDashboardChartCreate,
  144. },
  145. ],
  146. },
  147. {
  148. name: 'Query',
  149. meta: {
  150. label: i18n.t('monitor.text_119'),
  151. permission: 'unifiedmonitors_get',
  152. hidden: () => {
  153. if (isScopedPolicyMenuHidden('sub_hidden_menus.explorer')) {
  154. return true
  155. }
  156. return process.env.VUE_APP_IS_PRIVATE ? !setupKeys.hasVersionedSetupKey({
  157. '3.0': ['monitor'],
  158. default: ['onestack', 'openstack', 'dstack', 'zstack', 'public', 'vmware', 'hcso', 'hcs'],
  159. }) : false
  160. },
  161. },
  162. path: '/explorer',
  163. component: Explorer,
  164. },
  165. ],
  166. },
  167. {
  168. meta: {
  169. label: i18n.t('monitor.text_1'),
  170. t: 'dictionary.monitor_commonalert',
  171. },
  172. submenus: [
  173. {
  174. path: '/commonalerts',
  175. meta: {
  176. label: i18n.t('monitor.text_2'),
  177. t: 'dictionary.commonalert',
  178. permission: 'commonalerts_list',
  179. hidden: () => {
  180. if (isScopedPolicyMenuHidden('sub_hidden_menus.commonalerts')) {
  181. return true
  182. }
  183. return process.env.VUE_APP_IS_PRIVATE ? !setupKeys.hasVersionedSetupKey({
  184. '3.0': ['monitor'],
  185. default: ['onestack', 'openstack', 'dstack', 'zstack', 'public', 'vmware', 'hcso', 'hcs'],
  186. }) : false
  187. },
  188. },
  189. component: Layout,
  190. children: [
  191. {
  192. name: 'CommonalertsIndex',
  193. path: '',
  194. component: CommonalertsIndex,
  195. meta: {
  196. key: '/commonalerts',
  197. keepAlive: true,
  198. keepAliveViews: ['CommonalertUpdate'],
  199. },
  200. },
  201. {
  202. name: 'CommonalertCreate',
  203. path: 'create',
  204. component: commonalertsCreate,
  205. },
  206. {
  207. name: 'CommonalertUpdate',
  208. path: ':id/update',
  209. component: commonalertsUpdate,
  210. },
  211. {
  212. name: 'CommonalertClone',
  213. path: ':id/clone',
  214. component: commonalertsClone,
  215. },
  216. ],
  217. },
  218. {
  219. path: '/alertresource',
  220. meta: {
  221. label: i18n.t('monitor.text_17'),
  222. // t: 'dictionary.alertresource',
  223. permission: 'alertresources_list',
  224. hidden: () => {
  225. if (isScopedPolicyMenuHidden('sub_hidden_menus.alertresource')) {
  226. return true
  227. }
  228. if (!store.getters.isAdminMode) return true
  229. return !setupKeys.hasVersionedSetupKey({ '3.0': ['monitor'] }, !(!store.getters.isAdminMode && process.env.VUE_APP_IS_PRIVATE))
  230. },
  231. },
  232. component: Layout,
  233. children: [
  234. {
  235. name: 'alertresourceIndex',
  236. path: '',
  237. component: AlertresourceIndex,
  238. },
  239. ],
  240. },
  241. {
  242. path: '/alertrecord',
  243. meta: {
  244. label: i18n.t('dictionary.alertrecord'),
  245. permission: 'alertrecords_list,monitorresourcealerts_list',
  246. hidden: () => {
  247. if (isScopedPolicyMenuHidden('sub_hidden_menus.alertrecord')) {
  248. return true
  249. }
  250. return !setupKeys.hasVersionedSetupKey({
  251. '3.0': ['monitor'],
  252. })
  253. },
  254. },
  255. component: Layout,
  256. children: [
  257. {
  258. name: 'AlertrecordIndex',
  259. path: '',
  260. component: AlertrecordIndex,
  261. },
  262. ],
  263. },
  264. {
  265. path: '/monitorresourcealerts',
  266. meta: {
  267. label: i18n.t('monitor.text_2'),
  268. t: 'dictionary.monitorresourcealerts',
  269. permission: 'alertrecordshields_list',
  270. hidden: () => {
  271. if (isScopedPolicyMenuHidden('sub_hidden_menus.commonalerts')) {
  272. return true
  273. }
  274. return process.env.VUE_APP_IS_PRIVATE ? !setupKeys.hasVersionedSetupKey({
  275. '3.0': ['monitor'],
  276. default: ['onestack', 'openstack', 'dstack', 'zstack', 'public', 'vmware', 'huaweicloudstack'],
  277. }) : false
  278. },
  279. },
  280. component: Layout,
  281. children: [
  282. {
  283. name: 'AlertRecordShieldsIndex',
  284. path: '',
  285. component: AlertRecordShieldsIndex,
  286. },
  287. ],
  288. },
  289. ],
  290. },
  291. {
  292. meta: {
  293. label: i18n.t('system.text_564'),
  294. },
  295. submenus: [
  296. {
  297. path: '/notification',
  298. meta: {
  299. label: i18n.t('system.text_16'),
  300. permission: 'notifications_list',
  301. hidden: () => {
  302. if (isScopedPolicyMenuHidden('sub_hidden_menus.notification')) {
  303. return true
  304. }
  305. return !hasServices('notify')
  306. },
  307. t: 'dictionary.webconsole',
  308. },
  309. component: Layout,
  310. children: [
  311. {
  312. name: 'Notification',
  313. path: '',
  314. component: Notification,
  315. },
  316. ],
  317. },
  318. {
  319. path: '/notify-topic',
  320. meta: {
  321. label: i18n.t('dictionary.notify-topic'),
  322. permission: 'topics_list',
  323. hidden: () => {
  324. if (isScopedPolicyMenuHidden('sub_hidden_menus.notify_topic')) {
  325. return true
  326. }
  327. if (!(store.getters.isAdminMode || store.getters.isDomainMode)) {
  328. return true
  329. }
  330. return !hasServices('notify')
  331. },
  332. t: 'dictionary.notify-topic',
  333. },
  334. component: Layout,
  335. children: [
  336. {
  337. name: 'NotifyTopic',
  338. path: '',
  339. component: NotifyTopic,
  340. },
  341. ],
  342. },
  343. {
  344. path: '/notifyconfig',
  345. meta: {
  346. label: i18n.t('system.text_19'),
  347. permission: 'notifyconfigs_list',
  348. hidden: () => {
  349. if (isScopedPolicyMenuHidden('sub_hidden_menus.notifyconfig')) {
  350. return true
  351. }
  352. if (!(store.getters.isAdminMode || store.getters.isDomainMode)) {
  353. return true
  354. }
  355. return !hasServices('notify')
  356. },
  357. },
  358. component: Layout,
  359. children: [
  360. {
  361. name: 'NotifyConfig',
  362. path: '',
  363. component: NotifyConfigs,
  364. },
  365. {
  366. name: 'NotifyConfigCreate',
  367. path: 'create',
  368. component: NotifyConfigCreate,
  369. },
  370. ],
  371. },
  372. {
  373. path: '/contact',
  374. meta: {
  375. label: i18n.t('common_27'),
  376. permission: 'contacts_list',
  377. hidden: () => {
  378. if (isScopedPolicyMenuHidden('sub_hidden_menus.contact')) {
  379. return true
  380. }
  381. return !store.getters.isAdminMode && !store.getters.isDomainMode
  382. },
  383. },
  384. component: Layout,
  385. children: [
  386. {
  387. name: 'Contact',
  388. path: '',
  389. component: Contact,
  390. },
  391. ],
  392. },
  393. {
  394. path: '/robot',
  395. meta: {
  396. label: i18n.t('system.robot_manage'),
  397. permission: 'robots_list',
  398. hidden: () => {
  399. if (isScopedPolicyMenuHidden('sub_hidden_menus.robot')) {
  400. return true
  401. }
  402. return false
  403. },
  404. },
  405. component: Layout,
  406. children: [
  407. {
  408. name: 'Robots',
  409. path: '',
  410. component: Robots,
  411. },
  412. ],
  413. },
  414. ],
  415. },
  416. ],
  417. }