diff --git a/dolphinscheduler-ui/src/locales/en_US/ui_setting.ts b/dolphinscheduler-ui/src/locales/en_US/ui_setting.ts index 9a28e1da12..a51bfd3469 100644 --- a/dolphinscheduler-ui/src/locales/en_US/ui_setting.ts +++ b/dolphinscheduler-ui/src/locales/en_US/ui_setting.ts @@ -19,6 +19,7 @@ export default { refresh_time: 'Log Auto Refresh Time', experimental_feature: 'Experimental Feature', request_settings: 'Request Settings', - dynamic_task_component: 'Dynamic Task Component' + dynamic_task_component: 'Dynamic Task Component', + api_timeout: 'API Timeout', + millisecond: 'Millisecond' } - \ No newline at end of file diff --git a/dolphinscheduler-ui/src/locales/zh_CN/ui_setting.ts b/dolphinscheduler-ui/src/locales/zh_CN/ui_setting.ts index 06c183707c..50c5e2ec32 100644 --- a/dolphinscheduler-ui/src/locales/zh_CN/ui_setting.ts +++ b/dolphinscheduler-ui/src/locales/zh_CN/ui_setting.ts @@ -19,6 +19,7 @@ export default { refresh_time: '自动刷新时间', experimental_feature: '实验性功能', request_settings: '请求设置', - dynamic_task_component: '动态任务组件' + dynamic_task_component: '动态任务组件', + api_timeout: '接口超时时间', + millisecond: '毫秒' } - \ No newline at end of file diff --git a/dolphinscheduler-ui/src/service/service.ts b/dolphinscheduler-ui/src/service/service.ts index 95b0a35fd9..070aa1059c 100644 --- a/dolphinscheduler-ui/src/service/service.ts +++ b/dolphinscheduler-ui/src/service/service.ts @@ -17,6 +17,7 @@ import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios' import { useUserStore } from '@/store/user/user' +import { useUISettingStore } from '@/store/ui-setting/ui-setting' import qs from 'qs' import _ from 'lodash' import cookies from 'js-cookie' @@ -24,6 +25,7 @@ import router from '@/router' import utils from '@/utils' const userStore = useUserStore() +const uiSettingStore = useUISettingStore() /** * @description Log and display errors @@ -43,7 +45,7 @@ const baseRequestConfig: AxiosRequestConfig = { import.meta.env.MODE === 'development' ? '/dolphinscheduler' : import.meta.env.VITE_APP_PROD_WEB_URL + '/dolphinscheduler', - timeout: 15000, + timeout: uiSettingStore.getApiTimer ? uiSettingStore.getApiTimer : 20000, transformRequest: (params) => { if (_.isPlainObject(params)) { return qs.stringify(params, { arrayFormat: 'repeat' }) diff --git a/dolphinscheduler-ui/src/store/ui-setting/types.ts b/dolphinscheduler-ui/src/store/ui-setting/types.ts index 175a0f115f..1413399631 100644 --- a/dolphinscheduler-ui/src/store/ui-setting/types.ts +++ b/dolphinscheduler-ui/src/store/ui-setting/types.ts @@ -17,6 +17,7 @@ interface UISettingStore { logTimer: number dynamicTask: boolean + apiTimer: number } -export { UISettingStore } \ No newline at end of file +export { UISettingStore } diff --git a/dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts b/dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts index cfa2fb79a2..68b2bc5758 100644 --- a/dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts +++ b/dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts @@ -22,7 +22,8 @@ export const useUISettingStore = defineStore({ id: 'ui-setting', state: (): UISettingStore => ({ logTimer: 0, - dynamicTask: false + dynamicTask: false, + apiTimer: 10000 }), persist: true, getters: { @@ -31,6 +32,9 @@ export const useUISettingStore = defineStore({ }, getDynamicTask(): boolean { return this.dynamicTask + }, + getApiTimer(): number { + return this.apiTimer } }, actions: { @@ -39,7 +43,9 @@ export const useUISettingStore = defineStore({ }, setDynamicTask(): void { this.dynamicTask = !this.dynamicTask + }, + setApiTimer(timer: number): void { + this.apiTimer = timer } } }) - diff --git a/dolphinscheduler-ui/src/views/ui-setting/index.tsx b/dolphinscheduler-ui/src/views/ui-setting/index.tsx index 262ca36da4..d6952dec76 100644 --- a/dolphinscheduler-ui/src/views/ui-setting/index.tsx +++ b/dolphinscheduler-ui/src/views/ui-setting/index.tsx @@ -73,21 +73,46 @@ const setting = defineComponent({ const { t } = useI18n() return ( - +

{t('ui_setting.request_settings')}

- - {t('ui_setting.refresh_time')} - + + + {t('ui_setting.api_timeout')} + this.uiSettingStore.setApiTimer(t)} + /> + + + {t('ui_setting.refresh_time')} + +

{t('ui_setting.experimental_feature')}

{t('ui_setting.dynamic_task_component')} - this.uiSettingStore.setDynamicTask()}> + this.uiSettingStore.setDynamicTask()} + >
)