diff --git a/src/api/orgs.js b/src/api/orgs.js
index 34ec9acd7..823581c42 100644
--- a/src/api/orgs.js
+++ b/src/api/orgs.js
@@ -13,3 +13,9 @@ export function getCurrentOrg() {
method: 'get'
})
}
+
+export default {
+ getCurrentOrg,
+ getOrgDetail
+}
+
diff --git a/src/api/users.js b/src/api/users.js
index 84b302629..3482c9e89 100644
--- a/src/api/users.js
+++ b/src/api/users.js
@@ -69,3 +69,8 @@ export function logout() {
export function refreshSessionIdAge() {
return getProfile()
}
+
+export default {
+ getProfile,
+ getUserList
+}
diff --git a/src/guards.js b/src/guards.js
index ee484ddcc..82c6d8397 100644
--- a/src/guards.js
+++ b/src/guards.js
@@ -4,8 +4,7 @@ import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import { startup } from '@/utils/startup'
import store from '@/store'
-import { getPropView, hasRouteViewPerm, isSameView } from '@/utils/jms'
-import Vue from 'vue'
+import { isSameView } from '@/utils/jms'
NProgress.configure({
showSpinner: false
@@ -30,20 +29,6 @@ function generateViewRoutesIfChange({ to, from }) {
}
}
-async function changeCurrentViewIfNeed({ to, from, next }) {
- if (!to.path || isSameView(to, from)) {
- return
- }
- const hasPerm = hasRouteViewPerm(to)
- Vue.$log.debug('Change has current view, has perm: ', hasPerm)
- if (hasPerm) {
- return
- }
- const view = getPropView()
- Vue.$log.debug('Get prop view and goto: ', view)
- next(`/${view}`)
-}
-
function setPageTitle() {
const currentRoute = router.currentRoute
const loginTitle = store.getters.publicSettings['LOGIN_TITLE']
@@ -53,12 +38,6 @@ function setPageTitle() {
}
}
-router.beforeResolve(async(to, from, next) => {
- /* must call `next` */
- await changeCurrentViewIfNeed({ to, from, next })
- next()
-})
-
router.afterEach(async(to, from) => {
// finish progress bar
await setPageTitle()
diff --git a/src/layout/components/NavHeader/AccountDropdown.vue b/src/layout/components/NavHeader/AccountDropdown.vue
index 4f2014ab5..4bc375a72 100644
--- a/src/layout/components/NavHeader/AccountDropdown.vue
+++ b/src/layout/components/NavHeader/AccountDropdown.vue
@@ -7,10 +7,18 @@
- {{ $t('common.nav.Profile') }}
- {{ $t('common.nav.APIKey') }}
- {{ $t('common.nav.TempPassword') }}
- {{ $t('common.nav.Logout') }}
+
+ {{ $t('common.nav.Profile') }}
+
+
+ {{ $t('common.nav.APIKey') }}
+
+
+ {{ $t('common.nav.TempPassword') }}
+
+
+ {{ $t('common.nav.Logout') }}
+
@@ -29,11 +37,7 @@ export default {
},
computed: {
...mapGetters([
- 'currentUser',
- 'currentRole',
- 'currentOrgRoles',
- 'orgs',
- 'currentOrgPerms'
+ 'currentUser'
])
},
created() {
@@ -52,7 +56,7 @@ export default {
this.$router.push('/profile/key')
break
case 'tempPassword':
- this.$router.push('/profile/tempPassword')
+ this.$router.push('/profile/temp-password')
}
},
logout() {
diff --git a/src/layout/components/NavHeader/Organization.vue b/src/layout/components/NavHeader/Organization.vue
index 062621c83..87439fb69 100644
--- a/src/layout/components/NavHeader/Organization.vue
+++ b/src/layout/components/NavHeader/Organization.vue
@@ -11,7 +11,7 @@
{{ item.name }}
-
@@ -55,15 +54,10 @@ export default {
computed: {
...mapGetters([
'currentOrg',
- 'currentRole',
- 'orgs'
- ])
- },
- created() {
- this.init()
- },
- methods: {
- init() {
+ 'usingOrgs',
+ 'currentViewRoute'
+ ]),
+ orgActionsGroup() {
const orgActions = {
label: this.$t('xpack.Organization.OrganizationList'),
options: [
@@ -82,14 +76,25 @@ export default {
]
}
const hasPerms = this.$hasPerm('orgs.view_organization | orgs.add_organization')
- this.orgOption = [
- (hasPerms && orgActions),
- {
- label: this.$t('xpack.Organization.AllOrganization'),
- options: this.orgs
- }
- ]
+ const isConsole = this.currentViewRoute.name === 'console'
+ return hasPerms && isConsole ? orgActions : {}
},
+ orgChoicesGroup() {
+ return {
+ label: this.$t('xpack.Organization.AllOrganization'),
+ options: this.usingOrgs
+ }
+ },
+ orgGroups() {
+ return [
+ this.orgActionsGroup,
+ this.orgChoicesGroup
+ ]
+ }
+ },
+ created() {
+ },
+ methods: {
changeOrg(orgId) {
if (orgId === 'create') {
this.$router.push({ name: 'OrganizationCreate' })
diff --git a/src/layout/components/NavHeader/ViewSwitcher.vue b/src/layout/components/NavHeader/ViewSwitcher.vue
index df0533803..817523cdc 100644
--- a/src/layout/components/NavHeader/ViewSwitcher.vue
+++ b/src/layout/components/NavHeader/ViewSwitcher.vue
@@ -19,7 +19,6 @@
@@ -31,6 +30,7 @@