You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/02/09 03:38:18 UTC

[dolphinscheduler] branch dev updated: [Feature][UI Next] Add token expired jump login page. (#8312)

This is an automated email from the ASF dual-hosted git repository.

zhongjiajie pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new aa8ae5d  [Feature][UI Next] Add token expired jump login page. (#8312)
aa8ae5d is described below

commit aa8ae5de45f374fbd755489a8a83c94d241b610b
Author: songjianet <17...@qq.com>
AuthorDate: Wed Feb 9 11:38:12 2022 +0800

    [Feature][UI Next] Add token expired jump login page. (#8312)
---
 .../src/layouts/content/index.tsx                  | 24 ++++++++++++----------
 dolphinscheduler-ui-next/src/service/service.ts    | 11 +++++++---
 .../views/projects/task/definition/use-table.ts    | 15 +++++++-------
 3 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/dolphinscheduler-ui-next/src/layouts/content/index.tsx b/dolphinscheduler-ui-next/src/layouts/content/index.tsx
index a8dbf2e..ad0e83d 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/index.tsx
+++ b/dolphinscheduler-ui-next/src/layouts/content/index.tsx
@@ -74,18 +74,20 @@ const Content = defineComponent({
     watch(
       () => route.path,
       () => {
-        state.isShowSide = menuStore.getShowSideStatus
-        route.matched[1].path.includes(':projectCode')
-        if (route.matched[1].path === '/projects/:projectCode') {
-          changeMenuOption(state)
-          getSideMenu(state)
+        if (route.path !== '/login') {
+          state.isShowSide = menuStore.getShowSideStatus
+          route.matched[1].path.includes(':projectCode')
+          if (route.matched[1].path === '/projects/:projectCode') {
+            changeMenuOption(state)
+            getSideMenu(state)
+          }
+          sideKeyRef.value = route.matched[1].path.includes(':projectCode')
+            ? route.matched[1].path.replace(
+                ':projectCode',
+                menuStore.getProjectCode
+              )
+            : route.matched[1].path
         }
-        sideKeyRef.value = route.matched[1].path.includes(':projectCode')
-          ? route.matched[1].path.replace(
-              ':projectCode',
-              menuStore.getProjectCode
-            )
-          : route.matched[1].path
       },
       { immediate: true }
     )
diff --git a/dolphinscheduler-ui-next/src/service/service.ts b/dolphinscheduler-ui-next/src/service/service.ts
index c71fbd8..862be80 100644
--- a/dolphinscheduler-ui-next/src/service/service.ts
+++ b/dolphinscheduler-ui-next/src/service/service.ts
@@ -16,9 +16,10 @@
  */
 
 import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'
+import { useUserStore } from '@/store/user/user'
 import qs from 'qs'
 import _ from 'lodash'
-import { useUserStore } from '@/store/user/user'
+import router from '@/router'
 
 const userStore = useUserStore()
 
@@ -43,12 +44,16 @@ const baseRequestConfig: AxiosRequestConfig = {
 const service = axios.create(baseRequestConfig)
 
 const err = (err: AxiosError): Promise<AxiosError> => {
+  if (err.response?.status === 401 || err.response?.status === 504) {
+    userStore.setSessionId('')
+    userStore.setUserInfo({})
+    router.push({ path: '/login' })
+  }
+
   return Promise.reject(err)
 }
 
 service.interceptors.request.use((config: AxiosRequestConfig<any>) => {
-  // console.log('config', config)
-
   config.headers && (config.headers.sessionId = userStore.getSessionId)
 
   return config
diff --git a/dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts b/dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts
index 94f3e95..f15e94e 100644
--- a/dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts
+++ b/dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts
@@ -78,14 +78,15 @@ export function useTable() {
             row.upstreamTaskMap.length < 1
               ? '-'
               : h(NSpace, null, {
-                default: () => row.upstreamTaskMap.map((item: string) => {
-                  return h(
-                    NTag,
-                    { type: 'info', size: 'small' },
-                    { default: () => item }
-                  )
+                  default: () =>
+                    row.upstreamTaskMap.map((item: string) => {
+                      return h(
+                        NTag,
+                        { type: 'info', size: 'small' },
+                        { default: () => item }
+                      )
+                    })
                 })
-              })
           )
       },
       {