diff --git a/src/router/console/xpack.js b/src/router/console/xpack.js index cefdbdd39..c4df0ffeb 100644 --- a/src/router/console/xpack.js +++ b/src/router/console/xpack.js @@ -36,13 +36,12 @@ export default [ children: [ { path: '', - component: () => import('@/views/assets/Cloud/'), name: 'AccountList', hidden: true, + redirect: '/console/assets/cloud', meta: { title: i18n.t('xpack.Cloud.AccountList'), - permissions: ['xpack.view_account'], - hidden: true + permissions: ['xpack.view_account'] } }, { diff --git a/src/utils/common.js b/src/utils/common.js index 36a9ded80..7c193a92a 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -395,4 +395,9 @@ export const copy = _.throttle(function(value) { document.body.removeChild(inputDom) }, 1400) +export function getQueryFromPath(path) { + const url = new URL(path, location.origin) + return Object.fromEntries(url.searchParams) +} + export { BASE_URL } diff --git a/src/utils/org.js b/src/utils/org.js index e4c64c40e..3aba3a8df 100644 --- a/src/utils/org.js +++ b/src/utils/org.js @@ -27,19 +27,19 @@ async function changeOrg(org, reload = true, vm = null) { if (index !== -1) { path = path.slice(0, index) } - const idRegex = /\/(-?\d+(\.\d+)?|[a-fA-F0-9]{8}-(?:[a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12})\// - const i = path.search(idRegex) - if (i !== -1) { - path = path.slice(0, i + 1) - } + const idRegex = /\/?(-?\d+(\.\d+)?|([a-fA-F0-9]{8}-(?:[a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12}))\/?/ + path = path.replace(idRegex, '') + if (vm) { const result = vm.$router.resolve({ path }) + console.log('path: ', path) if (result.resolved.name === '404') { path = '/' } + console.log('route', result) } - location.hash = '#' + path - setTimeout(() => location.reload(), 400) + // location.hash = '#' + path + // setTimeout(() => location.reload(), 400) } function hasCurrentOrgPermission() {