Browse Source

[Feature][UI Next] Add token expired jump login page. (#8312)

3.0.0/version-upgrade
songjianet 3 years ago committed by GitHub
parent
commit
aa8ae5de45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      dolphinscheduler-ui-next/src/layouts/content/index.tsx
  2. 11
      dolphinscheduler-ui-next/src/service/service.ts
  3. 15
      dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts

24
dolphinscheduler-ui-next/src/layouts/content/index.tsx

@ -74,18 +74,20 @@ const Content = defineComponent({
watch( watch(
() => route.path, () => route.path,
() => { () => {
state.isShowSide = menuStore.getShowSideStatus if (route.path !== '/login') {
route.matched[1].path.includes(':projectCode') state.isShowSide = menuStore.getShowSideStatus
if (route.matched[1].path === '/projects/:projectCode') { route.matched[1].path.includes(':projectCode')
changeMenuOption(state) if (route.matched[1].path === '/projects/:projectCode') {
getSideMenu(state) 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 } { immediate: true }
) )

11
dolphinscheduler-ui-next/src/service/service.ts

@ -16,9 +16,10 @@
*/ */
import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios' import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'
import { useUserStore } from '@/store/user/user'
import qs from 'qs' import qs from 'qs'
import _ from 'lodash' import _ from 'lodash'
import { useUserStore } from '@/store/user/user' import router from '@/router'
const userStore = useUserStore() const userStore = useUserStore()
@ -43,12 +44,16 @@ const baseRequestConfig: AxiosRequestConfig = {
const service = axios.create(baseRequestConfig) const service = axios.create(baseRequestConfig)
const err = (err: AxiosError): Promise<AxiosError> => { 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) return Promise.reject(err)
} }
service.interceptors.request.use((config: AxiosRequestConfig<any>) => { service.interceptors.request.use((config: AxiosRequestConfig<any>) => {
// console.log('config', config)
config.headers && (config.headers.sessionId = userStore.getSessionId) config.headers && (config.headers.sessionId = userStore.getSessionId)
return config return config

15
dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts

@ -78,14 +78,15 @@ export function useTable() {
row.upstreamTaskMap.length < 1 row.upstreamTaskMap.length < 1
? '-' ? '-'
: h(NSpace, null, { : h(NSpace, null, {
default: () => row.upstreamTaskMap.map((item: string) => { default: () =>
return h( row.upstreamTaskMap.map((item: string) => {
NTag, return h(
{ type: 'info', size: 'small' }, NTag,
{ default: () => item } { type: 'info', size: 'small' },
) { default: () => item }
)
})
}) })
})
) )
}, },
{ {

Loading…
Cancel
Save