From 9c2a2900121c6a372b306a76874ae364da8b8c08 Mon Sep 17 00:00:00 2001 From: songjianet <1778651752@qq.com> Date: Thu, 27 Oct 2022 09:45:16 +0800 Subject: [PATCH] [Feature][UI] Interface settings add switches for experimental features. (#12537) --- .../src/locales/en_US/ui_setting.ts | 9 +++++---- .../src/locales/zh_CN/ui_setting.ts | 9 +++++---- .../store/{logTimer => ui-setting}/types.ts | 4 ++-- .../logTimer.ts => ui-setting/ui-setting.ts} | 8 ++++---- .../projects/task/instance/batch-task.tsx | 6 +++--- .../projects/task/instance/stream-task.tsx | 6 +++--- .../workflow/components/dag/index.tsx | 6 +++--- .../src/views/ui-setting/index.tsx | 20 ++++++++++++------- 8 files changed, 38 insertions(+), 30 deletions(-) rename dolphinscheduler-ui/src/store/{logTimer => ui-setting}/types.ts (94%) rename dolphinscheduler-ui/src/store/{logTimer/logTimer.ts => ui-setting/ui-setting.ts} (88%) diff --git a/dolphinscheduler-ui/src/locales/en_US/ui_setting.ts b/dolphinscheduler-ui/src/locales/en_US/ui_setting.ts index 7ab6413353..9a28e1da12 100644 --- a/dolphinscheduler-ui/src/locales/en_US/ui_setting.ts +++ b/dolphinscheduler-ui/src/locales/en_US/ui_setting.ts @@ -16,8 +16,9 @@ */ export default { - log: { - refresh_time: 'Log Auto Refresh Time', - } - } + refresh_time: 'Log Auto Refresh Time', + experimental_feature: 'Experimental Feature', + request_settings: 'Request Settings', + dynamic_task_component: 'Dynamic Task Component' +} \ 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 14c556d369..06c183707c 100644 --- a/dolphinscheduler-ui/src/locales/zh_CN/ui_setting.ts +++ b/dolphinscheduler-ui/src/locales/zh_CN/ui_setting.ts @@ -16,8 +16,9 @@ */ export default { - log: { - refresh_time: '自动刷新时间', - } - } + refresh_time: '自动刷新时间', + experimental_feature: '实验性功能', + request_settings: '请求设置', + dynamic_task_component: '动态任务组件' +} \ No newline at end of file diff --git a/dolphinscheduler-ui/src/store/logTimer/types.ts b/dolphinscheduler-ui/src/store/ui-setting/types.ts similarity index 94% rename from dolphinscheduler-ui/src/store/logTimer/types.ts rename to dolphinscheduler-ui/src/store/ui-setting/types.ts index c2d105e96d..d38d0c7e5e 100644 --- a/dolphinscheduler-ui/src/store/logTimer/types.ts +++ b/dolphinscheduler-ui/src/store/ui-setting/types.ts @@ -14,8 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -interface LogTimerStore { +interface UISettingStore { logTimer: number } -export { LogTimerStore } \ No newline at end of file +export { UISettingStore } \ No newline at end of file diff --git a/dolphinscheduler-ui/src/store/logTimer/logTimer.ts b/dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts similarity index 88% rename from dolphinscheduler-ui/src/store/logTimer/logTimer.ts rename to dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts index f7d47e02ae..bf392dacae 100644 --- a/dolphinscheduler-ui/src/store/logTimer/logTimer.ts +++ b/dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts @@ -16,11 +16,11 @@ */ import { defineStore } from 'pinia' -import { LogTimerStore } from './types' +import { UISettingStore } from './types' -export const useLogTimerStore = defineStore({ - id: 'logTimer', - state: (): LogTimerStore => ({ +export const useUISettingStore = defineStore({ + id: 'ui-setting', + state: (): UISettingStore => ({ logTimer: 0, }), persist: true, diff --git a/dolphinscheduler-ui/src/views/projects/task/instance/batch-task.tsx b/dolphinscheduler-ui/src/views/projects/task/instance/batch-task.tsx index 3dd77786f1..84c51f7031 100644 --- a/dolphinscheduler-ui/src/views/projects/task/instance/batch-task.tsx +++ b/dolphinscheduler-ui/src/views/projects/task/instance/batch-task.tsx @@ -38,15 +38,15 @@ import { useI18n } from 'vue-i18n' import { useAsyncState } from '@vueuse/core' import { queryLog } from '@/service/modules/log' import { stateType } from '@/common/common' -import { useLogTimerStore } from '@/store/logTimer/logTimer' +import { useUISettingStore } from '@/store/ui-setting/ui-setting' import Card from '@/components/card' import LogModal from '@/components/log-modal' const BatchTaskInstance = defineComponent({ name: 'task-instance', setup() { - const logTimerStore = useLogTimerStore() - const logTimer = logTimerStore.getLogTimer + const uiSettingStore = useUISettingStore() + const logTimer = uiSettingStore.getLogTimer const { t, variables, getTableData, createColumns } = useTable() const requestTableData = () => { diff --git a/dolphinscheduler-ui/src/views/projects/task/instance/stream-task.tsx b/dolphinscheduler-ui/src/views/projects/task/instance/stream-task.tsx index c67462b3ec..b509d107df 100644 --- a/dolphinscheduler-ui/src/views/projects/task/instance/stream-task.tsx +++ b/dolphinscheduler-ui/src/views/projects/task/instance/stream-task.tsx @@ -39,7 +39,7 @@ import { useI18n } from 'vue-i18n' import { useAsyncState } from '@vueuse/core' import { queryLog } from '@/service/modules/log' import { streamStateType } from '@/common/common' -import { useLogTimerStore } from '@/store/logTimer/logTimer' +import { useUISettingStore } from '@/store/ui-setting/ui-setting' import Card from '@/components/card' import LogModal from '@/components/log-modal' @@ -47,8 +47,8 @@ const BatchTaskInstance = defineComponent({ name: 'task-instance', setup() { let setIntervalP: number - const logTimerStore = useLogTimerStore() - const logTimer = logTimerStore.getLogTimer + const uiSettingStore = useUISettingStore() + const logTimer = uiSettingStore.getLogTimer const { t, variables, getTableData, createColumns } = useTable() const onUpdatePageSize = () => { diff --git a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx index a255f22a54..e0a6f62c66 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx @@ -54,7 +54,7 @@ import './x6-style.scss' import { queryLog } from '@/service/modules/log' import { useAsyncState } from '@vueuse/core' import utils from '@/utils' -import { useLogTimerStore } from '@/store/logTimer/logTimer' +import { useUISettingStore } from '@/store/ui-setting/ui-setting' const props = { // If this prop is passed, it means from definition detail @@ -85,8 +85,8 @@ export default defineComponent({ const route = useRoute() const theme = useThemeStore() - const logTimerStore = useLogTimerStore() - const logTimer = logTimerStore.getLogTimer + const uiSettingStore = useUISettingStore() + const logTimer = uiSettingStore.getLogTimer // Whether the graph can be operated provide('readonly', toRef(props, 'readonly')) diff --git a/dolphinscheduler-ui/src/views/ui-setting/index.tsx b/dolphinscheduler-ui/src/views/ui-setting/index.tsx index 61c44706c0..10799c265e 100644 --- a/dolphinscheduler-ui/src/views/ui-setting/index.tsx +++ b/dolphinscheduler-ui/src/views/ui-setting/index.tsx @@ -16,22 +16,22 @@ */ import { useI18n } from 'vue-i18n' -import { NSelect, NSpace } from 'naive-ui' +import { NSelect, NSpace, NSwitch } from 'naive-ui' import { defineComponent } from 'vue' -import { useLogTimerStore } from '@/store/logTimer/logTimer' +import { useUISettingStore } from '@/store/ui-setting/ui-setting' import Card from '@/components/card' // Update LogTimer store when select value is updated const handleUpdateValue = (logTimer: number) => { - const logTimerStore = useLogTimerStore() - logTimerStore.setLogTimer(logTimer) + const uiSettingStore = useUISettingStore() + uiSettingStore.setLogTimer(logTimer) } const setting = defineComponent({ name: 'ui-setting', setup() { - const logTimerStore = useLogTimerStore() - const defaultLogTimer = logTimerStore.getLogTimer + const uiSettingStore = useUISettingStore() + const defaultLogTimer = uiSettingStore.getLogTimer const logTimerMap = { 0: 'Off', @@ -75,8 +75,9 @@ const setting = defineComponent({ return ( +

{t('ui_setting.request_settings')}

- {t('ui_setting.log.refresh_time')} + {t('ui_setting.refresh_time')} +

{t('ui_setting.experimental_feature')}

+ + {t('ui_setting.dynamic_task_component')} + +
) }