This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git
commit 960ba1bd766c11886e6023ecd5ba5fd278ff6a5e Author: Rohit Yadav <[email protected]> AuthorDate: Sun Jun 28 18:41:12 2020 +0530 auth: wait for auto-discovery before showing view This partially reverts change from b194ad205b558803b7a1c0c8cc177e5b14e80835 which introduces loading of dashboard while auto-discovery takes place in background. The cons is that user will feel that login is taking time, but he'll be allowed to redirect to a page before session timeout/logout. In #456 a similar usability issue was added. However, a tab refresh will be faster because in b194ad205b558803b7a1c0c8cc177e5b14e80835 we've added support for using cached discovered APIs. Fixes #456 Signed-off-by: Rohit Yadav <[email protected]> --- src/permission.js | 4 ++-- src/store/modules/user.js | 11 ++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/permission.js b/src/permission.js index 65fcb2b..9fffb7c 100644 --- a/src/permission.js +++ b/src/permission.js @@ -69,7 +69,7 @@ router.beforeEach((to, from, next) => { description: 'Exception caught while discoverying features' }) store.dispatch('Logout').then(() => { - next({ path: '/user/login' }) + next({ path: '/user/login', query: { redirect: to.fullPath } }) }) }) } else { @@ -80,7 +80,7 @@ router.beforeEach((to, from, next) => { if (whiteList.includes(to.name)) { next() } else { - next({ path: '/user/login' }) + next({ path: '/user/login', query: { redirect: to.fullPath } }) NProgress.done() } } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 6d24e5f..4172eaf 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -124,15 +124,7 @@ const user = { commit('SET_APIS', cachedApis) resolve(cachedApis) } else { - // This will show the dashboard and some common navigation sections - // to most users/roles, while we complete API autodiscovery - const apis = {} - apis.listUsers = {} - apis.listAccounts = {} - commit('SET_APIS', apis) - resolve(apis) - - const hide = message.loading('Discovering features...', 0) + const hide = message.loading('Discovering features, please wait...', 0) api('listApis').then(response => { const apis = {} const apiList = response.listapisresponse.api @@ -145,6 +137,7 @@ const user = { } } commit('SET_APIS', apis) + resolve(apis) store.dispatch('GenerateRoutes', { apis }).then(() => { router.addRoutes(store.getters.addRouters) })
