diff --git a/dolphinscheduler-ui/src/common/common.ts b/dolphinscheduler-ui/src/common/common.ts index 261e8271c74d..80fe920c7e4e 100644 --- a/dolphinscheduler-ui/src/common/common.ts +++ b/dolphinscheduler-ui/src/common/common.ts @@ -400,7 +400,7 @@ export const workflowExecutionState = ( icon: HourglassOutlined, isSpin: false, classNames: 'wait_to_run' - }, + } }) /** diff --git a/dolphinscheduler-ui/src/components/chart/modules/Bar.tsx b/dolphinscheduler-ui/src/components/chart/modules/Bar.tsx index 3375089880f7..695eb44fe402 100644 --- a/dolphinscheduler-ui/src/components/chart/modules/Bar.tsx +++ b/dolphinscheduler-ui/src/components/chart/modules/Bar.tsx @@ -49,7 +49,7 @@ const BarChart = defineComponent({ trigger: 'axis', axisPointer: { type: 'shadow' - }, + } }, grid: { left: '3%', diff --git a/dolphinscheduler-ui/src/components/chart/modules/Gauge.tsx b/dolphinscheduler-ui/src/components/chart/modules/Gauge.tsx index b9b899478598..4f8d3ef080e1 100644 --- a/dolphinscheduler-ui/src/components/chart/modules/Gauge.tsx +++ b/dolphinscheduler-ui/src/components/chart/modules/Gauge.tsx @@ -15,13 +15,7 @@ * limitations under the License. */ -import { - defineComponent, - onMounted, - onBeforeUnmount, - PropType, - ref -} from 'vue' +import { defineComponent, onMounted, onBeforeUnmount, PropType, ref } from 'vue' import initChart from '@/components/chart' import type { Ref } from 'vue' diff --git a/dolphinscheduler-ui/src/layouts/content/use-dataList.ts b/dolphinscheduler-ui/src/layouts/content/use-dataList.ts index 0cf6bd2ea5ab..69ebfa6e39a6 100644 --- a/dolphinscheduler-ui/src/layouts/content/use-dataList.ts +++ b/dolphinscheduler-ui/src/layouts/content/use-dataList.ts @@ -110,18 +110,18 @@ export function useDataList() { { label: t('menu.project_overview'), key: `/projects/${projectCode}`, - payload: { projectName: projectName }, + payload: { projectName: projectName } }, { label: t('menu.project_parameter'), key: `/projects/${projectCode}/parameter`, - payload: { projectName: projectName }, + payload: { projectName: projectName } }, { label: t('menu.project_preferences'), key: `/projects/${projectCode}/preferences`, - payload: { projectName: projectName }, - }, + payload: { projectName: projectName } + } ] }, { diff --git a/dolphinscheduler-ui/src/locales/en_US/project.ts b/dolphinscheduler-ui/src/locales/en_US/project.ts index b3238fc266b5..152b2058d917 100644 --- a/dolphinscheduler-ui/src/locales/en_US/project.ts +++ b/dolphinscheduler-ui/src/locales/en_US/project.ts @@ -41,7 +41,7 @@ export default { no_permission: 'No Permission', read_permission: 'Read Permission', all_permission: 'All Permission', - assign_worker_group: 'Worker Group', + assign_worker_group: 'Worker Group' }, workflow: { on_line: 'Online', @@ -239,12 +239,17 @@ export default { time_to_online: 'Confirm to make the Scheduler online?', time_to_offline: 'Confirm to make the Scheduler offline?', warning_dependent_tasks_title: 'Warning', - warning_dependent_tasks_desc: 'The downstream dependent tasks exists. Are you sure to make the workflow offline?', + warning_dependent_tasks_desc: + 'The downstream dependent tasks exists. Are you sure to make the workflow offline?', warning_dependencies: 'Dependencies:', - delete_validate_dependent_tasks_desc: 'The downstream dependent tasks exists. You can not delete the workflow.', - warning_offline_scheduler_dependent_tasks_desc: 'The downstream dependent tasks exists. Are you sure to make the scheduler offline?', - delete_task_validate_dependent_tasks_desc: 'The downstream dependent tasks exists. You can not delete the task.', - warning_delete_scheduler_dependent_tasks_desc: 'The downstream dependent tasks exists. Are you sure to delete the scheduler?', + delete_validate_dependent_tasks_desc: + 'The downstream dependent tasks exists. You can not delete the workflow.', + warning_offline_scheduler_dependent_tasks_desc: + 'The downstream dependent tasks exists. Are you sure to make the scheduler offline?', + delete_task_validate_dependent_tasks_desc: + 'The downstream dependent tasks exists. You can not delete the task.', + warning_delete_scheduler_dependent_tasks_desc: + 'The downstream dependent tasks exists. Are you sure to delete the scheduler?' }, task: { on_line: 'Online', @@ -314,7 +319,8 @@ export default { whether_dry_run: 'Whether Dry-Run', please_choose: 'Please Choose', remove_task_cache: 'Clear cache', - delete_validate_dependent_tasks_desc: 'The downstream dependent tasks exists. You can not delete the task.', + delete_validate_dependent_tasks_desc: + 'The downstream dependent tasks exists. You can not delete the task.' }, dag: { create: 'Create Workflow', @@ -843,9 +849,12 @@ export default { please_select_target_datasource: 'Please select target datasource id', please_select_target_database: 'Please select target database', please_enter_target_table: 'Please select target table name', - please_enter_target_filter_expression: 'Please enter target filter expression', - please_enter_comparison_name_the_alias_in_comparison_execute_sql: 'Please enter comparison name the alias in comparison execute sql', - please_enter_statistics_name_the_alias_in_statistics_execute_sql: 'Please enter statistics name the alias in statistics execute sql', + please_enter_target_filter_expression: + 'Please enter target filter expression', + please_enter_comparison_name_the_alias_in_comparison_execute_sql: + 'Please enter comparison name the alias in comparison execute sql', + please_enter_statistics_name_the_alias_in_statistics_execute_sql: + 'Please enter statistics name the alias in statistics execute sql', please_enter_comparison_execute_sql: 'Please enter comparison execute sql', please_enter_statistics_execute_sql: 'Please enter statistics execute sql', please_enter_threshold_number_is_needed: @@ -899,8 +908,7 @@ export default { yarn_queue_tips: 'Please input yarn queue(optional)', dependent_type: 'Dependency Type', dependent_on_workflow: 'Dependent on workflow', - dependent_on_task: 'Dependent on task', - + dependent_on_task: 'Dependent on task' }, menu: { fav: 'Favorites', @@ -927,15 +935,16 @@ export default { edit: 'Edit', delete: 'Delete', delete_confirm: 'Delete?', - success: 'Success', + success: 'Success' }, preference: { edit_preference: 'Edit Preference', preference_manage: 'Project Preference Management', - instruction_tips: 'The settings below will affect all workflows and tasks under this project.When creating the workflow or task, these preferences will be the default value of their components.', + instruction_tips: + 'The settings below will affect all workflows and tasks under this project.When creating the workflow or task, these preferences will be the default value of their components.', success: 'Success', submit: 'Submit', enabled: 'Enabled', disabled: 'Disabled' - }, + } } diff --git a/dolphinscheduler-ui/src/locales/en_US/security.ts b/dolphinscheduler-ui/src/locales/en_US/security.ts index 8980bc724ae3..4faa58d51afe 100644 --- a/dolphinscheduler-ui/src/locales/en_US/security.ts +++ b/dolphinscheduler-ui/src/locales/en_US/security.ts @@ -273,14 +273,14 @@ export default { MsgType: 'Msg Type', // eslint-disable-next-line quotes IsAtAll: "{'@'}All", - calledNumber:"Called phone number", - calledShowNumber:"Call display number", - ttsCode:"TTS Code", - address:'Address', - accessKeyId:"AccessKeyId", - accessKeySecret:"AccessKeySecret", + calledNumber: 'Called phone number', + calledShowNumber: 'Call display number', + ttsCode: 'TTS Code', + address: 'Address', + accessKeyId: 'AccessKeyId', + accessKeySecret: 'AccessKeySecret', annotations: 'Annotations', - generatorURL: 'GeneratorURL', + generatorURL: 'GeneratorURL' }, k8s_namespace: { create_namespace: 'Create Namespace', diff --git a/dolphinscheduler-ui/src/locales/zh_CN/project.ts b/dolphinscheduler-ui/src/locales/zh_CN/project.ts index 21d35e2a71b1..42c637a6e469 100644 --- a/dolphinscheduler-ui/src/locales/zh_CN/project.ts +++ b/dolphinscheduler-ui/src/locales/zh_CN/project.ts @@ -41,7 +41,7 @@ export default { no_permission: '无权限', read_permission: '读权限', all_permission: '所有权限', - assign_worker_group: '分配WorkerGroup', + assign_worker_group: '分配WorkerGroup' }, workflow: { on_line: '线上', @@ -237,12 +237,16 @@ export default { time_to_online: '是否确定上线该定时?', time_to_offline: '是否确定下线该定时?', warning_dependent_tasks_title: '警告', - warning_dependent_tasks_desc: '下游存在依赖, 下线操作可能会对下游任务产生影响. 你确定要下线该工作流嘛?', + warning_dependent_tasks_desc: + '下游存在依赖, 下线操作可能会对下游任务产生影响. 你确定要下线该工作流嘛?', warning_dependencies: '依赖如下:', delete_validate_dependent_tasks_desc: '下游存在依赖,你不能删除该工作流', - warning_offline_scheduler_dependent_tasks_desc: '下游存在依赖, 下线操作可能会对下游任务产生影响. 你确定要下线该定时嘛?', - delete_task_validate_dependent_tasks_desc: '下游存在依赖,你不能删除该任务.', - warning_delete_scheduler_dependent_tasks_desc: '下游存在依赖, 删除定时可能会对下游任务产生影响. 你确定要删除该定时嘛?', + warning_offline_scheduler_dependent_tasks_desc: + '下游存在依赖, 下线操作可能会对下游任务产生影响. 你确定要下线该定时嘛?', + delete_task_validate_dependent_tasks_desc: + '下游存在依赖,你不能删除该任务.', + warning_delete_scheduler_dependent_tasks_desc: + '下游存在依赖, 删除定时可能会对下游任务产生影响. 你确定要删除该定时嘛?' }, task: { on_line: '线上', @@ -312,7 +316,7 @@ export default { whether_dry_run: '是否空跑', please_choose: '请选择', remove_task_cache: '清除缓存', - delete_validate_dependent_tasks_desc: '下游存在依赖,你不能删除该任务定义', + delete_validate_dependent_tasks_desc: '下游存在依赖,你不能删除该任务定义' }, dag: { create: '创建工作流', @@ -822,8 +826,10 @@ export default { please_select_target_database: '请选择目标数据库', please_enter_target_table: '请选择目标数据表', please_enter_target_filter_expression: '请输入目标表过滤条件', - please_enter_comparison_name_the_alias_in_comparison_execute_sql: '请输入期望值名', - please_enter_statistics_name_the_alias_in_statistics_execute_sql: '请输入实际值名', + please_enter_comparison_name_the_alias_in_comparison_execute_sql: + '请输入期望值名', + please_enter_statistics_name_the_alias_in_statistics_execute_sql: + '请输入实际值名', please_enter_comparison_execute_sql: '请输入期望值计算SQL', please_enter_statistics_execute_sql: '请输入实际值计算SQL', custom_config: '自定义配置', @@ -872,7 +878,7 @@ export default { yarn_queue_tips: '请输入Yarn队列(选填)', dependent_type: '依赖类型', dependent_on_workflow: '依赖于工作流', - dependent_on_task: '依赖于任务', + dependent_on_task: '依赖于任务' }, menu: { fav: '收藏组件', @@ -899,15 +905,16 @@ export default { edit: '编辑', delete: '删除', delete_confirm: '确定删除吗?', - success: '成功', + success: '成功' }, preference: { edit_preference: '修改项目偏好设置', preference_manage: '项目偏好管理', - instruction_tips: '下面这些项目偏好配置将影响这个项目下的所有工作流和任务。当创建工作流和任务时,这些配置将影响组件中的默认选项', + instruction_tips: + '下面这些项目偏好配置将影响这个项目下的所有工作流和任务。当创建工作流和任务时,这些配置将影响组件中的默认选项', success: '成功', submit: '提交', enabled: '启用', disabled: '未启用' - }, + } } diff --git a/dolphinscheduler-ui/src/locales/zh_CN/security.ts b/dolphinscheduler-ui/src/locales/zh_CN/security.ts index 453d99d7b8fc..08ada5a3a7f0 100644 --- a/dolphinscheduler-ui/src/locales/zh_CN/security.ts +++ b/dolphinscheduler-ui/src/locales/zh_CN/security.ts @@ -272,14 +272,14 @@ export default { MsgType: '消息类型', // eslint-disable-next-line quotes IsAtAll: "{'@'}所有人", - calledNumber:"被叫电话号码", - calledShowNumber:"呼叫显示号码", - ttsCode:"语音模板", - address:'访问域名', - accessKeyId:"AccessKeyId", - accessKeySecret:"AccessKeySecret", + calledNumber: '被叫电话号码', + calledShowNumber: '呼叫显示号码', + ttsCode: '语音模板', + address: '访问域名', + accessKeyId: 'AccessKeyId', + accessKeySecret: 'AccessKeySecret', annotations: '注释', - generatorURL: '生成地址', + generatorURL: '生成地址' }, k8s_namespace: { create_namespace: '创建命名空间', diff --git a/dolphinscheduler-ui/src/service/modules/data-source/index.ts b/dolphinscheduler-ui/src/service/modules/data-source/index.ts index b54f540eaa86..f629384dac43 100644 --- a/dolphinscheduler-ui/src/service/modules/data-source/index.ts +++ b/dolphinscheduler-ui/src/service/modules/data-source/index.ts @@ -134,7 +134,7 @@ export function getDatasourceDatabasesById(datasourceId: number): any { url: '/datasources/databases', method: 'get', params: { - datasourceId + datasourceId } }) } diff --git a/dolphinscheduler-ui/src/service/modules/lineages/index.ts b/dolphinscheduler-ui/src/service/modules/lineages/index.ts index d43e69276ce5..d6341e172489 100644 --- a/dolphinscheduler-ui/src/service/modules/lineages/index.ts +++ b/dolphinscheduler-ui/src/service/modules/lineages/index.ts @@ -16,7 +16,7 @@ */ import { axios } from '@/service/service' -import {DependentTaskReq, ProjectCodeReq, WorkflowCodeReq} from './types' +import { DependentTaskReq, ProjectCodeReq, WorkflowCodeReq } from './types' export function queryWorkFlowList(projectCode: ProjectCodeReq): any { return axios({ @@ -42,10 +42,13 @@ export function queryLineageByWorkFlowCode( }) } -export function queryDependentTasks(projectCode: number, params: DependentTaskReq): any { +export function queryDependentTasks( + projectCode: number, + params: DependentTaskReq +): any { return axios({ url: `/projects/${projectCode}/lineages/query-dependent-tasks`, method: 'get', params }) -} \ No newline at end of file +} diff --git a/dolphinscheduler-ui/src/service/modules/login/index.ts b/dolphinscheduler-ui/src/service/modules/login/index.ts index e095f932ae5a..05c40d068cc3 100644 --- a/dolphinscheduler-ui/src/service/modules/login/index.ts +++ b/dolphinscheduler-ui/src/service/modules/login/index.ts @@ -36,13 +36,13 @@ export function ssoLoginUrl(): any { export function getOauth2Provider(): any { return axios({ url: '/oauth2-provider', - method: 'get', + method: 'get' }) } export function clearCookie(): any { return axios({ url: '/cookies', - method: 'delete', + method: 'delete' }) -} \ No newline at end of file +} diff --git a/dolphinscheduler-ui/src/service/modules/login/types.ts b/dolphinscheduler-ui/src/service/modules/login/types.ts index 7765288ceccd..e8c07fdee5e0 100644 --- a/dolphinscheduler-ui/src/service/modules/login/types.ts +++ b/dolphinscheduler-ui/src/service/modules/login/types.ts @@ -26,10 +26,10 @@ interface LoginRes { } interface OAuth2Provider { - clientId: string, - redirectUri: string, - provider: string, - authorizationUri: string, + clientId: string + redirectUri: string + provider: string + authorizationUri: string iconUri: string } diff --git a/dolphinscheduler-ui/src/service/modules/projects-preference/index.ts b/dolphinscheduler-ui/src/service/modules/projects-preference/index.ts index 2f4abd377710..e7fd17cc5a7b 100644 --- a/dolphinscheduler-ui/src/service/modules/projects-preference/index.ts +++ b/dolphinscheduler-ui/src/service/modules/projects-preference/index.ts @@ -22,9 +22,7 @@ import { UpdateProjectPreferenceStateReq } from './types' -export function queryProjectPreferenceByProjectCode( - projectCode: number -): any { +export function queryProjectPreferenceByProjectCode(projectCode: number): any { return axios({ url: `/projects/${projectCode}/project-preference`, method: 'get' @@ -43,12 +41,12 @@ export function updateProjectPreference( } export function updateProjectPreferenceState( - data: UpdateProjectPreferenceStateReq, - projectCode: number, + data: UpdateProjectPreferenceStateReq, + projectCode: number ): any { return axios({ url: `/projects/${projectCode}/project-preference`, method: 'post', data }) -} \ No newline at end of file +} diff --git a/dolphinscheduler-ui/src/service/modules/projects-preference/types.ts b/dolphinscheduler-ui/src/service/modules/projects-preference/types.ts index e13476209c16..c17f7ef12b3b 100644 --- a/dolphinscheduler-ui/src/service/modules/projects-preference/types.ts +++ b/dolphinscheduler-ui/src/service/modules/projects-preference/types.ts @@ -15,7 +15,6 @@ * limitations under the License. */ - interface ProjectPreferenceReq { projectPreferences: string } diff --git a/dolphinscheduler-ui/src/service/modules/projects-worker-group/index.ts b/dolphinscheduler-ui/src/service/modules/projects-worker-group/index.ts index 7e280e28aec2..4cf205733bac 100644 --- a/dolphinscheduler-ui/src/service/modules/projects-worker-group/index.ts +++ b/dolphinscheduler-ui/src/service/modules/projects-worker-group/index.ts @@ -16,11 +16,9 @@ */ import { axios } from '@/service/service' -import { UpdateProjectWorkerGroupsReq } from "@/service/modules/projects-worker-group/types"; +import { UpdateProjectWorkerGroupsReq } from '@/service/modules/projects-worker-group/types' -export function queryWorkerGroupsByProjectCode( - projectCode: number -): any { +export function queryWorkerGroupsByProjectCode(projectCode: number): any { return axios({ url: `/projects/${projectCode}/worker-group`, method: 'get' @@ -36,4 +34,4 @@ export function assignWorkerGroups( method: 'post', data }) -} \ No newline at end of file +} diff --git a/dolphinscheduler-ui/src/service/modules/projects-worker-group/types.ts b/dolphinscheduler-ui/src/service/modules/projects-worker-group/types.ts index c91ed7e95f15..939a781b67b9 100644 --- a/dolphinscheduler-ui/src/service/modules/projects-worker-group/types.ts +++ b/dolphinscheduler-ui/src/service/modules/projects-worker-group/types.ts @@ -23,12 +23,8 @@ interface ProjectWorkerGroup { updateTime: string } - interface UpdateProjectWorkerGroupsReq { workerGroups: string } -export { - ProjectWorkerGroup, - UpdateProjectWorkerGroupsReq -} +export { ProjectWorkerGroup, UpdateProjectWorkerGroupsReq } diff --git a/dolphinscheduler-ui/src/service/modules/projects/index.ts b/dolphinscheduler-ui/src/service/modules/projects/index.ts index 4690cf52f3b2..b22e0266e76c 100644 --- a/dolphinscheduler-ui/src/service/modules/projects/index.ts +++ b/dolphinscheduler-ui/src/service/modules/projects/index.ts @@ -16,12 +16,7 @@ */ import { axios } from '@/service/service' -import { - ListReq, - ListIdReq, - ProjectsReq, - UserIdReq -} from './types' +import { ListReq, ListIdReq, ProjectsReq, UserIdReq } from './types' export function queryProjectListPaging(params: ListReq): any { return axios({ diff --git a/dolphinscheduler-ui/src/service/modules/projects/types.ts b/dolphinscheduler-ui/src/service/modules/projects/types.ts index 6c66ae3e0b08..b64306be5545 100644 --- a/dolphinscheduler-ui/src/service/modules/projects/types.ts +++ b/dolphinscheduler-ui/src/service/modules/projects/types.ts @@ -60,11 +60,4 @@ interface ProjectRes { start: number } -export { - ListReq, - ListIdReq, - ProjectsReq, - UserIdReq, - ProjectRes, - ProjectList -} +export { ListReq, ListIdReq, ProjectsReq, UserIdReq, ProjectRes, ProjectList } diff --git a/dolphinscheduler-ui/src/service/modules/worker-groups/index.ts b/dolphinscheduler-ui/src/service/modules/worker-groups/index.ts index 75f716f17c1c..acc6eb584c5d 100644 --- a/dolphinscheduler-ui/src/service/modules/worker-groups/index.ts +++ b/dolphinscheduler-ui/src/service/modules/worker-groups/index.ts @@ -54,4 +54,4 @@ export function deleteById(id: IdReq): any { method: 'delete', params: id }) -} \ No newline at end of file +} diff --git a/dolphinscheduler-ui/src/store/timezone/types.ts b/dolphinscheduler-ui/src/store/timezone/types.ts index b79d4afd1b63..8c4e4689a28c 100644 --- a/dolphinscheduler-ui/src/store/timezone/types.ts +++ b/dolphinscheduler-ui/src/store/timezone/types.ts @@ -17,7 +17,7 @@ import { timezoneList } from '@/common/timezone' -type Timezone = typeof timezoneList[number] +type Timezone = (typeof timezoneList)[number] interface timezoneStore { timezone: Timezone diff --git a/dolphinscheduler-ui/src/views/home/use-process-state.ts b/dolphinscheduler-ui/src/views/home/use-process-state.ts index 01de68458bb1..95e9df081cda 100644 --- a/dolphinscheduler-ui/src/views/home/use-process-state.ts +++ b/dolphinscheduler-ui/src/views/home/use-process-state.ts @@ -36,7 +36,7 @@ export function useProcessState() { const { state } = useAsyncState( countProcessInstanceState({ startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'), - endDate: !date ? '' : format(date[1], 'yyyy-MM-dd HH:mm:ss'), + endDate: !date ? '' : format(date[1], 'yyyy-MM-dd HH:mm:ss') }).then((res: WorkflowInstanceCountVo): StateData => { const table = res.workflowInstanceStatusCounts.map((item) => { return { diff --git a/dolphinscheduler-ui/src/views/home/use-task-state.ts b/dolphinscheduler-ui/src/views/home/use-task-state.ts index cb86b915756b..917379e55ba7 100644 --- a/dolphinscheduler-ui/src/views/home/use-task-state.ts +++ b/dolphinscheduler-ui/src/views/home/use-task-state.ts @@ -20,7 +20,7 @@ import { format } from 'date-fns' import { toLower } from 'lodash' import { useI18n } from 'vue-i18n' import { countTaskState } from '@/service/modules/projects-analysis' -import type {TaskInstanceCountVo} from '@/service/modules/projects-analysis/types' +import type { TaskInstanceCountVo } from '@/service/modules/projects-analysis/types' import type { StateData } from './types' import { reactive, ref } from 'vue' @@ -36,7 +36,7 @@ export function useTaskState() { const { state } = useAsyncState( countTaskState({ startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'), - endDate: !date ? '' : format(date[1], 'yyyy-MM-dd HH:mm:ss'), + endDate: !date ? '' : format(date[1], 'yyyy-MM-dd HH:mm:ss') }).then((res: TaskInstanceCountVo): StateData => { const table = res.taskInstanceStatusCounts.map((item, unused) => { return { diff --git a/dolphinscheduler-ui/src/views/login/index.tsx b/dolphinscheduler-ui/src/views/login/index.tsx index 066fa3f4fa47..f8d3d533e1db 100644 --- a/dolphinscheduler-ui/src/views/login/index.tsx +++ b/dolphinscheduler-ui/src/views/login/index.tsx @@ -49,7 +49,13 @@ const login = defineComponent({ window.$message = useMessage() const { state, t, locale } = useForm() const { handleChange } = useTranslate(locale) - const { handleLogin, handleGetOAuth2Provider, oauth2Providers, gotoOAuth2Page, handleRedirect } = useLogin(state) + const { + handleLogin, + handleGetOAuth2Provider, + oauth2Providers, + gotoOAuth2Page, + handleRedirect + } = useLogin(state) const localesStore = useLocalesStore() const themeStore = useThemeStore() @@ -177,15 +183,23 @@ const login = defineComponent({ - {this.oauth2Providers.length > 0 && - {this.t('login.loginWithOAuth2')} - } + {this.oauth2Providers.length > 0 && ( + {this.t('login.loginWithOAuth2')} + )} - - {this.oauth2Providers?.map((e: OAuth2Provider) => { - return (e.iconUri ?
this.gotoOAuth2Page(e)}>
: this.gotoOAuth2Page(e)}>{e.provider}) - })} -
+ + {this.oauth2Providers?.map((e: OAuth2Provider) => { + return e.iconUri ? ( +
this.gotoOAuth2Page(e)}> + {' '} +
+ ) : ( + this.gotoOAuth2Page(e)}> + {e.provider} + + ) + })} +
) diff --git a/dolphinscheduler-ui/src/views/login/use-login.ts b/dolphinscheduler-ui/src/views/login/use-login.ts index 0699af07ed6e..4200888f6b6b 100644 --- a/dolphinscheduler-ui/src/views/login/use-login.ts +++ b/dolphinscheduler-ui/src/views/login/use-login.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { useRouter,useRoute } from 'vue-router' +import { useRouter, useRoute } from 'vue-router' import { clearCookie, getOauth2Provider, login } from '@/service/modules/login' import { getUserInfo } from '@/service/modules/users' import { useUserStore } from '@/store/user/user' @@ -64,8 +64,6 @@ export function useLogin(state: any) { }) } - - const handleGetOAuth2Provider = () => { getOauth2Provider().then((res: Array | []) => { oauth2Providers.value = res @@ -76,7 +74,8 @@ export function useLogin(state: any) { const gotoOAuth2Page = async (oauth2Provider: OAuth2Provider) => { await clearCookie() - window.location.href = `${oauth2Provider.authorizationUri}?client_id=${oauth2Provider.clientId}` + + window.location.href = + `${oauth2Provider.authorizationUri}?client_id=${oauth2Provider.clientId}` + `&response_type=code&redirect_uri=${oauth2Provider.redirectUri}?provider=${oauth2Provider.provider}` } diff --git a/dolphinscheduler-ui/src/views/projects/components/dependencies/dependencies-modal.tsx b/dolphinscheduler-ui/src/views/projects/components/dependencies/dependencies-modal.tsx index fbb09b307134..207673a2a837 100644 --- a/dolphinscheduler-ui/src/views/projects/components/dependencies/dependencies-modal.tsx +++ b/dolphinscheduler-ui/src/views/projects/components/dependencies/dependencies-modal.tsx @@ -15,16 +15,11 @@ * limitations under the License. */ -import { - defineComponent, - PropType, - h, - ref, watch -} from 'vue' +import { defineComponent, PropType, h, ref, watch } from 'vue' import { useI18n } from 'vue-i18n' -import {NEllipsis, NModal, NSpace} from 'naive-ui' -import {IDefinitionData} from "@/views/projects/workflow/definition/types"; -import ButtonLink from "@/components/button-link"; +import { NEllipsis, NModal, NSpace } from 'naive-ui' +import { IDefinitionData } from '@/views/projects/workflow/definition/types' +import ButtonLink from '@/components/button-link' const props = { row: { @@ -68,62 +63,65 @@ export default defineComponent({ } const renderDownstreamDependencies = () => { - return h( - -
{props.content}
-
{t('project.workflow.warning_dependencies')}
- {props.taskLinks.map((item: any) => { - return ( - - {{ - default: () => - h(NEllipsis, - { - style: 'max-width: 350px;line-height: 1.5' - }, - () => item.text - ) - }} - - ) - })} -
- ) + return h( + +
{props.content}
+
{t('project.workflow.warning_dependencies')}
+ {props.taskLinks.map((item: any) => { + return ( + + {{ + default: () => + h( + NEllipsis, + { + style: 'max-width: 350px;line-height: 1.5' + }, + () => item.text + ) + }} + + ) + })} +
+ ) } - watch(()=> props.show, - () => { - showRef.value = props.show - }) + watch( + () => props.show, + () => { + showRef.value = props.show + } + ) - return {renderDownstreamDependencies, confirmToHandle, cancelToHandle, showRef} + return { + renderDownstreamDependencies, + confirmToHandle, + cancelToHandle, + showRef + } }, render() { const { t } = useI18n() return ( - - {{ - default: () => ( - this.renderDownstreamDependencies() - ) - }} - + + {{ + default: () => this.renderDownstreamDependencies() + }} + ) } }) diff --git a/dolphinscheduler-ui/src/views/projects/components/dependencies/use-dependencies.ts b/dolphinscheduler-ui/src/views/projects/components/dependencies/use-dependencies.ts index 0e35cfbb8945..3093aad6699d 100644 --- a/dolphinscheduler-ui/src/views/projects/components/dependencies/use-dependencies.ts +++ b/dolphinscheduler-ui/src/views/projects/components/dependencies/use-dependencies.ts @@ -15,44 +15,73 @@ * limitations under the License. */ -import {DependentTaskReq} from "@/service/modules/lineages/types"; -import {queryDependentTasks} from "@/service/modules/lineages"; -import {TASK_TYPES_MAP} from "@/store/project"; +import { DependentTaskReq } from '@/service/modules/lineages/types' +import { queryDependentTasks } from '@/service/modules/lineages' +import { TASK_TYPES_MAP } from '@/store/project' export function useDependencies() { - - const getDependentTasksBySingleTask = async (projectCode: any, workflowCode: any, taskCode: any) => { - let tasks = [] as any + const getDependentTasksBySingleTask = async ( + projectCode: any, + workflowCode: any, + taskCode: any + ) => { + const tasks = [] as any if (workflowCode && taskCode) { - let dependentTaskReq = {workFlowCode: workflowCode, taskCode: taskCode} as DependentTaskReq + const dependentTaskReq = { + workFlowCode: workflowCode, + taskCode: taskCode + } as DependentTaskReq const res = await queryDependentTasks(projectCode, dependentTaskReq) - res.filter((item: any) => item.processDefinitionCode !== workflowCode && item.taskType === TASK_TYPES_MAP.DEPENDENT.alias) - .forEach((item: any) => { - tasks.push(item.processDefinitionName + '->' + item.taskName) - }) + res + .filter( + (item: any) => + item.processDefinitionCode !== workflowCode && + item.taskType === TASK_TYPES_MAP.DEPENDENT.alias + ) + .forEach((item: any) => { + tasks.push(item.processDefinitionName + '->' + item.taskName) + }) } return tasks } - const getDependentTasksByWorkflow = async (projectCode: any, workflowCode: any) => { - let tasks = [] as any + const getDependentTasksByWorkflow = async ( + projectCode: any, + workflowCode: any + ) => { + const tasks = [] as any if (workflowCode) { - let dependentTaskReq = {workFlowCode: workflowCode} as DependentTaskReq + const dependentTaskReq = { + workFlowCode: workflowCode + } as DependentTaskReq const res = await queryDependentTasks(projectCode, dependentTaskReq) - res.filter((item: any) => item.processDefinitionCode !== workflowCode && item.taskType === TASK_TYPES_MAP.DEPENDENT.alias) - .forEach((item: any) => { - tasks.push(item.processDefinitionName + '->' + item.taskName) - }) + res + .filter( + (item: any) => + item.processDefinitionCode !== workflowCode && + item.taskType === TASK_TYPES_MAP.DEPENDENT.alias + ) + .forEach((item: any) => { + tasks.push(item.processDefinitionName + '->' + item.taskName) + }) } return tasks } - const getDependentTasksByMultipleTasks = async (projectCode: any, workflowCode: any, taskCodes: any[]) => { + const getDependentTasksByMultipleTasks = async ( + projectCode: any, + workflowCode: any, + taskCodes: any[] + ) => { let tasks = [] as any - if (workflowCode && taskCodes?.length>0) { - for(const taskCode of taskCodes) { - const res = await getDependentTasksBySingleTask(projectCode, workflowCode, taskCode) - if (res?.length >0) { + if (workflowCode && taskCodes?.length > 0) { + for (const taskCode of taskCodes) { + const res = await getDependentTasksBySingleTask( + projectCode, + workflowCode, + taskCode + ) + if (res?.length > 0) { tasks = tasks.concat(res) } } @@ -60,11 +89,19 @@ export function useDependencies() { return tasks } - const getDependentTaskLinksByMultipleTasks = async (projectCode: any, workflowCode: any, taskCodes: any[]) => { + const getDependentTaskLinksByMultipleTasks = async ( + projectCode: any, + workflowCode: any, + taskCodes: any[] + ) => { let dependentTaskLinks = [] as any if (workflowCode && projectCode) { for (const taskCode of taskCodes) { - await getDependentTaskLinksByTask(projectCode, workflowCode, taskCode).then((res: any) => { + await getDependentTaskLinksByTask( + projectCode, + workflowCode, + taskCode + ).then((res: any) => { dependentTaskLinks = dependentTaskLinks.concat(res) }) } @@ -73,50 +110,74 @@ export function useDependencies() { } const getDependentTaskLinks = async (projectCode: any, workflowCode: any) => { - let dependentTaskReq = {workFlowCode: workflowCode} as DependentTaskReq - let dependentTaskLinks = [] as any + const dependentTaskReq = { workFlowCode: workflowCode } as DependentTaskReq + const dependentTaskLinks = [] as any if (workflowCode && projectCode) { - await queryDependentTasks(projectCode, dependentTaskReq).then((res: any) => { - res.filter((item: any) => item.processDefinitionCode !== workflowCode && item.taskType === TASK_TYPES_MAP.DEPENDENT.alias) - .forEach((item: any) => { - dependentTaskLinks.push( - { + await queryDependentTasks(projectCode, dependentTaskReq).then( + (res: any) => { + res + .filter( + (item: any) => + item.processDefinitionCode !== workflowCode && + item.taskType === TASK_TYPES_MAP.DEPENDENT.alias + ) + .forEach((item: any) => { + dependentTaskLinks.push({ text: item.processDefinitionName + '->' + item.taskName, show: true, action: () => { - const url = `/projects/${item.projectCode}/workflow/definitions/${item.processDefinitionCode}` + const url = `/projects/${item.projectCode}/workflow/definitions/${item.processDefinitionCode}` window.open(url, '_blank') - }, - } - ) - }) - }) + } + }) + }) + } + ) } return dependentTaskLinks } - const getDependentTaskLinksByTask = async (projectCode: any, workflowCode: any, taskCode: any) => { - let dependentTaskReq = {workFlowCode: workflowCode, taskCode: taskCode} as DependentTaskReq - let dependentTaskLinks = [] as any + const getDependentTaskLinksByTask = async ( + projectCode: any, + workflowCode: any, + taskCode: any + ) => { + const dependentTaskReq = { + workFlowCode: workflowCode, + taskCode: taskCode + } as DependentTaskReq + const dependentTaskLinks = [] as any if (workflowCode && projectCode) { - await queryDependentTasks(projectCode, dependentTaskReq).then((res: any) => { - res.filter((item: any) => item.processDefinitionCode !== workflowCode && item.taskType === TASK_TYPES_MAP.DEPENDENT.alias) - .forEach((item: any) => { - dependentTaskLinks.push( - { + await queryDependentTasks(projectCode, dependentTaskReq).then( + (res: any) => { + res + .filter( + (item: any) => + item.processDefinitionCode !== workflowCode && + item.taskType === TASK_TYPES_MAP.DEPENDENT.alias + ) + .forEach((item: any) => { + dependentTaskLinks.push({ text: item.processDefinitionName + '->' + item.taskName, show: true, action: () => { - const url = `/projects/${item.projectCode}/workflow/definitions/${item.processDefinitionCode}` + const url = `/projects/${item.projectCode}/workflow/definitions/${item.processDefinitionCode}` window.open(url, '_blank') - }, - } - ) - }) - }) + } + }) + }) + } + ) } return dependentTaskLinks } - return { getDependentTasksBySingleTask, getDependentTasksByMultipleTasks, getDependentTaskLinks, getDependentTasksByWorkflow, getDependentTaskLinksByTask, getDependentTaskLinksByMultipleTasks } + return { + getDependentTasksBySingleTask, + getDependentTasksByMultipleTasks, + getDependentTaskLinks, + getDependentTasksByWorkflow, + getDependentTaskLinksByTask, + getDependentTaskLinksByMultipleTasks + } } diff --git a/dolphinscheduler-ui/src/views/projects/list/components/use-worker-group.ts b/dolphinscheduler-ui/src/views/projects/list/components/use-worker-group.ts index 987fcb5bb8d1..2144bce057b4 100644 --- a/dolphinscheduler-ui/src/views/projects/list/components/use-worker-group.ts +++ b/dolphinscheduler-ui/src/views/projects/list/components/use-worker-group.ts @@ -17,14 +17,17 @@ import { useI18n } from 'vue-i18n' import { reactive, ref, SetupContext } from 'vue' -import { Option } from "naive-ui/es/transfer/src/interface" -import { queryAllWorkerGroups } from "@/service/modules/worker-groups" -import { queryWorkerGroupsByProjectCode, assignWorkerGroups } from "@/service/modules/projects-worker-group" -import { UpdateProjectWorkerGroupsReq } from "@/service/modules/projects-worker-group/types" +import { Option } from 'naive-ui/es/transfer/src/interface' +import { queryAllWorkerGroups } from '@/service/modules/worker-groups' +import { + queryWorkerGroupsByProjectCode, + assignWorkerGroups +} from '@/service/modules/projects-worker-group' +import { UpdateProjectWorkerGroupsReq } from '@/service/modules/projects-worker-group/types' export function useWorkerGroup( - props: any, - ctx: SetupContext<('cancelModal' | 'confirmModal')[]> + props: any, + ctx: SetupContext<('cancelModal' | 'confirmModal')[]> ) { const { t } = useI18n() @@ -39,14 +42,18 @@ export function useWorkerGroup( variables.model.workerGroupOptions = [] queryAllWorkerGroups().then((res: any) => { for (const workerGroup of res) { - variables.model.workerGroupOptions.push({label: workerGroup, value: workerGroup, disabled: workerGroup==='default'}) + variables.model.workerGroupOptions.push({ + label: workerGroup, + value: workerGroup, + disabled: workerGroup === 'default' + }) } }) } const initAssignedWorkerGroups = (projectCode: number) => { variables.model.assignedWorkerGroups = ref([] as any) - queryWorkerGroupsByProjectCode(projectCode).then((res: any) =>{ + queryWorkerGroupsByProjectCode(projectCode).then((res: any) => { res.data.forEach((item: any) => { variables.model.assignedWorkerGroups.push(item.workerGroup) }) @@ -56,7 +63,7 @@ export function useWorkerGroup( initOptions() const handleValidate = () => { - if (variables.model?.assignedWorkerGroups.length>0) { + if (variables.model?.assignedWorkerGroups.length > 0) { submitModal() ctx.emit('confirmModal', props.showModalRef) } @@ -64,8 +71,11 @@ export function useWorkerGroup( const submitModal = async () => { if (props.row.code) { - let data: UpdateProjectWorkerGroupsReq = { - workerGroups: variables.model.assignedWorkerGroups.length>0? variables.model.assignedWorkerGroups.join(','):'' + const data: UpdateProjectWorkerGroupsReq = { + workerGroups: + variables.model.assignedWorkerGroups.length > 0 + ? variables.model.assignedWorkerGroups.join(',') + : '' } assignWorkerGroups(data, props.row.code) } diff --git a/dolphinscheduler-ui/src/views/projects/list/components/worker-group-modal.tsx b/dolphinscheduler-ui/src/views/projects/list/components/worker-group-modal.tsx index e84dc4520adc..47b303611b07 100644 --- a/dolphinscheduler-ui/src/views/projects/list/components/worker-group-modal.tsx +++ b/dolphinscheduler-ui/src/views/projects/list/components/worker-group-modal.tsx @@ -22,10 +22,10 @@ import { toRefs, watch } from 'vue' -import { NTransfer} from 'naive-ui' +import { NTransfer } from 'naive-ui' import Modal from '@/components/modal' -import styles from "@/views/security/user-manage/index.module.scss"; -import {useWorkerGroup} from "@/views/projects/list/components/use-worker-group"; +import styles from '@/views/security/user-manage/index.module.scss' +import { useWorkerGroup } from '@/views/projects/list/components/use-worker-group' const props = { showModalRef: { @@ -43,7 +43,8 @@ const WorkerGroupModal = defineComponent({ props, emits: ['cancelModal', 'confirmModal'], setup(props, ctx) { - const { variables, t, handleValidate, initAssignedWorkerGroups } = useWorkerGroup(props, ctx) + const { variables, t, handleValidate, initAssignedWorkerGroups } = + useWorkerGroup(props, ctx) const cancelModal = () => { ctx.emit('cancelModal', props.showModalRef) @@ -56,12 +57,12 @@ const WorkerGroupModal = defineComponent({ } watch( - () => props.showModalRef, - () => { - if (props.showModalRef) { - initAssignedWorkerGroups(props.row.code) - } + () => props.showModalRef, + () => { + if (props.showModalRef) { + initAssignedWorkerGroups(props.row.code) } + } ) return { ...toRefs(variables), t, cancelModal, confirmModal, trim } @@ -69,21 +70,21 @@ const WorkerGroupModal = defineComponent({ render() { const { t } = this return ( - - - + + + ) } }) diff --git a/dolphinscheduler-ui/src/views/projects/list/index.tsx b/dolphinscheduler-ui/src/views/projects/list/index.tsx index 9f687dace78a..3d6c0183f74d 100644 --- a/dolphinscheduler-ui/src/views/projects/list/index.tsx +++ b/dolphinscheduler-ui/src/views/projects/list/index.tsx @@ -29,7 +29,7 @@ import { useTable } from './use-table' import Card from '@/components/card' import Search from '@/components/input-search' import ProjectModal from './components/project-modal' -import WorkerGroupModal from "@/views/projects/list/components/worker-group-modal"; +import WorkerGroupModal from '@/views/projects/list/components/worker-group-modal' const list = defineComponent({ name: 'list', @@ -173,10 +173,10 @@ const list = defineComponent({ onConfirmModal={this.onConfirmModal} /> ) diff --git a/dolphinscheduler-ui/src/views/projects/list/use-table.ts b/dolphinscheduler-ui/src/views/projects/list/use-table.ts index e2a5a97507d5..f3c30e96e8a0 100644 --- a/dolphinscheduler-ui/src/views/projects/list/use-table.ts +++ b/dolphinscheduler-ui/src/views/projects/list/use-table.ts @@ -39,9 +39,9 @@ import { } from '@/common/column-width-config' import type { Router } from 'vue-router' import type { ProjectRes } from '@/service/modules/projects/types' -import {ControlOutlined, DeleteOutlined, EditOutlined} from '@vicons/antd' -import {useUserStore} from "@/store/user/user"; -import {UserInfoRes} from "@/service/modules/users/types"; +import { ControlOutlined, DeleteOutlined, EditOutlined } from '@vicons/antd' +import { useUserStore } from '@/store/user/user' +import { UserInfoRes } from '@/service/modules/users/types' export function useTable() { const { t } = useI18n() @@ -177,31 +177,31 @@ export function useTable() { } ), IS_ADMIN && - h( + h( NTooltip, { trigger: 'hover' }, { trigger: () => - h( - NButton, - { - circle: true, - type: 'info', - size: 'small', - class: 'edit', - onClick: () => { - handleAssign(row) - } - }, - { - icon: () => h(NIcon, null, () => h(ControlOutlined)) - } - ), + h( + NButton, + { + circle: true, + type: 'info', + size: 'small', + class: 'edit', + onClick: () => { + handleAssign(row) + } + }, + { + icon: () => h(NIcon, null, () => h(ControlOutlined)) + } + ), default: () => t('project.list.assign_worker_group') } - ), + ), h( NPopconfirm, { diff --git a/dolphinscheduler-ui/src/views/projects/overview/use-process-state.ts b/dolphinscheduler-ui/src/views/projects/overview/use-process-state.ts index bf8003b1668c..5add218a30d3 100644 --- a/dolphinscheduler-ui/src/views/projects/overview/use-process-state.ts +++ b/dolphinscheduler-ui/src/views/projects/overview/use-process-state.ts @@ -21,7 +21,7 @@ import { countProcessInstanceState } from '@/service/modules/projects-analysis' import { format } from 'date-fns' import { toLower } from 'lodash' import { useI18n } from 'vue-i18n' -import type {WorkflowInstanceCountVo} from '@/service/modules/projects-analysis/types' +import type { WorkflowInstanceCountVo } from '@/service/modules/projects-analysis/types' import type { StateData } from './types' import { reactive, ref } from 'vue' diff --git a/dolphinscheduler-ui/src/views/projects/overview/use-task-state.ts b/dolphinscheduler-ui/src/views/projects/overview/use-task-state.ts index 5282c3de8f2f..f83a918057bc 100644 --- a/dolphinscheduler-ui/src/views/projects/overview/use-task-state.ts +++ b/dolphinscheduler-ui/src/views/projects/overview/use-task-state.ts @@ -21,7 +21,7 @@ import { format } from 'date-fns' import { toLower } from 'lodash' import { useI18n } from 'vue-i18n' import { countTaskState } from '@/service/modules/projects-analysis' -import type {TaskInstanceCountVo} from '@/service/modules/projects-analysis/types' +import type { TaskInstanceCountVo } from '@/service/modules/projects-analysis/types' import type { StateData } from './types' import { reactive, ref } from 'vue' diff --git a/dolphinscheduler-ui/src/views/projects/preference/use-form.ts b/dolphinscheduler-ui/src/views/projects/preference/use-form.ts index d67a61f96cd5..d7a97f509dfa 100644 --- a/dolphinscheduler-ui/src/views/projects/preference/use-form.ts +++ b/dolphinscheduler-ui/src/views/projects/preference/use-form.ts @@ -120,7 +120,7 @@ export function useForm() { ] const restructurePreferencesItems = (preferencesItems: any) => { - for (let item of preferencesItems) { + for (const item of preferencesItems) { if (item.validate?.required) { item.validate.required = false item.span = 12 diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/detail-modal.tsx b/dolphinscheduler-ui/src/views/projects/task/components/node/detail-modal.tsx index 5482b7cb36cb..e6d9398ece39 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/detail-modal.tsx +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/detail-modal.tsx @@ -130,7 +130,7 @@ const NodeDetailModal = defineComponent({ const restructureNodeData = (data: INodeData) => { if (!data?.id) { - for (let item in projectPreferences.value) { + for (const item in projectPreferences.value) { if (projectPreferences.value[item] !== null && item in data) { Object.assign(data, { item: projectPreferences.value[item] }) } diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts index b7b5ca6deb43..4a8e8cf2c0fa 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts @@ -282,8 +282,7 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { if (!dependItem.dependentType) { if (dependItem.depTaskCode == 0) dependItem.dependentType = 'DEPENDENT_ON_WORKFLOW' - else - dependItem.dependentType = 'DEPENDENT_ON_TASK' + else dependItem.dependentType = 'DEPENDENT_ON_TASK' } if (dependItem.projectCode) { itemListOptions.value[itemIndex].definitionCodeOptions = @@ -326,7 +325,8 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { onUpdateValue: (dependentType: string) => { const item = model.dependTaskList[i].dependItemList[j] if (item.definitionCode) - item.depTaskCode = dependentType === 'DEPENDENT_ON_WORKFLOW' ? 0 : -1 + item.depTaskCode = + dependentType === 'DEPENDENT_ON_WORKFLOW' ? 0 : -1 } }, options: DependentTypeOptions, @@ -388,7 +388,8 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { const item = model.dependTaskList[i].dependItemList[j] selectOptions.value[i].dependItemList[j].depTaskCodeOptions = await getTaskList(item.projectCode, processCode) - item.depTaskCode = item.dependentType === 'DEPENDENT_ON_WORKFLOW' ? 0 : -1 + item.depTaskCode = + item.dependentType === 'DEPENDENT_ON_WORKFLOW' ? 0 : -1 } }, options: diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts index e3b95bda8c25..111310a471ea 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts @@ -70,7 +70,7 @@ export function useEnvironmentName( ) if (model?.environmentCode) { if (options.value) { - let elementExists = + const elementExists = options.value.find( (item) => item.value === model.environmentCode ) !== undefined diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-hive-cli.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-hive-cli.ts index 4a7ae3da14c7..b285cc235313 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-hive-cli.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-hive-cli.ts @@ -24,9 +24,7 @@ export function useHiveCli(model: { [field: string]: any }): IJsonItem[] { const hiveSqlScriptSpan = computed(() => model.hiveCliTaskExecutionType === 'SCRIPT' ? 24 : 0 ) - const resourcesRequired = ref( - model.hiveCliTaskExecutionType !== 'SCRIPT' - ) + const resourcesRequired = ref(model.hiveCliTaskExecutionType !== 'SCRIPT') const resourcesLimit = computed(() => model.hiveCliTaskExecutionType === 'SCRIPT' ? -1 : 1 @@ -46,8 +44,7 @@ export function useHiveCli(model: { [field: string]: any }): IJsonItem[] { watch( () => model.hiveCliTaskExecutionType, () => { - resourcesRequired.value = - model.hiveCliTaskExecutionType !== 'SCRIPT' + resourcesRequired.value = model.hiveCliTaskExecutionType !== 'SCRIPT' } ) diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-k8s.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-k8s.ts index ed9d83a6ac7e..8d2a70246464 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-k8s.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-k8s.ts @@ -111,7 +111,6 @@ export function useK8s(model: { [field: string]: any }): IJsonItem[] { ] } - export const IMAGE_PULL_POLICY_LIST = [ { value: 'IfNotPresent', diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-queue.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-queue.ts index c4ca37375bdd..034aba1abdc4 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-queue.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-queue.ts @@ -27,6 +27,6 @@ export function useYarnQueue(): IJsonItem { span: 12, props: { placeholder: t('project.node.yarn_queue_tips') - }, + } } } diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-rules.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-rules.ts index bf9c487fb87c..71fc56cc8e41 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-rules.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-rules.ts @@ -213,19 +213,19 @@ export function useRules( } } if (field === 'target_datasource_id' && typeof value === 'number') { - const result = await getDatasourceDatabasesById(value) - targetDatabaseOptions.value = result || [] - if (reset) { - targetTableOptions.value = [] - targetTableColumnOptions.value = [] - model.target_database = null - model.target_table = null - model.target_field = null - } + const result = await getDatasourceDatabasesById(value) + targetDatabaseOptions.value = result || [] + if (reset) { + targetTableOptions.value = [] + targetTableColumnOptions.value = [] + model.target_database = null + model.target_table = null + model.target_field = null + } } if (field === 'src_database' && typeof value === 'string') { - const result = await getDatasourceTablesById( + const result = await getDatasourceTablesById( model.src_datasource_id, value ) diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-spark.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-spark.ts index f43f68b21829..ad7fb77fa9a7 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-spark.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-spark.ts @@ -39,7 +39,9 @@ export function useSpark(model: { [field: string]: any }): IJsonItem[] { const mainArgsSpan = computed(() => (model.programType === 'SQL' ? 0 : 24)) - const rawScriptSpan = computed(() => (model.programType === 'SQL' && model.sqlExecutionType === 'SCRIPT' ? 24 : 0)) + const rawScriptSpan = computed(() => + model.programType === 'SQL' && model.sqlExecutionType === 'SCRIPT' ? 24 : 0 + ) const showCluster = computed(() => model.programType !== 'SQL') @@ -51,7 +53,9 @@ export function useSpark(model: { [field: string]: any }): IJsonItem[] { model.programType === 'SQL' && model.sqlExecutionType === 'FILE' ? 1 : -1 ) - const sqlExecutionTypeSpan = computed(() => (model.programType === 'SQL' ? 12 : 0)) + const sqlExecutionTypeSpan = computed(() => + model.programType === 'SQL' ? 12 : 0 + ) const SQL_EXECUTION_TYPES = [ { diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts index 01f02de33392..399c88b387a1 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts @@ -15,94 +15,93 @@ * limitations under the License. */ -import {onMounted, ref, Ref, watch} from 'vue' -import {queryDataSourceList} from '@/service/modules/data-source' -import {useI18n} from 'vue-i18n' -import type {IJsonItem, IDataBase} from '../types' -import type {TypeReq} from '@/service/modules/data-source/types' +import { onMounted, ref, Ref, watch } from 'vue' +import { queryDataSourceList } from '@/service/modules/data-source' +import { useI18n } from 'vue-i18n' +import type { IJsonItem, IDataBase } from '../types' +import type { TypeReq } from '@/service/modules/data-source/types' export function useDatasource( - model: { [field: string]: any }, - span: Ref, - fieldType: string, - fieldDatasource: string + model: { [field: string]: any }, + span: Ref, + fieldType: string, + fieldDatasource: string ): IJsonItem[] { - const {t} = useI18n() - const dataSourceList = ref([]) - const loading = ref(false) - const hadoopSourceTypes = ref(['HIVE', 'HDFS']) - const getDataSource = async (type: IDataBase) => { - if (hadoopSourceTypes.value.some(source => source === type)) { - loading.value = false; - return - } - loading.value = true - if (model.modelType === 'import') { - model.sourceMysqlDatasource = model.sourceMysqlDatasource ? model.sourceMysqlDatasource : '' - model.sourceMysqlType = type; - } else { - model.sourceMysqlDatasource = model.targetMysqlDatasource ? model.targetMysqlDatasource : '' - model.targetMysqlType = type; - } - const params = {type, testFlag: 0} as TypeReq - const result = await queryDataSourceList(params) - dataSourceList.value = result.map((item: { name: string; id: number }) => ({ - label: item.name, - value: item.id - })) - loading.value = false + const { t } = useI18n() + const dataSourceList = ref([]) + const loading = ref(false) + const hadoopSourceTypes = ref(['HIVE', 'HDFS']) + const getDataSource = async (type: IDataBase) => { + if (hadoopSourceTypes.value.some((source) => source === type)) { + loading.value = false + return } - onMounted(() => { - getDataSource(model.sourceType) - }) - - watch( - () => [ - model.sourceType, - ], - () => { - getDataSource(model.sourceType) - } - ) + loading.value = true + if (model.modelType === 'import') { + model.sourceMysqlDatasource = model.sourceMysqlDatasource + ? model.sourceMysqlDatasource + : '' + model.sourceMysqlType = type + } else { + model.sourceMysqlDatasource = model.targetMysqlDatasource + ? model.targetMysqlDatasource + : '' + model.targetMysqlType = type + } + const params = { type, testFlag: 0 } as TypeReq + const result = await queryDataSourceList(params) + dataSourceList.value = result.map((item: { name: string; id: number }) => ({ + label: item.name, + value: item.id + })) + loading.value = false + } + onMounted(() => { + getDataSource(model.sourceType) + }) - watch( - () => [ - model.targetType, - ], - () => { - getDataSource(model.targetType) - } - ) - return [ - { - type: 'input', - field: fieldType, - name: t('project.node.datasource'), - span: 0, - validate: { - required: true, + watch( + () => [model.sourceType], + () => { + getDataSource(model.sourceType) + } + ) - } - }, - { - type: 'select', - field: fieldDatasource, - name: t('project.node.datasource'), - span: span, - props: { - placeholder: t('project.node.datasource_tips'), - filterable: true, - loading - }, - options: dataSourceList, - validate: { - trigger: ['blur', 'input'], - validator(validate, value) { - if (!value) { - return new Error(t('project.node.datasource_tips')) - } - } - } + watch( + () => [model.targetType], + () => { + getDataSource(model.targetType) + } + ) + return [ + { + type: 'input', + field: fieldType, + name: t('project.node.datasource'), + span: 0, + validate: { + required: true + } + }, + { + type: 'select', + field: fieldDatasource, + name: t('project.node.datasource'), + span: span, + props: { + placeholder: t('project.node.datasource_tips'), + filterable: true, + loading + }, + options: dataSourceList, + validate: { + trigger: ['blur', 'input'], + validator(validate, value) { + if (!value) { + return new Error(t('project.node.datasource_tips')) + } } - ] + } + } + ] } diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts index 732f1daeab96..d5554e7a1439 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts @@ -15,312 +15,318 @@ * limitations under the License. */ -import {h, onMounted, Ref, ref, watch} from 'vue' -import {useI18n} from 'vue-i18n' -import {useDatasource} from './use-sqoop-datasource' -import {useCustomParams} from '.' +import { h, onMounted, Ref, ref, watch } from 'vue' +import { useI18n } from 'vue-i18n' +import { useDatasource } from './use-sqoop-datasource' +import { useCustomParams } from '.' import styles from '../index.module.scss' -import type {IJsonItem, IOption, ModelType} from '../types' +import type { IJsonItem, IOption, ModelType } from '../types' export function useSourceType( - model: { [field: string]: any }, - unCustomSpan: Ref + model: { [field: string]: any }, + unCustomSpan: Ref ): IJsonItem[] { - const {t} = useI18n() - const rdbmsSpan = ref(24) - const tableSpan = ref(0) - const editorSpan = ref(24) - const columnSpan = ref(0) - const hiveSpan = ref(0) - const hdfsSpan = ref(0) - const datasourceSpan = ref(24) - const isChange: any = ref(false) - const rdbmsSourceTypes = ref([ - { - label: 'MYSQL', - value: 'MYSQL' - }, - { - label: 'ORACLE', - value: 'ORACLE' - }, + const { t } = useI18n() + const rdbmsSpan = ref(24) + const tableSpan = ref(0) + const editorSpan = ref(24) + const columnSpan = ref(0) + const hiveSpan = ref(0) + const hdfsSpan = ref(0) + const datasourceSpan = ref(24) + const isChange: any = ref(false) + const rdbmsSourceTypes = ref([ + { + label: 'MYSQL', + value: 'MYSQL' + }, + { + label: 'ORACLE', + value: 'ORACLE' + }, + { + label: 'SQLSERVER', + value: 'SQLSERVER' + }, + { + label: 'HANA', + value: 'HANA' + } + ] as IOption[]) + const hadoopSourceTypes = ref([ + { + label: 'HIVE', + value: 'HIVE' + }, + { + label: 'HDFS', + value: 'HDFS' + } + ] as IOption[]) + const sourceTypes = ref() + const resetSpan = () => { + rdbmsSpan.value = + unCustomSpan.value && + rdbmsSourceTypes.value.some((source) => source.value === model.sourceType) + ? 24 + : 0 + tableSpan.value = rdbmsSpan.value && model.srcQueryType === '0' ? 24 : 0 + editorSpan.value = rdbmsSpan.value && model.srcQueryType === '1' ? 24 : 0 + columnSpan.value = tableSpan.value && model.srcColumnType === '1' ? 24 : 0 + hiveSpan.value = unCustomSpan.value && model.sourceType === 'HIVE' ? 24 : 0 + hdfsSpan.value = unCustomSpan.value && model.sourceType === 'HDFS' ? 24 : 0 + datasourceSpan.value = + unCustomSpan.value && + rdbmsSourceTypes.value.some((source) => source.value === model.sourceType) + ? 24 + : 0 + } + const resetValue = () => { + if (!isChange.value) { + isChange.value = true + return + } + switch (model.modelType) { + case 'import': + model.sourceMysqlDatasource = '' + break + case 'export': + model.sourceHiveDatabase = '' + model.sourceHiveTable = '' + model.sourceHivePartitionKey = '' + model.sourceHivePartitionValue = '' + model.sourceHdfsExportDir = '' + break + default: + model.sourceMysqlDatasource = '' + } + } + const getSourceTypesByModelType = (modelType: ModelType): IOption[] => { + switch (modelType) { + case 'import': + return rdbmsSourceTypes.value + case 'export': + return hadoopSourceTypes.value + default: + return rdbmsSourceTypes.value + } + } + + onMounted(() => { + sourceTypes.value = [...rdbmsSourceTypes.value] + }) + + watch( + () => model.modelType, + (modelType: ModelType) => { + sourceTypes.value = getSourceTypesByModelType(modelType) + model.sourceType = sourceTypes.value[0].value + } + ) + watch( + () => [ + unCustomSpan.value, + model.sourceType, + model.srcQueryType, + model.srcColumnType + ], + () => { + resetValue() + resetSpan() + } + ) + + return [ + { + type: 'custom', + field: 'custom-title-source', + span: unCustomSpan, + widget: h( + 'div', + { class: styles['field-title'] }, + t('project.node.data_source') + ) + }, + { + type: 'select', + field: 'sourceType', + name: t('project.node.type'), + span: unCustomSpan, + options: sourceTypes + }, + ...useDatasource( + model, + datasourceSpan, + 'sourceMysqlType', + 'sourceMysqlDatasource' + ), + { + type: 'radio', + field: 'srcQueryType', + name: t('project.node.model_type'), + span: rdbmsSpan, + options: [ { - label: 'SQLSERVER', - value: 'SQLSERVER' + label: t('project.node.form'), + value: '0' }, { - label: 'HANA', - value: 'HANA' + label: 'SQL', + value: '1' } - ] as IOption[]) - const hadoopSourceTypes = ref([ - { - label: 'HIVE', - value: 'HIVE' - }, { - label: 'HDFS', - value: 'HDFS' + ], + props: { + 'on-update:value': (value: '0' | '1') => { + model.targetType = value === '0' ? 'HIVE' : 'HDFS' } - ] as IOption[]) - const sourceTypes = ref() - const resetSpan = () => { - rdbmsSpan.value = - unCustomSpan.value && rdbmsSourceTypes.value.some(source => source.value === model.sourceType) ? 24 : 0 - tableSpan.value = rdbmsSpan.value && model.srcQueryType === '0' ? 24 : 0 - editorSpan.value = rdbmsSpan.value && model.srcQueryType === '1' ? 24 : 0 - columnSpan.value = tableSpan.value && model.srcColumnType === '1' ? 24 : 0 - hiveSpan.value = unCustomSpan.value && model.sourceType === 'HIVE' ? 24 : 0 - hdfsSpan.value = unCustomSpan.value && model.sourceType === 'HDFS' ? 24 : 0 - datasourceSpan.value = - unCustomSpan.value && rdbmsSourceTypes.value.some(source => source.value === model.sourceType) ? 24 : 0 - } - const resetValue = () => { - if (!isChange.value) { - isChange.value = true - return + } + }, + { + type: 'input', + field: 'srcTable', + name: t('project.node.table'), + span: tableSpan, + props: { + placeholder: t('project.node.table_tips') + }, + validate: { + trigger: ['input', 'blur'], + required: true, + validator(validate, value) { + if (tableSpan.value && !value) { + return new Error(t('project.node.table_tips')) + } } - switch (model.modelType) { - case 'import': - model.sourceMysqlDatasource = '' - break - case 'export': - model.sourceHiveDatabase = '' - model.sourceHiveTable = '' - model.sourceHivePartitionKey = '' - model.sourceHivePartitionValue = '' - model.sourceHdfsExportDir = '' - break - default: - model.sourceMysqlDatasource = '' + } + }, + { + type: 'radio', + field: 'srcColumnType', + name: t('project.node.column_type'), + span: tableSpan, + options: [ + { label: t('project.node.all_columns'), value: '0' }, + { label: t('project.node.some_columns'), value: '1' } + ] + }, + { + type: 'input', + field: 'srcColumns', + name: t('project.node.column'), + span: columnSpan, + props: { + placeholder: t('project.node.column_tips') + }, + validate: { + trigger: ['input', 'blur'], + required: true, + validator(validate, value) { + if (!!columnSpan.value && !value) { + return new Error(t('project.node.column_tips')) + } } - - } - const getSourceTypesByModelType = (modelType: ModelType): IOption[] => { - switch (modelType) { - case 'import': - return rdbmsSourceTypes.value - case 'export': - return hadoopSourceTypes.value - default: - return rdbmsSourceTypes.value + } + }, + { + type: 'input', + field: 'sourceHiveDatabase', + name: t('project.node.database'), + span: hiveSpan, + props: { + placeholder: t('project.node.database_tips') + }, + validate: { + trigger: ['blur', 'input'], + required: true, + validator(validate, value) { + if (hiveSpan.value && !value) { + return new Error(t('project.node.database_tips')) + } } - } - - onMounted(() => { - sourceTypes.value = [...rdbmsSourceTypes.value]; - }) - - watch( - () => model.modelType, - (modelType: ModelType) => { - sourceTypes.value = getSourceTypesByModelType(modelType) - model.sourceType = sourceTypes.value[0].value + } + }, + { + type: 'input', + field: 'sourceHiveTable', + name: t('project.node.table'), + span: hiveSpan, + props: { + placeholder: t('project.node.hive_table_tips') + }, + validate: { + trigger: ['blur', 'input'], + required: true, + validator(validate, value) { + if (hiveSpan.value && !value) { + return new Error(t('project.node.hive_table_tips')) + } } - ) - watch( - () => [ - unCustomSpan.value, - model.sourceType, - model.srcQueryType, - model.srcColumnType - ], - () => { - resetValue(); - resetSpan(); + } + }, + { + type: 'input', + field: 'sourceHivePartitionKey', + name: t('project.node.hive_partition_keys'), + span: hiveSpan, + props: { + placeholder: t('project.node.hive_partition_keys_tips') + } + }, + { + type: 'input', + field: 'sourceHivePartitionValue', + name: t('project.node.hive_partition_values'), + span: hiveSpan, + props: { + placeholder: t('project.node.hive_partition_values_tips') + } + }, + { + type: 'input', + field: 'sourceHdfsExportDir', + name: t('project.node.export_dir'), + span: hdfsSpan, + props: { + placeholder: t('project.node.export_dir_tips') + }, + validate: { + trigger: ['blur', 'input'], + required: true, + validator(validate, value) { + if (hdfsSpan.value && !value) { + return new Error(t('project.node.export_dir_tips')) + } } - ) - - return [ - { - type: 'custom', - field: 'custom-title-source', - span: unCustomSpan, - widget: h( - 'div', - {class: styles['field-title']}, - t('project.node.data_source') - ) - }, - { - type: 'select', - field: 'sourceType', - name: t('project.node.type'), - span: unCustomSpan, - options: sourceTypes - }, - ...useDatasource( - model, - datasourceSpan, - 'sourceMysqlType', - 'sourceMysqlDatasource' - ), - { - type: 'radio', - field: 'srcQueryType', - name: t('project.node.model_type'), - span: rdbmsSpan, - options: [ - { - label: t('project.node.form'), - value: '0' - }, - { - label: 'SQL', - value: '1' - } - ], - props: { - 'on-update:value': (value: '0' | '1') => { - model.targetType = value === '0' ? 'HIVE' : 'HDFS' - } - } - }, - { - type: 'input', - field: 'srcTable', - name: t('project.node.table'), - span: tableSpan, - props: { - placeholder: t('project.node.table_tips') - }, - validate: { - trigger: ['input', 'blur'], - required: true, - validator(validate, value) { - if (tableSpan.value && !value) { - return new Error(t('project.node.table_tips')) - } - } - } - }, - { - type: 'radio', - field: 'srcColumnType', - name: t('project.node.column_type'), - span: tableSpan, - options: [ - {label: t('project.node.all_columns'), value: '0'}, - {label: t('project.node.some_columns'), value: '1'} - ] - }, - { - type: 'input', - field: 'srcColumns', - name: t('project.node.column'), - span: columnSpan, - props: { - placeholder: t('project.node.column_tips') - }, - validate: { - trigger: ['input', 'blur'], - required: true, - validator(validate, value) { - if (!!columnSpan.value && !value) { - return new Error(t('project.node.column_tips')) - } - } - } - }, - { - type: 'input', - field: 'sourceHiveDatabase', - name: t('project.node.database'), - span: hiveSpan, - props: { - placeholder: t('project.node.database_tips') - }, - validate: { - trigger: ['blur', 'input'], - required: true, - validator(validate, value) { - if (hiveSpan.value && !value) { - return new Error(t('project.node.database_tips')) - } - } - } - }, - { - type: 'input', - field: 'sourceHiveTable', - name: t('project.node.table'), - span: hiveSpan, - props: { - placeholder: t('project.node.hive_table_tips') - }, - validate: { - trigger: ['blur', 'input'], - required: true, - validator(validate, value) { - if (hiveSpan.value && !value) { - return new Error(t('project.node.hive_table_tips')) - } - } - } - }, - { - type: 'input', - field: 'sourceHivePartitionKey', - name: t('project.node.hive_partition_keys'), - span: hiveSpan, - props: { - placeholder: t('project.node.hive_partition_keys_tips') - } - }, - { - type: 'input', - field: 'sourceHivePartitionValue', - name: t('project.node.hive_partition_values'), - span: hiveSpan, - props: { - placeholder: t('project.node.hive_partition_values_tips') - } - }, - { - type: 'input', - field: 'sourceHdfsExportDir', - name: t('project.node.export_dir'), - span: hdfsSpan, - props: { - placeholder: t('project.node.export_dir_tips') - }, - validate: { - trigger: ['blur', 'input'], - required: true, - validator(validate, value) { - if (hdfsSpan.value && !value) { - return new Error(t('project.node.export_dir_tips')) - } - } - } - }, - { - type: 'editor', - field: 'sourceMysqlSrcQuerySql', - name: t('project.node.sql_statement'), - span: editorSpan, - validate: { - trigger: ['blur', 'input'], - required: true, - validator(validate, value) { - if (editorSpan.value && !value) { - return new Error(t('project.node.sql_statement_tips')) - } - } - } - }, - ...useCustomParams({ - model, - field: 'mapColumnHive', - name: 'map_column_hive', - isSimple: true, - span: rdbmsSpan - }), - ...useCustomParams({ - model, - field: 'mapColumnJava', - name: 'map_column_java', - isSimple: true, - span: rdbmsSpan - }) - ] + } + }, + { + type: 'editor', + field: 'sourceMysqlSrcQuerySql', + name: t('project.node.sql_statement'), + span: editorSpan, + validate: { + trigger: ['blur', 'input'], + required: true, + validator(validate, value) { + if (editorSpan.value && !value) { + return new Error(t('project.node.sql_statement_tips')) + } + } + } + }, + ...useCustomParams({ + model, + field: 'mapColumnHive', + name: 'map_column_hive', + isSimple: true, + span: rdbmsSpan + }), + ...useCustomParams({ + model, + field: 'mapColumnJava', + name: 'map_column_java', + isSimple: true, + span: rdbmsSpan + }) + ] } diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts index 24219281cff0..252ef7631a90 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts @@ -15,407 +15,413 @@ * limitations under the License. */ -import {h, onMounted, Ref, ref, watch} from 'vue' -import {useI18n} from 'vue-i18n' -import {useDatasource} from './use-sqoop-datasource' +import { h, onMounted, Ref, ref, watch } from 'vue' +import { useI18n } from 'vue-i18n' +import { useDatasource } from './use-sqoop-datasource' import styles from '../index.module.scss' -import type {IJsonItem, IOption, SourceType} from '../types' +import type { IJsonItem, IOption, SourceType } from '../types' export function useTargetType( - model: { [field: string]: any }, - unCustomSpan: Ref + model: { [field: string]: any }, + unCustomSpan: Ref ): IJsonItem[] { - const {t} = useI18n() - const hiveSpan = ref(24) - const hdfsSpan = ref(0) - const rdbmsSpan = ref(0) - const dataSourceSpan = ref(0) - const updateSpan = ref(0) - const isChange: any = ref(false) - const rdbmsSourceTypes = ref([ - { - label: 'MYSQL', - value: 'MYSQL' - }, - { - label: 'ORACLE', - value: 'ORACLE' - }, - { - label: 'SQLSERVER', - value: 'SQLSERVER' - }, - { - label: 'HANA', - value: 'HANA' - } - ] as IOption[]) - const hadoopSourceTypes = ref([ - { - label: 'HIVE', - value: 'HIVE' - }, { - label: 'HDFS', - value: 'HDFS' - } - ] as IOption[]) - const targetTypes = ref() - - const resetSpan = () => { - hiveSpan.value = unCustomSpan.value && model.targetType === 'HIVE' ? 24 : 0 - hdfsSpan.value = unCustomSpan.value && model.targetType === 'HDFS' ? 24 : 0 - rdbmsSpan.value = - unCustomSpan.value && rdbmsSourceTypes.value.some(target => target.value === model.targetType) ? 24 : 0 - dataSourceSpan.value = - unCustomSpan.value && rdbmsSourceTypes.value.some(target => target.value === model.targetType) ? 24 : 0 - updateSpan.value = rdbmsSpan.value && model.targetMysqlIsUpdate ? 24 : 0 + const { t } = useI18n() + const hiveSpan = ref(24) + const hdfsSpan = ref(0) + const rdbmsSpan = ref(0) + const dataSourceSpan = ref(0) + const updateSpan = ref(0) + const isChange: any = ref(false) + const rdbmsSourceTypes = ref([ + { + label: 'MYSQL', + value: 'MYSQL' + }, + { + label: 'ORACLE', + value: 'ORACLE' + }, + { + label: 'SQLSERVER', + value: 'SQLSERVER' + }, + { + label: 'HANA', + value: 'HANA' + } + ] as IOption[]) + const hadoopSourceTypes = ref([ + { + label: 'HIVE', + value: 'HIVE' + }, + { + label: 'HDFS', + value: 'HDFS' } + ] as IOption[]) + const targetTypes = ref() - const getTargetTypesBySourceType = ( - sourceType: SourceType, - srcQueryType: string - ): IOption[] => { - switch (sourceType) { - case 'MYSQL': - if (srcQueryType === '1') { - return hadoopSourceTypes.value - } - return hadoopSourceTypes.value - case 'HDFS': - case 'HIVE': - return rdbmsSourceTypes.value - default: - return hadoopSourceTypes.value + const resetSpan = () => { + hiveSpan.value = unCustomSpan.value && model.targetType === 'HIVE' ? 24 : 0 + hdfsSpan.value = unCustomSpan.value && model.targetType === 'HDFS' ? 24 : 0 + rdbmsSpan.value = + unCustomSpan.value && + rdbmsSourceTypes.value.some((target) => target.value === model.targetType) + ? 24 + : 0 + dataSourceSpan.value = + unCustomSpan.value && + rdbmsSourceTypes.value.some((target) => target.value === model.targetType) + ? 24 + : 0 + updateSpan.value = rdbmsSpan.value && model.targetMysqlIsUpdate ? 24 : 0 + } + + const getTargetTypesBySourceType = ( + sourceType: SourceType, + srcQueryType: string + ): IOption[] => { + switch (sourceType) { + case 'MYSQL': + if (srcQueryType === '1') { + return hadoopSourceTypes.value } + return hadoopSourceTypes.value + case 'HDFS': + case 'HIVE': + return rdbmsSourceTypes.value + default: + return hadoopSourceTypes.value } + } - const resetValue = () => { - if (!isChange.value) { - isChange.value = true - return - } - switch (model.modelType) { - case 'import': - model.targetHiveDatabase = ''; - model.targetHiveTable = ''; - model.targetHdfsTargetPath = ''; - break - case 'export': - model.targetMysqlDatasource = ''; - model.targetMysqlTable = ''; - model.targetMysqlColumns = ''; - model.targetMysqlFieldsTerminated = ''; - model.targetMysqlLinesTerminated = ''; - model.targetMysqlTable = ''; - break - default: - model.sourceMysqlDatasource = ''; - } + const resetValue = () => { + if (!isChange.value) { + isChange.value = true + return + } + switch (model.modelType) { + case 'import': + model.targetHiveDatabase = '' + model.targetHiveTable = '' + model.targetHdfsTargetPath = '' + break + case 'export': + model.targetMysqlDatasource = '' + model.targetMysqlTable = '' + model.targetMysqlColumns = '' + model.targetMysqlFieldsTerminated = '' + model.targetMysqlLinesTerminated = '' + model.targetMysqlTable = '' + break + default: + model.sourceMysqlDatasource = '' + } + } + + onMounted(() => { + targetTypes.value = [...hadoopSourceTypes.value] + }) + watch( + () => [model.sourceType, model.srcQueryType], + ([sourceType, srcQueryType]) => { + targetTypes.value = getTargetTypesBySourceType(sourceType, srcQueryType) + model.targetType = targetTypes.value[0].value } + ) - onMounted(() => { - targetTypes.value = [...hadoopSourceTypes.value]; - }) + watch( + () => [unCustomSpan.value, model.targetType, model.targetMysqlIsUpdate], + () => { + resetValue() + resetSpan() + } + ) - watch( - () => [model.sourceType, model.srcQueryType], - ([sourceType, srcQueryType]) => { - targetTypes.value = getTargetTypesBySourceType(sourceType, srcQueryType) - model.targetType = targetTypes.value[0].value + return [ + { + type: 'custom', + field: 'custom-title-target', + span: unCustomSpan, + widget: h( + 'div', + { class: styles['field-title'] }, + t('project.node.data_target') + ) + }, + { + type: 'select', + field: 'targetType', + name: t('project.node.type'), + span: unCustomSpan, + options: targetTypes + }, + { + type: 'input', + field: 'targetHiveDatabase', + name: t('project.node.database'), + span: hiveSpan, + props: { + placeholder: t('project.node.database_tips') + }, + validate: { + trigger: ['blur', 'input'], + required: true, + validator(validate, value) { + if (hiveSpan.value && !value) { + return new Error(t('project.node.database_tips')) + } } - ) - - watch( - () => [unCustomSpan.value, model.targetType, model.targetMysqlIsUpdate], - () => { - resetValue(); - resetSpan() + } + }, + { + type: 'input', + field: 'targetHiveTable', + name: t('project.node.table'), + span: hiveSpan, + props: { + placeholder: t('project.node.table') + }, + validate: { + trigger: ['blur', 'input'], + required: true, + validator(rule, value) { + if (hiveSpan.value && !value) { + return new Error(t('project.node.table_tips')) + } } - ) - - return [ - { - type: 'custom', - field: 'custom-title-target', - span: unCustomSpan, - widget: h( - 'div', - {class: styles['field-title']}, - t('project.node.data_target') - ) - }, - { - type: 'select', - field: 'targetType', - name: t('project.node.type'), - span: unCustomSpan, - options: targetTypes - }, - { - type: 'input', - field: 'targetHiveDatabase', - name: t('project.node.database'), - span: hiveSpan, - props: { - placeholder: t('project.node.database_tips') - }, - validate: { - trigger: ['blur', 'input'], - required: true, - validator(validate, value) { - if (hiveSpan.value && !value) { - return new Error(t('project.node.database_tips')) - } - } - } - }, - { - type: 'input', - field: 'targetHiveTable', - name: t('project.node.table'), - span: hiveSpan, - props: { - placeholder: t('project.node.table') - }, - validate: { - trigger: ['blur', 'input'], - required: true, - validator(rule, value) { - if (hiveSpan.value && !value) { - return new Error(t('project.node.table_tips')) - } - } - } - }, - { - type: 'switch', - field: 'targetHiveCreateTable', - span: hiveSpan, - name: t('project.node.create_hive_table') - }, - { - type: 'switch', - field: 'targetHiveDropDelimiter', - span: hiveSpan, - name: t('project.node.drop_delimiter') - }, - { - type: 'switch', - field: 'targetHiveOverWrite', - span: hiveSpan, - name: t('project.node.over_write_src') - }, - { - type: 'input', - field: 'targetHiveTargetDir', - name: t('project.node.hive_target_dir'), - span: hiveSpan, - props: { - placeholder: t('project.node.hive_target_dir_tips') - } - }, - { - type: 'input', - field: 'targetHiveReplaceDelimiter', - name: t('project.node.replace_delimiter'), - span: hiveSpan, - props: { - placeholder: t('project.node.replace_delimiter_tips') - } - }, - { - type: 'input', - field: 'targetHivePartitionKey', - name: t('project.node.hive_partition_keys'), - span: hiveSpan, - props: { - placeholder: t('project.node.hive_partition_keys_tips') - } - }, - { - type: 'input', - field: 'targetHivePartitionValue', - name: t('project.node.hive_partition_values'), - span: hiveSpan, - props: { - placeholder: t('project.node.hive_partition_values_tips') - } - }, - { - type: 'input', - field: 'targetHdfsTargetPath', - name: t('project.node.target_dir'), - span: hdfsSpan, - props: { - placeholder: t('project.node.target_dir_tips') - }, - validate: { - trigger: ['blur', 'input'], - required: true, - validator(rule, value) { - if (hdfsSpan.value && !value) { - return new Error(t('project.node.target_dir_tips')) - } - } - } - }, - { - type: 'switch', - field: 'targetHdfsDeleteTargetDir', - name: t('project.node.delete_target_dir'), - span: hdfsSpan - }, - { - type: 'radio', - field: 'targetHdfsCompressionCodec', - name: t('project.node.compression_codec'), - span: hdfsSpan, - options: COMPRESSIONCODECS - }, - { - type: 'radio', - field: 'targetHdfsFileType', - name: t('project.node.file_type'), - span: hdfsSpan, - options: FILETYPES - }, - { - type: 'input', - field: 'targetHdfsFieldsTerminated', - name: t('project.node.fields_terminated'), - span: hdfsSpan, - props: { - placeholder: t('project.node.fields_terminated_tips') - } - }, - { - type: 'input', - field: 'targetHdfsLinesTerminated', - name: t('project.node.lines_terminated'), - span: hdfsSpan, - props: { - placeholder: t('project.node.lines_terminated_tips') - } - }, - ...useDatasource( - model, - dataSourceSpan, - 'targetMysqlType', - 'targetMysqlDatasource' - ), - { - type: 'input', - field: 'targetMysqlTable', - name: t('project.node.table'), - span: rdbmsSpan, - props: { - placeholder: t('project.node.table_tips') - }, - validate: { - trigger: ['blur', 'input'], - required: true, - validator(validate, value) { - if (rdbmsSpan.value && !value) { - return new Error(t('project.node.table_tips')) - } - } - } - }, - { - type: 'input', - field: 'targetMysqlColumns', - name: t('project.node.column'), - span: rdbmsSpan, - props: { - placeholder: t('project.node.column_tips') - } - }, - { - type: 'input', - field: 'targetMysqlFieldsTerminated', - name: t('project.node.fields_terminated'), - span: rdbmsSpan, - props: { - placeholder: t('project.node.fields_terminated_tips') - } - }, - { - type: 'input', - field: 'targetMysqlLinesTerminated', - name: t('project.node.lines_terminated'), - span: rdbmsSpan, - props: { - placeholder: t('project.node.lines_terminated_tips') - } - }, - { - type: 'switch', - field: 'targetMysqlIsUpdate', - span: rdbmsSpan, - name: t('project.node.is_update') - }, - { - type: 'input', - field: 'targetMysqlTargetUpdateKey', - name: t('project.node.update_key'), - span: updateSpan, - props: { - placeholder: t('project.node.update_key_tips') - } - }, - { - type: 'radio', - field: 'targetMysqlUpdateMode', - name: t('project.node.update_mode'), - span: updateSpan, - options: [ - { - label: t('project.node.only_update'), - value: 'updateonly' - }, - { - label: t('project.node.allow_insert'), - value: 'allowinsert' - } - ] + } + }, + { + type: 'switch', + field: 'targetHiveCreateTable', + span: hiveSpan, + name: t('project.node.create_hive_table') + }, + { + type: 'switch', + field: 'targetHiveDropDelimiter', + span: hiveSpan, + name: t('project.node.drop_delimiter') + }, + { + type: 'switch', + field: 'targetHiveOverWrite', + span: hiveSpan, + name: t('project.node.over_write_src') + }, + { + type: 'input', + field: 'targetHiveTargetDir', + name: t('project.node.hive_target_dir'), + span: hiveSpan, + props: { + placeholder: t('project.node.hive_target_dir_tips') + } + }, + { + type: 'input', + field: 'targetHiveReplaceDelimiter', + name: t('project.node.replace_delimiter'), + span: hiveSpan, + props: { + placeholder: t('project.node.replace_delimiter_tips') + } + }, + { + type: 'input', + field: 'targetHivePartitionKey', + name: t('project.node.hive_partition_keys'), + span: hiveSpan, + props: { + placeholder: t('project.node.hive_partition_keys_tips') + } + }, + { + type: 'input', + field: 'targetHivePartitionValue', + name: t('project.node.hive_partition_values'), + span: hiveSpan, + props: { + placeholder: t('project.node.hive_partition_values_tips') + } + }, + { + type: 'input', + field: 'targetHdfsTargetPath', + name: t('project.node.target_dir'), + span: hdfsSpan, + props: { + placeholder: t('project.node.target_dir_tips') + }, + validate: { + trigger: ['blur', 'input'], + required: true, + validator(rule, value) { + if (hdfsSpan.value && !value) { + return new Error(t('project.node.target_dir_tips')) + } } - ] -} - -const COMPRESSIONCODECS = [ + } + }, { - label: 'snappy', - value: 'snappy' + type: 'switch', + field: 'targetHdfsDeleteTargetDir', + name: t('project.node.delete_target_dir'), + span: hdfsSpan }, { - label: 'lzo', - value: 'lzo' + type: 'radio', + field: 'targetHdfsCompressionCodec', + name: t('project.node.compression_codec'), + span: hdfsSpan, + options: COMPRESSIONCODECS }, { - label: 'gzip', - value: 'gzip' + type: 'radio', + field: 'targetHdfsFileType', + name: t('project.node.file_type'), + span: hdfsSpan, + options: FILETYPES }, { - label: 'no', - value: '' - } -] -const FILETYPES = [ + type: 'input', + field: 'targetHdfsFieldsTerminated', + name: t('project.node.fields_terminated'), + span: hdfsSpan, + props: { + placeholder: t('project.node.fields_terminated_tips') + } + }, + { + type: 'input', + field: 'targetHdfsLinesTerminated', + name: t('project.node.lines_terminated'), + span: hdfsSpan, + props: { + placeholder: t('project.node.lines_terminated_tips') + } + }, + ...useDatasource( + model, + dataSourceSpan, + 'targetMysqlType', + 'targetMysqlDatasource' + ), { - label: 'avro', - value: '--as-avrodatafile' + type: 'input', + field: 'targetMysqlTable', + name: t('project.node.table'), + span: rdbmsSpan, + props: { + placeholder: t('project.node.table_tips') + }, + validate: { + trigger: ['blur', 'input'], + required: true, + validator(validate, value) { + if (rdbmsSpan.value && !value) { + return new Error(t('project.node.table_tips')) + } + } + } }, { - label: 'sequence', - value: '--as-sequencefile' + type: 'input', + field: 'targetMysqlColumns', + name: t('project.node.column'), + span: rdbmsSpan, + props: { + placeholder: t('project.node.column_tips') + } }, { - label: 'text', - value: '--as-textfile' + type: 'input', + field: 'targetMysqlFieldsTerminated', + name: t('project.node.fields_terminated'), + span: rdbmsSpan, + props: { + placeholder: t('project.node.fields_terminated_tips') + } }, { - label: 'parquet', - value: '--as-parquetfile' + type: 'input', + field: 'targetMysqlLinesTerminated', + name: t('project.node.lines_terminated'), + span: rdbmsSpan, + props: { + placeholder: t('project.node.lines_terminated_tips') + } + }, + { + type: 'switch', + field: 'targetMysqlIsUpdate', + span: rdbmsSpan, + name: t('project.node.is_update') + }, + { + type: 'input', + field: 'targetMysqlTargetUpdateKey', + name: t('project.node.update_key'), + span: updateSpan, + props: { + placeholder: t('project.node.update_key_tips') + } + }, + { + type: 'radio', + field: 'targetMysqlUpdateMode', + name: t('project.node.update_mode'), + span: updateSpan, + options: [ + { + label: t('project.node.only_update'), + value: 'updateonly' + }, + { + label: t('project.node.allow_insert'), + value: 'allowinsert' + } + ] } + ] +} + +const COMPRESSIONCODECS = [ + { + label: 'snappy', + value: 'snappy' + }, + { + label: 'lzo', + value: 'lzo' + }, + { + label: 'gzip', + value: 'gzip' + }, + { + label: 'no', + value: '' + } +] +const FILETYPES = [ + { + label: 'avro', + value: '--as-avrodatafile' + }, + { + label: 'sequence', + value: '--as-sequencefile' + }, + { + label: 'text', + value: '--as-textfile' + }, + { + label: 'parquet', + value: '--as-parquetfile' + } ] diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-worker-group.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-worker-group.ts index d6ec1f6b8d52..9b452b541a89 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-worker-group.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-worker-group.ts @@ -30,7 +30,10 @@ export function useWorkerGroup(projectCode: number): IJsonItem { if (loading.value) return loading.value = true await queryWorkerGroupsByProjectCode(projectCode).then((res: any) => { - options.value = res.data.map((item: any) =>({label: item.workerGroup, value: item.workerGroup })) + options.value = res.data.map((item: any) => ({ + label: item.workerGroup, + value: item.workerGroup + })) }) loading.value = false } diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts index 1c9e072fbff3..ef9e5dec610b 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts @@ -25,7 +25,7 @@ import type { ILocalParam, IDependentParameters } from './types' -import {ref} from "vue"; +import { ref } from 'vue' export function formatParams(data: INodeData): { processDefinitionCode: string @@ -132,7 +132,9 @@ export function formatParams(data: INodeData): { fieldsTerminated: data.targetHdfsFieldsTerminated, linesTerminated: data.targetHdfsLinesTerminated } - } else if (rdbmsSourceTypes.value.some(target => target === data.targetType)){ + } else if ( + rdbmsSourceTypes.value.some((target) => target === data.targetType) + ) { targetParams = { targetType: data.targetMysqlType, targetDatasource: data.targetMysqlDatasource, @@ -145,16 +147,16 @@ export function formatParams(data: INodeData): { targetUpdateMode: data.targetMysqlUpdateMode } } - if (rdbmsSourceTypes.value.some(target => target === data.sourceType)) { + if (rdbmsSourceTypes.value.some((target) => target === data.sourceType)) { sourceParams = { srcTable: data.srcQueryType === '1' ? '' : data.srcTable, srcColumnType: data.srcQueryType === '1' ? '0' : data.srcColumnType, srcColumns: - data.srcQueryType === '1' || data.srcColumnType === '0' - ? '' - : data.srcColumns, + data.srcQueryType === '1' || data.srcColumnType === '0' + ? '' + : data.srcColumns, srcQuerySql: - data.srcQueryType === '0' ? '' : data.sourceMysqlSrcQuerySql, + data.srcQueryType === '0' ? '' : data.sourceMysqlSrcQuerySql, srcQueryType: data.srcQueryType, srcType: data.sourceMysqlType, srcDatasource: data.sourceMysqlDatasource, diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mr.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mr.ts index 0ea09704d372..4552133a201c 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mr.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mr.ts @@ -45,7 +45,7 @@ export function useMr({ timeout: 30, programType: 'SCALA', timeoutNotifyStrategy: ['WARN'], - yarnQueue: '', + yarnQueue: '' } as INodeData) return { diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sqoop.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sqoop.ts index e3e58a059459..f401fb6d2c8c 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sqoop.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sqoop.ts @@ -59,7 +59,7 @@ export function useSqoop({ targetHdfsDeleteTargetDir: true, targetHdfsCompressionCodec: 'snappy', targetHdfsFileType: '--as-avrodatafile', - targetMysqlType: 'MYSQL', + targetMysqlType: 'MYSQL', targetMysqlUpdateMode: 'allowinsert', targetHiveCreateTable: false, targetHiveDropDelimiter: false, diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/use-task.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/use-task.ts index 04290d96ca9e..c9c804188c93 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/use-task.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/use-task.ts @@ -14,62 +14,69 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {ref, Ref, unref} from 'vue' +import { ref, Ref, unref } from 'vue' import nodes from './tasks' import getElementByJson from '@/components/form/get-elements-by-json' -import {useTaskNodeStore} from '@/store/project/task-node' -import {TASK_TYPES_MAP} from '@/store/project/task-type' -import type {EditWorkflowDefinition, FormRules, IFormItem, IJsonItem, INodeData, ITaskData} from './types' +import { useTaskNodeStore } from '@/store/project/task-node' +import { TASK_TYPES_MAP } from '@/store/project/task-type' +import type { + EditWorkflowDefinition, + FormRules, + IFormItem, + IJsonItem, + INodeData, + ITaskData +} from './types' export function useTask({ - data, - projectCode, - from, - readonly, - definition - }: { - data: ITaskData - projectCode: number - from?: number - readonly?: boolean - definition?: EditWorkflowDefinition + data, + projectCode, + from, + readonly, + definition +}: { + data: ITaskData + projectCode: number + from?: number + readonly?: boolean + definition?: EditWorkflowDefinition }): { - elementsRef: Ref - rulesRef: Ref - model: INodeData + elementsRef: Ref + rulesRef: Ref + model: INodeData } { - const taskStore = useTaskNodeStore() - taskStore.updateDefinition(unref(definition), data?.code) + const taskStore = useTaskNodeStore() + taskStore.updateDefinition(unref(definition), data?.code) - const jsonRef = ref([]) as Ref - const elementsRef = ref([]) as Ref - const rulesRef = ref({}) + const jsonRef = ref([]) as Ref + const elementsRef = ref([]) as Ref + const rulesRef = ref({}) - const params = { - projectCode, - from, - readonly, - data, - jsonRef, - updateElements: () => { - getElements() - } + const params = { + projectCode, + from, + readonly, + data, + jsonRef, + updateElements: () => { + getElements() } + } - const {model, json} = nodes[data.taskType || 'SHELL'](params) - jsonRef.value = json - model.preTasks = taskStore.getPreTasks - model.name = taskStore.getName - model.taskExecuteType = - TASK_TYPES_MAP[data.taskType || 'SHELL'].taskExecuteType || 'BATCH' + const { model, json } = nodes[data.taskType || 'SHELL'](params) + jsonRef.value = json + model.preTasks = taskStore.getPreTasks + model.name = taskStore.getName + model.taskExecuteType = + TASK_TYPES_MAP[data.taskType || 'SHELL'].taskExecuteType || 'BATCH' - const getElements = () => { - const {rules, elements} = getElementByJson(jsonRef.value, model) - elementsRef.value = elements - rulesRef.value = rules - } + const getElements = () => { + const { rules, elements } = getElementByJson(jsonRef.value, model) + elementsRef.value = elements + rulesRef.value = rules + } - getElements() + getElements() - return {elementsRef, rulesRef, model} + return { elementsRef, rulesRef, model } } diff --git a/dolphinscheduler-ui/src/views/projects/task/definition/batch-task.tsx b/dolphinscheduler-ui/src/views/projects/task/definition/batch-task.tsx index fc51cb84d01f..f4bcb8ede854 100644 --- a/dolphinscheduler-ui/src/views/projects/task/definition/batch-task.tsx +++ b/dolphinscheduler-ui/src/views/projects/task/definition/batch-task.tsx @@ -41,7 +41,7 @@ import Card from '@/components/card' import VersionModal from './components/version-modal' import TaskModal from '@/views/projects/task/components/node/detail-modal' import type { INodeData } from './types' -import DependenciesModal from "@/views/projects/components/dependencies/dependencies-modal"; +import DependenciesModal from '@/views/projects/components/dependencies/dependencies-modal' const BatchTaskDefinition = defineComponent({ name: 'batch-task-definition', @@ -215,11 +215,11 @@ const BatchTaskDefinition = defineComponent({ saving={this.taskSaving} /> ) diff --git a/dolphinscheduler-ui/src/views/projects/task/definition/use-table.ts b/dolphinscheduler-ui/src/views/projects/task/definition/use-table.ts index 341fa6108111..ece4050bc519 100644 --- a/dolphinscheduler-ui/src/views/projects/task/definition/use-table.ts +++ b/dolphinscheduler-ui/src/views/projects/task/definition/use-table.ts @@ -56,7 +56,7 @@ export function useTable(onEdit: Function) { const route = useRoute() const projectCode = Number(route.params.projectCode) - const {getDependentTaskLinksByTask} = useDependencies() + const { getDependentTaskLinksByTask } = useDependencies() const createColumns = (variables: any) => { variables.columns = [ @@ -268,12 +268,22 @@ export function useTable(onEdit: Function) { dependentTaskLinksRef: ref([]), row: {}, loadingRef: ref(false), - dependenciesData: ref({showRef: ref(false), taskLinks: ref([]), required: ref(false), tip: ref(''), action:() => {}}), + dependenciesData: ref({ + showRef: ref(false), + taskLinks: ref([]), + required: ref(false), + tip: ref(''), + action: () => {} + }) }) const handleDelete = (row: any) => { variables.row = row - getDependentTaskLinksByTask(projectCode, row.processDefinitionCode, row.taskCode).then((res: any) =>{ + getDependentTaskLinksByTask( + projectCode, + row.processDefinitionCode, + row.taskCode + ).then((res: any) => { if (res && res.length > 0) { variables.dependenciesData = { showRef: true, @@ -283,18 +293,20 @@ export function useTable(onEdit: Function) { action: () => {} } } else { - deleteTaskDefinition({ code: row.taskCode }, { projectCode }).then(() => { - getTableData({ - pageSize: variables.pageSize, - pageNo: + deleteTaskDefinition({ code: row.taskCode }, { projectCode }).then( + () => { + getTableData({ + pageSize: variables.pageSize, + pageNo: variables.tableData.length === 1 && variables.page > 1 - ? variables.page - 1 - : variables.page, - searchTaskName: variables.searchTaskName, - searchWorkflowName: variables.searchWorkflowName, - taskType: variables.taskType - }) - }) + ? variables.page - 1 + : variables.page, + searchTaskName: variables.searchTaskName, + searchWorkflowName: variables.searchWorkflowName, + taskType: variables.taskType + }) + } + ) } }) } diff --git a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-context-menu.tsx b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-context-menu.tsx index 517a67d0afbf..761c70eee7c3 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-context-menu.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-context-menu.tsx @@ -23,8 +23,8 @@ import { useRoute } from 'vue-router' import styles from './menu.module.scss' import { uuid } from '@/common/common' import { IWorkflowTaskInstance } from './types' -import {NButton} from 'naive-ui' -import {useDependencies} from "@/views/projects/components/dependencies/use-dependencies" +import { NButton } from 'naive-ui' +import { useDependencies } from '@/views/projects/components/dependencies/use-dependencies' const props = { startDisplay: { @@ -146,13 +146,19 @@ export default defineComponent({ } const handleDelete = async () => { - let taskCode = props.cell?.id - let res = await getDependentTaskLinksByTask(projectCode, workflowCode, taskCode) + const taskCode = props.cell?.id + const res = await getDependentTaskLinksByTask( + projectCode, + workflowCode, + taskCode + ) dependenciesData.showRef = false if (res.length > 0) { dependenciesData.showRef = true dependenciesData.taskLinks = res - dependenciesData.tip = t('project.task.delete_validate_dependent_tasks_desc') + dependenciesData.tip = t( + 'project.task.delete_validate_dependent_tasks_desc' + ) dependenciesData.required = true } else { graph.value?.removeCell(props.cell) @@ -210,8 +216,8 @@ export default defineComponent({ {t('project.node.copy')} {t('project.node.delete')} diff --git a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-toolbar.tsx b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-toolbar.tsx index 5dc191db9b73..ae538924d1b4 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-toolbar.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-toolbar.tsx @@ -49,7 +49,7 @@ import type { Graph } from '@antv/x6' import StartupParam from './dag-startup-param' import VariablesView from '@/views/projects/workflow/instance/components/variables-view' import { WorkflowDefinition, WorkflowInstance } from './types' -import { useDependencies } from "@/views/projects/components/dependencies/use-dependencies" +import { useDependencies } from '@/views/projects/components/dependencies/use-dependencies' const props = { layoutToggle: { @@ -181,11 +181,17 @@ export default defineComponent({ const codes = cells .filter((cell) => cell.isNode()) .map((cell) => +cell.id) - const res = await getDependentTaskLinksByMultipleTasks(projectCode, workflowCode, codes) + const res = await getDependentTaskLinksByMultipleTasks( + projectCode, + workflowCode, + codes + ) if (res.length > 0) { dependenciesData.showRef = true dependenciesData.taskLinks = res - dependenciesData.tip = t('project.task.delete_validate_dependent_tasks_desc') + dependenciesData.tip = t( + 'project.task.delete_validate_dependent_tasks_desc' + ) dependenciesData.required = true } else { context.emit('removeTasks', codes, cells) 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 e04afecd09d8..c9febe14e039 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx @@ -24,7 +24,8 @@ import { toRef, watch, onBeforeUnmount, - computed, reactive + computed, + reactive } from 'vue' import { useI18n } from 'vue-i18n' import { useRoute } from 'vue-router' @@ -57,7 +58,7 @@ import utils from '@/utils' import { useUISettingStore } from '@/store/ui-setting/ui-setting' import { executeTask } from '@/service/modules/executors' import { removeTaskInstanceCache } from '@/service/modules/task-instances' -import DependenciesModal from "@/views/projects/components/dependencies/dependencies-modal"; +import DependenciesModal from '@/views/projects/components/dependencies/dependencies-modal' const props = { // If this prop is passed, it means from definition detail @@ -338,7 +339,8 @@ export default defineComponent({ showRef: ref(false), taskLinks: ref([]), required: ref(false), - tip: ref(''), action: () => {} + tip: ref(''), + action: () => {} }) watch( @@ -440,11 +442,11 @@ export default defineComponent({ v-model:dependenciesData={dependenciesData} /> {!!props.definition && ( { setNodeStatus(taskInstance.taskCode, taskInstance.state, taskInstance) if (taskInstance.dependentResult) { - Object.assign(allDependentResult, JSON.parse(taskInstance.dependentResult)) + Object.assign( + allDependentResult, + JSON.parse(taskInstance.dependentResult) + ) } }) nodeStore.updateDependentResult(allDependentResult) diff --git a/dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx b/dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx index 2f476fd2a1df..872b5158440e 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx @@ -191,7 +191,7 @@ export default defineComponent({ options: Array, findingValue: string ): boolean => { - for (let { value } of options) { + for (const { value } of options) { if (findingValue === value) { return true } diff --git a/dolphinscheduler-ui/src/views/projects/workflow/definition/components/table-action.tsx b/dolphinscheduler-ui/src/views/projects/workflow/definition/components/table-action.tsx index 1453e7ed4f6f..61499a898c97 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/definition/components/table-action.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/definition/components/table-action.tsx @@ -169,7 +169,10 @@ export default defineComponent({ trigger: () => ( {{ - default: () => releaseState === 'OFFLINE' ? t('project.workflow.confirm_to_online'):t('project.workflow.confirm_to_offline'), + default: () => + releaseState === 'OFFLINE' + ? t('project.workflow.confirm_to_online') + : t('project.workflow.confirm_to_offline'), trigger: () => ( {{ default: () => - scheduleReleaseState === 'OFFLINE' ? t('project.workflow.time_to_online'):t('project.workflow.time_to_offline'), + scheduleReleaseState === 'OFFLINE' + ? t('project.workflow.time_to_online') + : t('project.workflow.time_to_offline'), trigger: () => ( , findingValue: string ): boolean => { - for (let { value } of options) { + for (const { value } of options) { if (findingValue === value) { return true } diff --git a/dolphinscheduler-ui/src/views/projects/workflow/definition/components/use-modal.ts b/dolphinscheduler-ui/src/views/projects/workflow/definition/components/use-modal.ts index 733638a3f0a1..100940ea143d 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/definition/components/use-modal.ts +++ b/dolphinscheduler-ui/src/views/projects/workflow/definition/components/use-modal.ts @@ -229,7 +229,10 @@ export function useModal( const getWorkerGroups = () => { queryWorkerGroupsByProjectCode(variables.projectCode).then((res: any) => { - variables.workerGroups = res.data.map((item: any) =>({label: item.workerGroup, value: item.workerGroup })) + variables.workerGroups = res.data.map((item: any) => ({ + label: item.workerGroup, + value: item.workerGroup + })) }) } diff --git a/dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx b/dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx index 90b55adf178c..467ac85f5933 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx @@ -24,7 +24,7 @@ import { NSpace, NTooltip, NPopconfirm, - NModal, + NModal } from 'naive-ui' import { defineComponent, diff --git a/dolphinscheduler-ui/src/views/projects/workflow/definition/timing/index.tsx b/dolphinscheduler-ui/src/views/projects/workflow/definition/timing/index.tsx index 9450138e0f4f..2e97cb3512dd 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/definition/timing/index.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/definition/timing/index.tsx @@ -24,7 +24,7 @@ import { useTable } from './use-table' import Card from '@/components/card' import TimingModal from '../components/timing-modal' import type { Router } from 'vue-router' -import DependenciesModal from "@/views/projects/components/dependencies/dependencies-modal"; +import DependenciesModal from '@/views/projects/components/dependencies/dependencies-modal' export default defineComponent({ name: 'WorkflowDefinitionTiming', @@ -117,11 +117,11 @@ export default defineComponent({ onUpdateList={this.handleUpdateList} /> ) diff --git a/dolphinscheduler-ui/src/views/projects/workflow/definition/timing/use-table.ts b/dolphinscheduler-ui/src/views/projects/workflow/definition/timing/use-table.ts index 4c86637d04ca..0b79b6fd772f 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/definition/timing/use-table.ts +++ b/dolphinscheduler-ui/src/views/projects/workflow/definition/timing/use-table.ts @@ -39,13 +39,13 @@ import { import { format } from 'date-fns-tz' import { ISearchParam } from './types' import type { Router } from 'vue-router' -import { useDependencies } from "@/views/projects/components/dependencies/use-dependencies" +import { useDependencies } from '@/views/projects/components/dependencies/use-dependencies' export function useTable() { const { t } = useI18n() const router: Router = useRouter() - const {getDependentTaskLinks} = useDependencies() + const { getDependentTaskLinks } = useDependencies() const variables = reactive({ columns: [], @@ -62,7 +62,13 @@ export function useTable() { processDefinitionCode: router.currentRoute.value.params.definitionCode ? ref(Number(router.currentRoute.value.params.definitionCode)) : ref(), - dependenciesData: ref({showRef: false, taskLinks: ref([]), required: ref(false), tip: ref(''), action:() => {}}), + dependenciesData: ref({ + showRef: false, + taskLinks: ref([]), + required: ref(false), + tip: ref(''), + action: () => {} + }) }) const renderTime = (time: string, timeZone: string) => { @@ -111,19 +117,19 @@ export function useTable() { render: (row: any) => { if (row.releaseState === 'ONLINE') { return h( - NTag, - { type: 'success', size: 'small' }, - { - default: () => t('project.workflow.up_line') - } + NTag, + { type: 'success', size: 'small' }, + { + default: () => t('project.workflow.up_line') + } ) } else { return h( - NTag, - { type: 'warning', size: 'small' }, - { - default: () => t('project.workflow.down_line') - } + NTag, + { type: 'warning', size: 'small' }, + { + default: () => t('project.workflow.down_line') + } ) } } @@ -136,36 +142,36 @@ export function useTable() { return h(NSpace, null, { default: () => [ h( - NTooltip, - {}, - { - trigger: () => - h( - NButton, - { - circle: true, - type: - row.releaseState === 'ONLINE' ? 'error' : 'warning', - size: 'small', - onClick: () => { - handleReleaseState(row) - } - }, - { - icon: () => - h( - row.releaseState === 'ONLINE' - ? ArrowDownOutlined - : ArrowUpOutlined - ) - } - ), - default: () => - row.releaseState === 'ONLINE' - ? t('project.workflow.down_line') - : t('project.workflow.up_line') - } - ), + NTooltip, + {}, + { + trigger: () => + h( + NButton, + { + circle: true, + type: + row.releaseState === 'ONLINE' ? 'error' : 'warning', + size: 'small', + onClick: () => { + handleReleaseState(row) + } + }, + { + icon: () => + h( + row.releaseState === 'ONLINE' + ? ArrowDownOutlined + : ArrowUpOutlined + ) + } + ), + default: () => + row.releaseState === 'ONLINE' + ? t('project.workflow.down_line') + : t('project.workflow.up_line') + } + ) ] }) } @@ -176,7 +182,6 @@ export function useTable() { } } - const createColumns = (variables: any) => { variables.columns = [ { @@ -394,11 +399,16 @@ export function useTable() { const handleReleaseState = (row: any) => { if (row.releaseState === 'ONLINE') { variables.row = row - getDependentTaskLinks(variables.projectCode, row.processDefinitionCode).then((res: any) =>{ + getDependentTaskLinks( + variables.projectCode, + row.processDefinitionCode + ).then((res: any) => { if (res && res.length > 0) { variables.dependenciesData.showRef = true variables.dependenciesData.taskLinks = res - variables.dependenciesData.tip = t('project.workflow.warning_delete_scheduler_dependent_tasks_desc') + variables.dependenciesData.tip = t( + 'project.workflow.warning_delete_scheduler_dependent_tasks_desc' + ) variables.dependenciesData.required = false variables.dependenciesData.action = confirmToOfflineSchedule } else { @@ -412,7 +422,8 @@ export function useTable() { processDefinitionCode: variables.processDefinitionCode }) }) - }}) + } + }) } else { online(variables.projectCode, row.id).then(() => { window.$message.success(t('project.workflow.success')) @@ -461,11 +472,16 @@ export function useTable() { variables.page -= 1 } variables.row = row - getDependentTaskLinks(variables.projectCode, row.processDefinitionCode).then((res: any) =>{ + getDependentTaskLinks( + variables.projectCode, + row.processDefinitionCode + ).then((res: any) => { if (res && res.length > 0) { variables.dependenciesData.showRef = true variables.dependenciesData.taskLinks = res - variables.dependenciesData.tip = t('project.workflow.warning_delete_scheduler_dependent_tasks_desc') + variables.dependenciesData.tip = t( + 'project.workflow.warning_delete_scheduler_dependent_tasks_desc' + ) variables.dependenciesData.required = false variables.dependenciesData.action = confirmToDeleteSchedule } else { diff --git a/dolphinscheduler-ui/src/views/projects/workflow/definition/use-table.ts b/dolphinscheduler-ui/src/views/projects/workflow/definition/use-table.ts index 04228d532f50..04588517d8e0 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/definition/use-table.ts +++ b/dolphinscheduler-ui/src/views/projects/workflow/definition/use-table.ts @@ -43,7 +43,7 @@ import { import type { IDefinitionParam } from './types' import type { Router } from 'vue-router' import type { TableColumns, RowKey } from 'naive-ui/es/data-table/src/interface' -import {useDependencies} from '../../components/dependencies/use-dependencies' +import { useDependencies } from '../../components/dependencies/use-dependencies' export function useTable() { const { t } = useI18n() @@ -71,7 +71,13 @@ export function useTable() { copyShowRef: ref(false), loadingRef: ref(false), setTimingDialogShowRef: ref(false), - dependenciesData: ref({showRef: false, taskLinks: ref([]), required: ref(false), tip: ref(''), action:() => {}}), + dependenciesData: ref({ + showRef: false, + taskLinks: ref([]), + required: ref(false), + tip: ref(''), + action: () => {} + }) }) const createColumns = (variables: any) => { @@ -352,8 +358,8 @@ export function useTable() { const data = { name: row.name, releaseState: (row.releaseState === 'ONLINE' ? 'OFFLINE' : 'ONLINE') as - | 'OFFLINE' - | 'ONLINE' + | 'OFFLINE' + | 'ONLINE' } if (data.releaseState === 'OFFLINE') { release(data, variables.projectCode, row.code).then(() => { @@ -385,8 +391,8 @@ export function useTable() { const data = { name: row.name, releaseState: (row.releaseState === 'ONLINE' ? 'OFFLINE' : 'ONLINE') as - | 'OFFLINE' - | 'ONLINE' + | 'OFFLINE' + | 'ONLINE' } variables.row = row if (data.releaseState === 'ONLINE') { @@ -404,26 +410,28 @@ export function useTable() { }) }) } else { - getDependentTaskLinks(variables.projectCode, row.code).then((res: any) => { - if (res && res.length > 0) { - variables.dependenciesData = { - showRef: true, - taskLinks: res, - tip: t('project.workflow.warning_dependent_tasks_desc'), - required: false, - action: confirmToOfflineWorkflow - } - } else { - release(data, variables.projectCode, row.code).then(() => { - window.$message.success(t('project.workflow.success')) - getTableData({ - pageSize: variables.pageSize, - pageNo: variables.page, - searchVal: variables.searchVal + getDependentTaskLinks(variables.projectCode, row.code).then( + (res: any) => { + if (res && res.length > 0) { + variables.dependenciesData = { + showRef: true, + taskLinks: res, + tip: t('project.workflow.warning_dependent_tasks_desc'), + required: false, + action: confirmToOfflineWorkflow + } + } else { + release(data, variables.projectCode, row.code).then(() => { + window.$message.success(t('project.workflow.success')) + getTableData({ + pageSize: variables.pageSize, + pageNo: variables.page, + searchVal: variables.searchVal + }) }) - }) + } } - }) + ) } } @@ -454,25 +462,30 @@ export function useTable() { variables.row = row if (row.schedule) { if (row.schedule.releaseState === 'ONLINE') { - getDependentTaskLinks(variables.projectCode, row.code).then((res: any) => { - if (res && res.length > 0) { - variables.dependenciesData = { - showRef: true, - taskLinks: res, - tip: t('project.workflow.warning_offline_scheduler_dependent_tasks_desc'), - required: false, - action: confirmToOfflineScheduler - } - } else { - offline(variables.projectCode, row.schedule.id).then(() => { - window.$message.success(t('project.workflow.success')) - getTableData({ - pageSize: variables.pageSize, - pageNo: variables.page, - searchVal: variables.searchVal + getDependentTaskLinks(variables.projectCode, row.code).then( + (res: any) => { + if (res && res.length > 0) { + variables.dependenciesData = { + showRef: true, + taskLinks: res, + tip: t( + 'project.workflow.warning_offline_scheduler_dependent_tasks_desc' + ), + required: false, + action: confirmToOfflineScheduler + } + } else { + offline(variables.projectCode, row.schedule.id).then(() => { + window.$message.success(t('project.workflow.success')) + getTableData({ + pageSize: variables.pageSize, + pageNo: variables.page, + searchVal: variables.searchVal + }) }) - }) - }}) + } + } + ) } else { online(variables.projectCode, row.schedule.id).then(() => { window.$message.success(t('project.workflow.success')) @@ -566,6 +579,6 @@ export function useTable() { getTableData, batchDeleteWorkflow, batchExportWorkflow, - batchCopyWorkflow, + batchCopyWorkflow } } diff --git a/dolphinscheduler-ui/src/views/projects/workflow/timing/index.tsx b/dolphinscheduler-ui/src/views/projects/workflow/timing/index.tsx index 37a33447d5f3..3e6e9d542330 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/timing/index.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/timing/index.tsx @@ -15,15 +15,15 @@ * limitations under the License. */ -import {NDataTable, NPagination, NSpace} from 'naive-ui' -import {defineComponent, onMounted, toRefs, watch} from 'vue' +import { NDataTable, NPagination, NSpace } from 'naive-ui' +import { defineComponent, onMounted, toRefs, watch } from 'vue' import { useI18n } from 'vue-i18n' import { useTable } from '../definition/timing/use-table' import Card from '@/components/card' import TimingModal from '../definition/components/timing-modal' import TimingCondition from '@/views/projects/workflow/timing/components/timing-condition' import { ITimingSearch } from '@/views/projects/workflow/timing/types' -import DependenciesModal from "@/views/projects/components/dependencies/dependencies-modal"; +import DependenciesModal from '@/views/projects/components/dependencies/dependencies-modal' export default defineComponent({ name: 'WorkflowTimingList', @@ -112,11 +112,11 @@ export default defineComponent({ onUpdateList={this.handleUpdateList} /> ) diff --git a/dolphinscheduler-ui/src/views/resource/components/resource/edit/index.tsx b/dolphinscheduler-ui/src/views/resource/components/resource/edit/index.tsx index 47dd07593ba0..29000302eb87 100644 --- a/dolphinscheduler-ui/src/views/resource/components/resource/edit/index.tsx +++ b/dolphinscheduler-ui/src/views/resource/components/resource/edit/index.tsx @@ -32,7 +32,7 @@ export default defineComponent({ const router = useRouter() const isDetailPageStore = useIsDetailPageStore() isDetailPageStore.$reset() - + const componentName = route.name // fullname is now the id of resources const fullName = String(router.currentRoute.value.query.prefix || '') diff --git a/dolphinscheduler-ui/src/views/resource/components/resource/edit/use-edit.ts b/dolphinscheduler-ui/src/views/resource/components/resource/edit/use-edit.ts index dc9dd2c7fcfb..ab6c05e463d4 100644 --- a/dolphinscheduler-ui/src/views/resource/components/resource/edit/use-edit.ts +++ b/dolphinscheduler-ui/src/views/resource/components/resource/edit/use-edit.ts @@ -63,10 +63,10 @@ export function useEdit(state: any) { } } -export const useIsDetailPageStore = defineStore("isDetailPage", { - state:() => { +export const useIsDetailPageStore = defineStore('isDetailPage', { + state: () => { return { - isDetailPage:false + isDetailPage: false } }, getters: { @@ -82,9 +82,9 @@ export const useIsDetailPageStore = defineStore("isDetailPage", { }) export const isEmpty = (string: any): boolean => { - if(string === '' || string === undefined || string === null){ - return true - }else{ - return false - } + if (string === '' || string === undefined || string === null) { + return true + } else { + return false + } } diff --git a/dolphinscheduler-ui/src/views/resource/components/resource/index.tsx b/dolphinscheduler-ui/src/views/resource/components/resource/index.tsx index 96dcfb1ee0e1..9166af4ba82f 100644 --- a/dolphinscheduler-ui/src/views/resource/components/resource/index.tsx +++ b/dolphinscheduler-ui/src/views/resource/components/resource/index.tsx @@ -106,25 +106,25 @@ export default defineComponent({ const handleRenameFile = () => { variables.renameShowRef = true } - const detailPageStore = useDetailPageStore() + const detailPageStore = useDetailPageStore() const isDetailPageStore = useIsDetailPageStore() - + const handleDetailBackList = () => { - if(isDetailPageStore.getIsDetailPage){ - variables.resourceType = detailPageStore.getResourceType - variables.fullName = detailPageStore.getFullName - variables.tenantCode = detailPageStore.getTenantCode - variables.searchRef = detailPageStore.getSearchValue - variables.pagination.page = detailPageStore.getPage - variables.pagination.pageSize = detailPageStore.getPageSize - if(!isEmpty(variables.searchRef)){ + if (isDetailPageStore.getIsDetailPage) { + variables.resourceType = detailPageStore.getResourceType + variables.fullName = detailPageStore.getFullName + variables.tenantCode = detailPageStore.getTenantCode + variables.searchRef = detailPageStore.getSearchValue + variables.pagination.page = detailPageStore.getPage + variables.pagination.pageSize = detailPageStore.getPageSize + if (!isEmpty(variables.searchRef)) { handleConditions() } - detailPageStore.$reset() - isDetailPageStore.$reset() + detailPageStore.$reset() + isDetailPageStore.$reset() } else { - detailPageStore.$reset() - isDetailPageStore.$reset() + detailPageStore.$reset() + isDetailPageStore.$reset() } } diff --git a/dolphinscheduler-ui/src/views/resource/components/resource/table/use-table.ts b/dolphinscheduler-ui/src/views/resource/components/resource/table/use-table.ts index 2160d4784f55..888e480a59e2 100644 --- a/dolphinscheduler-ui/src/views/resource/components/resource/table/use-table.ts +++ b/dolphinscheduler-ui/src/views/resource/components/resource/table/use-table.ts @@ -213,7 +213,7 @@ export function useTable() { const { getResourceListState } = useFileState(setPagination) const detailPageStore = useDetailPageStore() - + const requestData = () => { variables.resourceList = getResourceListState( variables.resourceType!, @@ -245,56 +245,56 @@ export function useTable() { handleCreateFile: createFile } } -export const useDetailPageStore = defineStore("detailPage", { - state:() => { - var resourceTypeInitValue:ResourceType +export const useDetailPageStore = defineStore('detailPage', { + state: () => { + let resourceTypeInitValue: ResourceType return { - resourceType:resourceTypeInitValue!, - fullName:'', - tenantCode:'', - searchValue:'', - page:1, - pageSize:10 + resourceType: resourceTypeInitValue!, + fullName: '', + tenantCode: '', + searchValue: '', + page: 1, + pageSize: 10 } }, getters: { getResourceType(): ResourceType { return this.resourceType }, - getFullName(): string { - return this.fullName - }, - getTenantCode(): string { - return this.tenantCode - }, - getSearchValue(): string { - return this.searchValue - }, - getPage(): number { - return this.page - }, - getPageSize(): number { - return this.pageSize - } + getFullName(): string { + return this.fullName + }, + getTenantCode(): string { + return this.tenantCode + }, + getSearchValue(): string { + return this.searchValue + }, + getPage(): number { + return this.page + }, + getPageSize(): number { + return this.pageSize + } }, actions: { setResourceType(resourceTypeValue: ResourceType) { this.resourceType = resourceTypeValue }, - setFullName(fullName: string) { - this.fullName = fullName - }, - setTenantCode(fullName: string) { - this.fullName = fullName - }, - setSearchValue(searchValue: string) { - this.searchValue = searchValue - }, - setPage(page: number) { - this.page = page - }, - setPageSize(pageSize: number) { - this.pageSize = pageSize - } + setFullName(fullName: string) { + this.fullName = fullName + }, + setTenantCode(fullName: string) { + this.fullName = fullName + }, + setSearchValue(searchValue: string) { + this.searchValue = searchValue + }, + setPage(page: number) { + this.page = page + }, + setPageSize(pageSize: number) { + this.pageSize = pageSize + } } }) diff --git a/dolphinscheduler-ui/src/views/resource/task-group/option/use-table.ts b/dolphinscheduler-ui/src/views/resource/task-group/option/use-table.ts index 838a1d39cbcd..d49e396e425b 100644 --- a/dolphinscheduler-ui/src/views/resource/task-group/option/use-table.ts +++ b/dolphinscheduler-ui/src/views/resource/task-group/option/use-table.ts @@ -125,37 +125,38 @@ export function useTable( const getTableData = (params: any) => { if (variables.loadingRef) return variables.loadingRef = true - Promise.all([queryTaskGroupListPaging(params), queryProjectCreatedAndAuthorizedByUser()]).then( - (values: any[]) => { - variables.totalPage = values[0].totalPage - variables.tableData = values[0].totalList.map( - (item: any, unused: number) => { - let projectName = '' - if (values[1]) { - const project = _.find(values[1], { code: item.projectCode }) - if (project) { - projectName = project.name - } + Promise.all([ + queryTaskGroupListPaging(params), + queryProjectCreatedAndAuthorizedByUser() + ]).then((values: any[]) => { + variables.totalPage = values[0].totalPage + variables.tableData = values[0].totalList.map( + (item: any, unused: number) => { + let projectName = '' + if (values[1]) { + const project = _.find(values[1], { code: item.projectCode }) + if (project) { + projectName = project.name } + } - item.projectName = projectName - item.createTime = format( - parseTime(item.createTime), - 'yyyy-MM-dd HH:mm:ss' - ) - item.updateTime = format( - parseTime(item.updateTime), - 'yyyy-MM-dd HH:mm:ss' - ) - item.status = (item.status == 'YES') ? 1 : 0 - return { - ...item - } + item.projectName = projectName + item.createTime = format( + parseTime(item.createTime), + 'yyyy-MM-dd HH:mm:ss' + ) + item.updateTime = format( + parseTime(item.updateTime), + 'yyyy-MM-dd HH:mm:ss' + ) + item.status = item.status == 'YES' ? 1 : 0 + return { + ...item } - ) - variables.loadingRef = false - } - ) + } + ) + variables.loadingRef = false + }) } return { getTableData, variables, columns } diff --git a/dolphinscheduler-ui/src/views/security/user-manage/use-table.ts b/dolphinscheduler-ui/src/views/security/user-manage/use-table.ts index 2059c7a958d3..0f71beee0489 100644 --- a/dolphinscheduler-ui/src/views/security/user-manage/use-table.ts +++ b/dolphinscheduler-ui/src/views/security/user-manage/use-table.ts @@ -22,7 +22,6 @@ import { parseTime } from '@/common/common' import type { IRecord, TAuthType } from './types' export function useTable() { - const state = reactive({ page: 1, pageSize: 10, diff --git a/dolphinscheduler-ui/src/views/security/yarn-queue-manage/use-table.ts b/dolphinscheduler-ui/src/views/security/yarn-queue-manage/use-table.ts index 7008b8979d18..afcd05fb453a 100644 --- a/dolphinscheduler-ui/src/views/security/yarn-queue-manage/use-table.ts +++ b/dolphinscheduler-ui/src/views/security/yarn-queue-manage/use-table.ts @@ -17,12 +17,10 @@ import { useAsyncState } from '@vueuse/core' import { reactive, h, ref } from 'vue' -import {NButton, NIcon, NPopconfirm, NSpace, NTooltip} from 'naive-ui' +import { NButton, NIcon, NPopconfirm, NSpace, NTooltip } from 'naive-ui' import { useI18n } from 'vue-i18n' -import { queryQueueListPaging, - deleteQueueById -} from '@/service/modules/queues' -import {DeleteOutlined, EditOutlined} from '@vicons/antd' +import { queryQueueListPaging, deleteQueueById } from '@/service/modules/queues' +import { DeleteOutlined, EditOutlined } from '@vicons/antd' import type { QueueRes } from '@/service/modules/queues/types' export function useTable() { @@ -39,9 +37,9 @@ export function useTable() { getTableData({ pageSize: variables.pageSize, pageNo: - variables.tableData.length === 1 && variables.page > 1 - ? variables.page - 1 - : variables.page, + variables.tableData.length === 1 && variables.page > 1 + ? variables.page - 1 + : variables.page, searchVal: variables.searchVal }) }) @@ -75,69 +73,69 @@ export function useTable() { title: t('security.yarn_queue.operation'), key: 'operation', render(row: any) { - return h(NSpace, null, { - default: () => [ - h( - NTooltip, - {}, - { - trigger: () => - h( - NButton, - { - circle: true, - type: 'info', - size: 'small', - class: 'edit', - onClick: () => { - handleEdit(row) - } - }, - { - icon: () => - h(NIcon, null, { default: () => h(EditOutlined) }) - } - ), - default: () => t('security.yarn_queue.edit') - } - ), - h( - NPopconfirm, - { - onPositiveClick: () => { - handleDelete(row) + return h(NSpace, null, { + default: () => [ + h( + NTooltip, + {}, + { + trigger: () => + h( + NButton, + { + circle: true, + type: 'info', + size: 'small', + class: 'edit', + onClick: () => { + handleEdit(row) + } + }, + { + icon: () => + h(NIcon, null, { default: () => h(EditOutlined) }) } - }, - { - trigger: () => + ), + default: () => t('security.yarn_queue.edit') + } + ), + h( + NPopconfirm, + { + onPositiveClick: () => { + handleDelete(row) + } + }, + { + trigger: () => + h( + NTooltip, + {}, + { + trigger: () => h( - NTooltip, - {}, - { - trigger: () => - h( - NButton, - { - circle: true, - type: 'error', - size: 'small', - class: 'delete' - }, - { - icon: () => - h(NIcon, null, { - default: () => h(DeleteOutlined) - }) - } - ), - default: () => t('security.yarn_queue.delete') - } + NButton, + { + circle: true, + type: 'error', + size: 'small', + class: 'delete' + }, + { + icon: () => + h(NIcon, null, { + default: () => h(DeleteOutlined) + }) + } ), - default: () => t('security.yarn_queue.delete_confirm') - } - ) - ] - }) + default: () => t('security.yarn_queue.delete') + } + ), + default: () => t('security.yarn_queue.delete_confirm') + } + ) + ] + }) } } ]