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/i18n/langs/en.json b/src/i18n/langs/en.json index ade7ff2e6..055b4547c 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -1274,6 +1274,7 @@ "Sender": "Sender", "MarkAsRead": "Mark as read", "OneClickRead": "Currently read", + "AllClickRead": "All read", "OneClickReadMsg": "Are you sure you want to mark the current information as read?", "NoUnreadMsg": "No unread messages", "SiteMessage": "Site messages", diff --git a/src/i18n/langs/ja.json b/src/i18n/langs/ja.json index c07ea6ed6..36b86400a 100644 --- a/src/i18n/langs/ja.json +++ b/src/i18n/langs/ja.json @@ -1314,6 +1314,7 @@ "Sender": "送信者", "MarkAsRead": "マークはすでに読みました。", "OneClickRead": "現在の既読", + "AllClickRead": "すべて既読", "OneClickReadMsg": "本当に現在の情報を既読としてマークしますか?", "NoUnreadMsg": "未読メッセージはありません", "SiteMessage": "駅内の手紙", diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json index df2ec91cc..b5711b187 100644 --- a/src/i18n/langs/zh.json +++ b/src/i18n/langs/zh.json @@ -1315,6 +1315,7 @@ "Sender": "发送人", "MarkAsRead": "标记已读", "OneClickRead": "当前已读", + "AllClickRead": "全部已读", "OneClickReadMsg": "你确定要将当前信息标记为已读吗?", "NoUnreadMsg": "暂无未读消息", "SiteMessage": "站内信", 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/SiteMessages.vue b/src/layout/components/NavHeader/SiteMessages.vue index 97feff0b1..dc550ce3e 100644 --- a/src/layout/components/NavHeader/SiteMessages.vue +++ b/src/layout/components/NavHeader/SiteMessages.vue @@ -6,6 +6,7 @@ {{ $t('notifications.SiteMessage') }} - {{ $t('notifications.OneClickRead') }} + {{ $t('notifications.AllClickRead') }} @@ -201,6 +202,9 @@ export default {