Browse Source

fix ui build error (#15732)

dev_wenjun_refactorMaster
xiangzihao 8 months ago committed by GitHub
parent
commit
faa794c39b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      dolphinscheduler-ui/src/common/common.ts
  2. 2
      dolphinscheduler-ui/src/components/chart/modules/Bar.tsx
  3. 8
      dolphinscheduler-ui/src/components/chart/modules/Gauge.tsx
  4. 8
      dolphinscheduler-ui/src/layouts/content/use-dataList.ts
  5. 39
      dolphinscheduler-ui/src/locales/en_US/project.ts
  6. 14
      dolphinscheduler-ui/src/locales/en_US/security.ts
  7. 31
      dolphinscheduler-ui/src/locales/zh_CN/project.ts
  8. 14
      dolphinscheduler-ui/src/locales/zh_CN/security.ts
  9. 2
      dolphinscheduler-ui/src/service/modules/data-source/index.ts
  10. 9
      dolphinscheduler-ui/src/service/modules/lineages/index.ts
  11. 6
      dolphinscheduler-ui/src/service/modules/login/index.ts
  12. 8
      dolphinscheduler-ui/src/service/modules/login/types.ts
  13. 10
      dolphinscheduler-ui/src/service/modules/projects-preference/index.ts
  14. 1
      dolphinscheduler-ui/src/service/modules/projects-preference/types.ts
  15. 8
      dolphinscheduler-ui/src/service/modules/projects-worker-group/index.ts
  16. 6
      dolphinscheduler-ui/src/service/modules/projects-worker-group/types.ts
  17. 7
      dolphinscheduler-ui/src/service/modules/projects/index.ts
  18. 9
      dolphinscheduler-ui/src/service/modules/projects/types.ts
  19. 2
      dolphinscheduler-ui/src/service/modules/worker-groups/index.ts
  20. 2
      dolphinscheduler-ui/src/store/timezone/types.ts
  21. 2
      dolphinscheduler-ui/src/views/home/use-process-state.ts
  22. 4
      dolphinscheduler-ui/src/views/home/use-task-state.ts
  23. 32
      dolphinscheduler-ui/src/views/login/index.tsx
  24. 7
      dolphinscheduler-ui/src/views/login/use-login.ts
  25. 110
      dolphinscheduler-ui/src/views/projects/components/dependencies/dependencies-modal.tsx
  26. 167
      dolphinscheduler-ui/src/views/projects/components/dependencies/use-dependencies.ts
  27. 32
      dolphinscheduler-ui/src/views/projects/list/components/use-worker-group.ts
  28. 49
      dolphinscheduler-ui/src/views/projects/list/components/worker-group-modal.tsx
  29. 10
      dolphinscheduler-ui/src/views/projects/list/index.tsx
  30. 40
      dolphinscheduler-ui/src/views/projects/list/use-table.ts
  31. 2
      dolphinscheduler-ui/src/views/projects/overview/use-process-state.ts
  32. 2
      dolphinscheduler-ui/src/views/projects/overview/use-task-state.ts
  33. 2
      dolphinscheduler-ui/src/views/projects/preference/use-form.ts
  34. 2
      dolphinscheduler-ui/src/views/projects/task/components/node/detail-modal.tsx
  35. 9
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts
  36. 2
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts
  37. 7
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-hive-cli.ts
  38. 1
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-k8s.ts
  39. 2
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-queue.ts
  40. 20
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-rules.ts
  41. 8
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-spark.ts
  42. 165
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts
  43. 594
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts
  44. 750
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts
  45. 5
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-worker-group.ts
  46. 16
      dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts
  47. 2
      dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mr.ts
  48. 2
      dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sqoop.ts
  49. 97
      dolphinscheduler-ui/src/views/projects/task/components/node/use-task.ts
  50. 12
      dolphinscheduler-ui/src/views/projects/task/definition/batch-task.tsx
  51. 40
      dolphinscheduler-ui/src/views/projects/task/definition/use-table.ts
  52. 20
      dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-context-menu.tsx
  53. 12
      dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-toolbar.tsx
  54. 18
      dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx
  55. 5
      dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-node-status.ts
  56. 2
      dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx
  57. 9
      dolphinscheduler-ui/src/views/projects/workflow/definition/components/table-action.tsx
  58. 2
      dolphinscheduler-ui/src/views/projects/workflow/definition/components/timing-modal.tsx
  59. 5
      dolphinscheduler-ui/src/views/projects/workflow/definition/components/use-modal.ts
  60. 2
      dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx
  61. 12
      dolphinscheduler-ui/src/views/projects/workflow/definition/timing/index.tsx
  62. 114
      dolphinscheduler-ui/src/views/projects/workflow/definition/timing/use-table.ts
  63. 99
      dolphinscheduler-ui/src/views/projects/workflow/definition/use-table.ts
  64. 16
      dolphinscheduler-ui/src/views/projects/workflow/timing/index.tsx
  65. 2
      dolphinscheduler-ui/src/views/resource/components/resource/edit/index.tsx
  66. 16
      dolphinscheduler-ui/src/views/resource/components/resource/edit/use-edit.ts
  67. 28
      dolphinscheduler-ui/src/views/resource/components/resource/index.tsx
  68. 80
      dolphinscheduler-ui/src/views/resource/components/resource/table/use-table.ts
  69. 57
      dolphinscheduler-ui/src/views/resource/task-group/option/use-table.ts
  70. 1
      dolphinscheduler-ui/src/views/security/user-manage/use-table.ts
  71. 134
      dolphinscheduler-ui/src/views/security/yarn-queue-manage/use-table.ts

2
dolphinscheduler-ui/src/common/common.ts

@ -400,7 +400,7 @@ export const workflowExecutionState = (
icon: HourglassOutlined, icon: HourglassOutlined,
isSpin: false, isSpin: false,
classNames: 'wait_to_run' classNames: 'wait_to_run'
}, }
}) })
/** /**

2
dolphinscheduler-ui/src/components/chart/modules/Bar.tsx

@ -49,7 +49,7 @@ const BarChart = defineComponent({
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
type: 'shadow' type: 'shadow'
}, }
}, },
grid: { grid: {
left: '3%', left: '3%',

8
dolphinscheduler-ui/src/components/chart/modules/Gauge.tsx

@ -15,13 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { import { defineComponent, onMounted, onBeforeUnmount, PropType, ref } from 'vue'
defineComponent,
onMounted,
onBeforeUnmount,
PropType,
ref
} from 'vue'
import initChart from '@/components/chart' import initChart from '@/components/chart'
import type { Ref } from 'vue' import type { Ref } from 'vue'

8
dolphinscheduler-ui/src/layouts/content/use-dataList.ts

@ -110,18 +110,18 @@ export function useDataList() {
{ {
label: t('menu.project_overview'), label: t('menu.project_overview'),
key: `/projects/${projectCode}`, key: `/projects/${projectCode}`,
payload: { projectName: projectName }, payload: { projectName: projectName }
}, },
{ {
label: t('menu.project_parameter'), label: t('menu.project_parameter'),
key: `/projects/${projectCode}/parameter`, key: `/projects/${projectCode}/parameter`,
payload: { projectName: projectName }, payload: { projectName: projectName }
}, },
{ {
label: t('menu.project_preferences'), label: t('menu.project_preferences'),
key: `/projects/${projectCode}/preferences`, key: `/projects/${projectCode}/preferences`,
payload: { projectName: projectName }, payload: { projectName: projectName }
}, }
] ]
}, },
{ {

39
dolphinscheduler-ui/src/locales/en_US/project.ts

@ -41,7 +41,7 @@ export default {
no_permission: 'No Permission', no_permission: 'No Permission',
read_permission: 'Read Permission', read_permission: 'Read Permission',
all_permission: 'All Permission', all_permission: 'All Permission',
assign_worker_group: 'Worker Group', assign_worker_group: 'Worker Group'
}, },
workflow: { workflow: {
on_line: 'Online', on_line: 'Online',
@ -239,12 +239,17 @@ export default {
time_to_online: 'Confirm to make the Scheduler online?', time_to_online: 'Confirm to make the Scheduler online?',
time_to_offline: 'Confirm to make the Scheduler offline?', time_to_offline: 'Confirm to make the Scheduler offline?',
warning_dependent_tasks_title: 'Warning', 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:', warning_dependencies: 'Dependencies:',
delete_validate_dependent_tasks_desc: 'The downstream dependent tasks exists. You can not delete the workflow.', delete_validate_dependent_tasks_desc:
warning_offline_scheduler_dependent_tasks_desc: 'The downstream dependent tasks exists. Are you sure to make the scheduler offline?', 'The downstream dependent tasks exists. You can not delete the workflow.',
delete_task_validate_dependent_tasks_desc: 'The downstream dependent tasks exists. You can not delete the task.', warning_offline_scheduler_dependent_tasks_desc:
warning_delete_scheduler_dependent_tasks_desc: 'The downstream dependent tasks exists. Are you sure to delete the scheduler?', '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: { task: {
on_line: 'Online', on_line: 'Online',
@ -314,7 +319,8 @@ export default {
whether_dry_run: 'Whether Dry-Run', whether_dry_run: 'Whether Dry-Run',
please_choose: 'Please Choose', please_choose: 'Please Choose',
remove_task_cache: 'Clear cache', 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: { dag: {
create: 'Create Workflow', create: 'Create Workflow',
@ -843,9 +849,12 @@ export default {
please_select_target_datasource: 'Please select target datasource id', please_select_target_datasource: 'Please select target datasource id',
please_select_target_database: 'Please select target database', please_select_target_database: 'Please select target database',
please_enter_target_table: 'Please select target table name', please_enter_target_table: 'Please select target table name',
please_enter_target_filter_expression: '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 target filter expression',
please_enter_statistics_name_the_alias_in_statistics_execute_sql: 'Please enter statistics name the alias in statistics execute sql', 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_comparison_execute_sql: 'Please enter comparison execute sql',
please_enter_statistics_execute_sql: 'Please enter statistics execute sql', please_enter_statistics_execute_sql: 'Please enter statistics execute sql',
please_enter_threshold_number_is_needed: please_enter_threshold_number_is_needed:
@ -899,8 +908,7 @@ export default {
yarn_queue_tips: 'Please input yarn queue(optional)', yarn_queue_tips: 'Please input yarn queue(optional)',
dependent_type: 'Dependency Type', dependent_type: 'Dependency Type',
dependent_on_workflow: 'Dependent on workflow', dependent_on_workflow: 'Dependent on workflow',
dependent_on_task: 'Dependent on task', dependent_on_task: 'Dependent on task'
}, },
menu: { menu: {
fav: 'Favorites', fav: 'Favorites',
@ -927,15 +935,16 @@ export default {
edit: 'Edit', edit: 'Edit',
delete: 'Delete', delete: 'Delete',
delete_confirm: 'Delete?', delete_confirm: 'Delete?',
success: 'Success', success: 'Success'
}, },
preference: { preference: {
edit_preference: 'Edit Preference', edit_preference: 'Edit Preference',
preference_manage: 'Project Preference Management', 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', success: 'Success',
submit: 'Submit', submit: 'Submit',
enabled: 'Enabled', enabled: 'Enabled',
disabled: 'Disabled' disabled: 'Disabled'
}, }
} }

14
dolphinscheduler-ui/src/locales/en_US/security.ts

@ -273,14 +273,14 @@ export default {
MsgType: 'Msg Type', MsgType: 'Msg Type',
// eslint-disable-next-line quotes // eslint-disable-next-line quotes
IsAtAll: "{'@'}All", IsAtAll: "{'@'}All",
calledNumber:"Called phone number", calledNumber: 'Called phone number',
calledShowNumber:"Call display number", calledShowNumber: 'Call display number',
ttsCode:"TTS Code", ttsCode: 'TTS Code',
address:'Address', address: 'Address',
accessKeyId:"AccessKeyId", accessKeyId: 'AccessKeyId',
accessKeySecret:"AccessKeySecret", accessKeySecret: 'AccessKeySecret',
annotations: 'Annotations', annotations: 'Annotations',
generatorURL: 'GeneratorURL', generatorURL: 'GeneratorURL'
}, },
k8s_namespace: { k8s_namespace: {
create_namespace: 'Create Namespace', create_namespace: 'Create Namespace',

31
dolphinscheduler-ui/src/locales/zh_CN/project.ts

@ -41,7 +41,7 @@ export default {
no_permission: '无权限', no_permission: '无权限',
read_permission: '读权限', read_permission: '读权限',
all_permission: '所有权限', all_permission: '所有权限',
assign_worker_group: '分配WorkerGroup', assign_worker_group: '分配WorkerGroup'
}, },
workflow: { workflow: {
on_line: '线上', on_line: '线上',
@ -237,12 +237,16 @@ export default {
time_to_online: '是否确定上线该定时?', time_to_online: '是否确定上线该定时?',
time_to_offline: '是否确定下线该定时?', time_to_offline: '是否确定下线该定时?',
warning_dependent_tasks_title: '警告', warning_dependent_tasks_title: '警告',
warning_dependent_tasks_desc: '下游存在依赖, 下线操作可能会对下游任务产生影响. 你确定要下线该工作流嘛?', warning_dependent_tasks_desc:
'下游存在依赖, 下线操作可能会对下游任务产生影响. 你确定要下线该工作流嘛?',
warning_dependencies: '依赖如下:', warning_dependencies: '依赖如下:',
delete_validate_dependent_tasks_desc: '下游存在依赖,你不能删除该工作流', delete_validate_dependent_tasks_desc: '下游存在依赖,你不能删除该工作流',
warning_offline_scheduler_dependent_tasks_desc: '下游存在依赖, 下线操作可能会对下游任务产生影响. 你确定要下线该定时嘛?', warning_offline_scheduler_dependent_tasks_desc:
delete_task_validate_dependent_tasks_desc: '下游存在依赖,你不能删除该任务.', '下游存在依赖, 下线操作可能会对下游任务产生影响. 你确定要下线该定时嘛?',
warning_delete_scheduler_dependent_tasks_desc: '下游存在依赖, 删除定时可能会对下游任务产生影响. 你确定要删除该定时嘛?', delete_task_validate_dependent_tasks_desc:
'下游存在依赖,你不能删除该任务.',
warning_delete_scheduler_dependent_tasks_desc:
'下游存在依赖, 删除定时可能会对下游任务产生影响. 你确定要删除该定时嘛?'
}, },
task: { task: {
on_line: '线上', on_line: '线上',
@ -312,7 +316,7 @@ export default {
whether_dry_run: '是否空跑', whether_dry_run: '是否空跑',
please_choose: '请选择', please_choose: '请选择',
remove_task_cache: '清除缓存', remove_task_cache: '清除缓存',
delete_validate_dependent_tasks_desc: '下游存在依赖,你不能删除该任务定义', delete_validate_dependent_tasks_desc: '下游存在依赖,你不能删除该任务定义'
}, },
dag: { dag: {
create: '创建工作流', create: '创建工作流',
@ -822,8 +826,10 @@ export default {
please_select_target_database: '请选择目标数据库', please_select_target_database: '请选择目标数据库',
please_enter_target_table: '请选择目标数据表', please_enter_target_table: '请选择目标数据表',
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: '请输入期望值计算SQL', please_enter_comparison_execute_sql: '请输入期望值计算SQL',
please_enter_statistics_execute_sql: '请输入实际值计算SQL', please_enter_statistics_execute_sql: '请输入实际值计算SQL',
custom_config: '自定义配置', custom_config: '自定义配置',
@ -872,7 +878,7 @@ export default {
yarn_queue_tips: '请输入Yarn队列(选填)', yarn_queue_tips: '请输入Yarn队列(选填)',
dependent_type: '依赖类型', dependent_type: '依赖类型',
dependent_on_workflow: '依赖于工作流', dependent_on_workflow: '依赖于工作流',
dependent_on_task: '依赖于任务', dependent_on_task: '依赖于任务'
}, },
menu: { menu: {
fav: '收藏组件', fav: '收藏组件',
@ -899,15 +905,16 @@ export default {
edit: '编辑', edit: '编辑',
delete: '删除', delete: '删除',
delete_confirm: '确定删除吗?', delete_confirm: '确定删除吗?',
success: '成功', success: '成功'
}, },
preference: { preference: {
edit_preference: '修改项目偏好设置', edit_preference: '修改项目偏好设置',
preference_manage: '项目偏好管理', preference_manage: '项目偏好管理',
instruction_tips: '下面这些项目偏好配置将影响这个项目下的所有工作流和任务。当创建工作流和任务时,这些配置将影响组件中的默认选项', instruction_tips:
'下面这些项目偏好配置将影响这个项目下的所有工作流和任务。当创建工作流和任务时,这些配置将影响组件中的默认选项',
success: '成功', success: '成功',
submit: '提交', submit: '提交',
enabled: '启用', enabled: '启用',
disabled: '未启用' disabled: '未启用'
}, }
} }

14
dolphinscheduler-ui/src/locales/zh_CN/security.ts

@ -272,14 +272,14 @@ export default {
MsgType: '消息类型', MsgType: '消息类型',
// eslint-disable-next-line quotes // eslint-disable-next-line quotes
IsAtAll: "{'@'}所有人", IsAtAll: "{'@'}所有人",
calledNumber:"被叫电话号码", calledNumber: '被叫电话号码',
calledShowNumber:"呼叫显示号码", calledShowNumber: '呼叫显示号码',
ttsCode:"语音模板", ttsCode: '语音模板',
address:'访问域名', address: '访问域名',
accessKeyId:"AccessKeyId", accessKeyId: 'AccessKeyId',
accessKeySecret:"AccessKeySecret", accessKeySecret: 'AccessKeySecret',
annotations: '注释', annotations: '注释',
generatorURL: '生成地址', generatorURL: '生成地址'
}, },
k8s_namespace: { k8s_namespace: {
create_namespace: '创建命名空间', create_namespace: '创建命名空间',

2
dolphinscheduler-ui/src/service/modules/data-source/index.ts

@ -134,7 +134,7 @@ export function getDatasourceDatabasesById(datasourceId: number): any {
url: '/datasources/databases', url: '/datasources/databases',
method: 'get', method: 'get',
params: { params: {
datasourceId datasourceId
} }
}) })
} }

9
dolphinscheduler-ui/src/service/modules/lineages/index.ts

@ -16,7 +16,7 @@
*/ */
import { axios } from '@/service/service' import { axios } from '@/service/service'
import {DependentTaskReq, ProjectCodeReq, WorkflowCodeReq} from './types' import { DependentTaskReq, ProjectCodeReq, WorkflowCodeReq } from './types'
export function queryWorkFlowList(projectCode: ProjectCodeReq): any { export function queryWorkFlowList(projectCode: ProjectCodeReq): any {
return axios({ 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({ return axios({
url: `/projects/${projectCode}/lineages/query-dependent-tasks`, url: `/projects/${projectCode}/lineages/query-dependent-tasks`,
method: 'get', method: 'get',
params params
}) })
} }

6
dolphinscheduler-ui/src/service/modules/login/index.ts

@ -36,13 +36,13 @@ export function ssoLoginUrl(): any {
export function getOauth2Provider(): any { export function getOauth2Provider(): any {
return axios({ return axios({
url: '/oauth2-provider', url: '/oauth2-provider',
method: 'get', method: 'get'
}) })
} }
export function clearCookie(): any { export function clearCookie(): any {
return axios({ return axios({
url: '/cookies', url: '/cookies',
method: 'delete', method: 'delete'
}) })
} }

8
dolphinscheduler-ui/src/service/modules/login/types.ts

@ -26,10 +26,10 @@ interface LoginRes {
} }
interface OAuth2Provider { interface OAuth2Provider {
clientId: string, clientId: string
redirectUri: string, redirectUri: string
provider: string, provider: string
authorizationUri: string, authorizationUri: string
iconUri: string iconUri: string
} }

10
dolphinscheduler-ui/src/service/modules/projects-preference/index.ts

@ -22,9 +22,7 @@ import {
UpdateProjectPreferenceStateReq UpdateProjectPreferenceStateReq
} from './types' } from './types'
export function queryProjectPreferenceByProjectCode( export function queryProjectPreferenceByProjectCode(projectCode: number): any {
projectCode: number
): any {
return axios({ return axios({
url: `/projects/${projectCode}/project-preference`, url: `/projects/${projectCode}/project-preference`,
method: 'get' method: 'get'
@ -43,12 +41,12 @@ export function updateProjectPreference(
} }
export function updateProjectPreferenceState( export function updateProjectPreferenceState(
data: UpdateProjectPreferenceStateReq, data: UpdateProjectPreferenceStateReq,
projectCode: number, projectCode: number
): any { ): any {
return axios({ return axios({
url: `/projects/${projectCode}/project-preference`, url: `/projects/${projectCode}/project-preference`,
method: 'post', method: 'post',
data data
}) })
} }

1
dolphinscheduler-ui/src/service/modules/projects-preference/types.ts

@ -15,7 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
interface ProjectPreferenceReq { interface ProjectPreferenceReq {
projectPreferences: string projectPreferences: string
} }

8
dolphinscheduler-ui/src/service/modules/projects-worker-group/index.ts

@ -16,11 +16,9 @@
*/ */
import { axios } from '@/service/service' 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( export function queryWorkerGroupsByProjectCode(projectCode: number): any {
projectCode: number
): any {
return axios({ return axios({
url: `/projects/${projectCode}/worker-group`, url: `/projects/${projectCode}/worker-group`,
method: 'get' method: 'get'
@ -36,4 +34,4 @@ export function assignWorkerGroups(
method: 'post', method: 'post',
data data
}) })
} }

6
dolphinscheduler-ui/src/service/modules/projects-worker-group/types.ts

@ -23,12 +23,8 @@ interface ProjectWorkerGroup {
updateTime: string updateTime: string
} }
interface UpdateProjectWorkerGroupsReq { interface UpdateProjectWorkerGroupsReq {
workerGroups: string workerGroups: string
} }
export { export { ProjectWorkerGroup, UpdateProjectWorkerGroupsReq }
ProjectWorkerGroup,
UpdateProjectWorkerGroupsReq
}

7
dolphinscheduler-ui/src/service/modules/projects/index.ts

@ -16,12 +16,7 @@
*/ */
import { axios } from '@/service/service' import { axios } from '@/service/service'
import { import { ListReq, ListIdReq, ProjectsReq, UserIdReq } from './types'
ListReq,
ListIdReq,
ProjectsReq,
UserIdReq
} from './types'
export function queryProjectListPaging(params: ListReq): any { export function queryProjectListPaging(params: ListReq): any {
return axios({ return axios({

9
dolphinscheduler-ui/src/service/modules/projects/types.ts

@ -60,11 +60,4 @@ interface ProjectRes {
start: number start: number
} }
export { export { ListReq, ListIdReq, ProjectsReq, UserIdReq, ProjectRes, ProjectList }
ListReq,
ListIdReq,
ProjectsReq,
UserIdReq,
ProjectRes,
ProjectList
}

2
dolphinscheduler-ui/src/service/modules/worker-groups/index.ts

@ -54,4 +54,4 @@ export function deleteById(id: IdReq): any {
method: 'delete', method: 'delete',
params: id params: id
}) })
} }

2
dolphinscheduler-ui/src/store/timezone/types.ts

@ -17,7 +17,7 @@
import { timezoneList } from '@/common/timezone' import { timezoneList } from '@/common/timezone'
type Timezone = typeof timezoneList[number] type Timezone = (typeof timezoneList)[number]
interface timezoneStore { interface timezoneStore {
timezone: Timezone timezone: Timezone

2
dolphinscheduler-ui/src/views/home/use-process-state.ts

@ -36,7 +36,7 @@ export function useProcessState() {
const { state } = useAsyncState( const { state } = useAsyncState(
countProcessInstanceState({ countProcessInstanceState({
startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'), 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 => { }).then((res: WorkflowInstanceCountVo): StateData => {
const table = res.workflowInstanceStatusCounts.map((item) => { const table = res.workflowInstanceStatusCounts.map((item) => {
return { return {

4
dolphinscheduler-ui/src/views/home/use-task-state.ts

@ -20,7 +20,7 @@ import { format } from 'date-fns'
import { toLower } from 'lodash' import { toLower } from 'lodash'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { countTaskState } from '@/service/modules/projects-analysis' 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 type { StateData } from './types'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
@ -36,7 +36,7 @@ export function useTaskState() {
const { state } = useAsyncState( const { state } = useAsyncState(
countTaskState({ countTaskState({
startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'), 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 => { }).then((res: TaskInstanceCountVo): StateData => {
const table = res.taskInstanceStatusCounts.map((item, unused) => { const table = res.taskInstanceStatusCounts.map((item, unused) => {
return { return {

32
dolphinscheduler-ui/src/views/login/index.tsx

@ -49,7 +49,13 @@ const login = defineComponent({
window.$message = useMessage() window.$message = useMessage()
const { state, t, locale } = useForm() const { state, t, locale } = useForm()
const { handleChange } = useTranslate(locale) const { handleChange } = useTranslate(locale)
const { handleLogin, handleGetOAuth2Provider, oauth2Providers, gotoOAuth2Page, handleRedirect } = useLogin(state) const {
handleLogin,
handleGetOAuth2Provider,
oauth2Providers,
gotoOAuth2Page,
handleRedirect
} = useLogin(state)
const localesStore = useLocalesStore() const localesStore = useLocalesStore()
const themeStore = useThemeStore() const themeStore = useThemeStore()
@ -177,15 +183,23 @@ const login = defineComponent({
</NButton> </NButton>
</a> </a>
</div> </div>
{this.oauth2Providers.length > 0 && <NDivider > {this.oauth2Providers.length > 0 && (
{this.t('login.loginWithOAuth2')} <NDivider>{this.t('login.loginWithOAuth2')}</NDivider>
</NDivider>} )}
<NSpace class={styles['oauth2-provider']} justify="center"> <NSpace class={styles['oauth2-provider']} justify='center'>
{this.oauth2Providers?.map((e: OAuth2Provider) => { {this.oauth2Providers?.map((e: OAuth2Provider) => {
return (e.iconUri ? <div onClick={() => this.gotoOAuth2Page(e)}><NImage preview-disabled width="30" src={e.iconUri}></NImage> </div> : <NButton onClick={() => this.gotoOAuth2Page(e)}>{e.provider}</NButton>) return e.iconUri ? (
})} <div onClick={() => this.gotoOAuth2Page(e)}>
</NSpace> <NImage preview-disabled width='30' src={e.iconUri}></NImage>{' '}
</div>
) : (
<NButton onClick={() => this.gotoOAuth2Page(e)}>
{e.provider}
</NButton>
)
})}
</NSpace>
</div> </div>
</div> </div>
) )

7
dolphinscheduler-ui/src/views/login/use-login.ts

@ -15,7 +15,7 @@
* limitations under the License. * 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 { clearCookie, getOauth2Provider, login } from '@/service/modules/login'
import { getUserInfo } from '@/service/modules/users' import { getUserInfo } from '@/service/modules/users'
import { useUserStore } from '@/store/user/user' import { useUserStore } from '@/store/user/user'
@ -64,8 +64,6 @@ export function useLogin(state: any) {
}) })
} }
const handleGetOAuth2Provider = () => { const handleGetOAuth2Provider = () => {
getOauth2Provider().then((res: Array<OAuth2Provider> | []) => { getOauth2Provider().then((res: Array<OAuth2Provider> | []) => {
oauth2Providers.value = res oauth2Providers.value = res
@ -76,7 +74,8 @@ export function useLogin(state: any) {
const gotoOAuth2Page = async (oauth2Provider: OAuth2Provider) => { const gotoOAuth2Page = async (oauth2Provider: OAuth2Provider) => {
await clearCookie() 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}` `&response_type=code&redirect_uri=${oauth2Provider.redirectUri}?provider=${oauth2Provider.provider}`
} }

110
dolphinscheduler-ui/src/views/projects/components/dependencies/dependencies-modal.tsx

@ -15,16 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
import { import { defineComponent, PropType, h, ref, watch } from 'vue'
defineComponent,
PropType,
h,
ref, watch
} from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import {NEllipsis, NModal, NSpace} from 'naive-ui' import { NEllipsis, NModal, NSpace } from 'naive-ui'
import {IDefinitionData} from "@/views/projects/workflow/definition/types"; import { IDefinitionData } from '@/views/projects/workflow/definition/types'
import ButtonLink from "@/components/button-link"; import ButtonLink from '@/components/button-link'
const props = { const props = {
row: { row: {
@ -68,62 +63,65 @@ export default defineComponent({
} }
const renderDownstreamDependencies = () => { const renderDownstreamDependencies = () => {
return h( return h(
<NSpace vertical> <NSpace vertical>
<div>{props.content}</div> <div>{props.content}</div>
<div>{t('project.workflow.warning_dependencies')}</div> <div>{t('project.workflow.warning_dependencies')}</div>
{props.taskLinks.map((item: any) => { {props.taskLinks.map((item: any) => {
return ( return (
<ButtonLink <ButtonLink onClick={item.action} disabled={false}>
onClick={item.action} {{
disabled={false} default: () =>
> h(
{{ NEllipsis,
default: () => {
h(NEllipsis, style: 'max-width: 350px;line-height: 1.5'
{ },
style: 'max-width: 350px;line-height: 1.5' () => item.text
}, )
() => item.text }}
) </ButtonLink>
}} )
</ButtonLink> })}
) </NSpace>
})} )
</NSpace>
)
} }
watch(()=> props.show, watch(
() => { () => props.show,
showRef.value = props.show () => {
}) showRef.value = props.show
}
)
return {renderDownstreamDependencies, confirmToHandle, cancelToHandle, showRef} return {
renderDownstreamDependencies,
confirmToHandle,
cancelToHandle,
showRef
}
}, },
render() { render() {
const { t } = useI18n() const { t } = useI18n()
return ( return (
<NModal <NModal
v-model:show={this.showRef} v-model:show={this.showRef}
preset={'dialog'} preset={'dialog'}
type={this.$props.required? 'error':'warning'} type={this.$props.required ? 'error' : 'warning'}
title={t('project.workflow.warning_dependent_tasks_title')} title={t('project.workflow.warning_dependent_tasks_title')}
positiveText={this.$props.required? '':t('project.workflow.confirm')} positiveText={this.$props.required ? '' : t('project.workflow.confirm')}
negativeText={t('project.workflow.cancel')} negativeText={t('project.workflow.cancel')}
maskClosable={false} maskClosable={false}
onNegativeClick={this.cancelToHandle} onNegativeClick={this.cancelToHandle}
onPositiveClick={this.confirmToHandle} onPositiveClick={this.confirmToHandle}
onClose={this.cancelToHandle} onClose={this.cancelToHandle}
> >
{{ {{
default: () => ( default: () => this.renderDownstreamDependencies()
this.renderDownstreamDependencies() }}
) </NModal>
}}
</NModal>
) )
} }
}) })

167
dolphinscheduler-ui/src/views/projects/components/dependencies/use-dependencies.ts

@ -15,44 +15,73 @@
* limitations under the License. * limitations under the License.
*/ */
import {DependentTaskReq} from "@/service/modules/lineages/types"; import { DependentTaskReq } from '@/service/modules/lineages/types'
import {queryDependentTasks} from "@/service/modules/lineages"; import { queryDependentTasks } from '@/service/modules/lineages'
import {TASK_TYPES_MAP} from "@/store/project"; import { TASK_TYPES_MAP } from '@/store/project'
export function useDependencies() { export function useDependencies() {
const getDependentTasksBySingleTask = async (
const getDependentTasksBySingleTask = async (projectCode: any, workflowCode: any, taskCode: any) => { projectCode: any,
let tasks = [] as any workflowCode: any,
taskCode: any
) => {
const tasks = [] as any
if (workflowCode && taskCode) { 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) const res = await queryDependentTasks(projectCode, dependentTaskReq)
res.filter((item: any) => item.processDefinitionCode !== workflowCode && item.taskType === TASK_TYPES_MAP.DEPENDENT.alias) res
.forEach((item: any) => { .filter(
tasks.push(item.processDefinitionName + '->' + item.taskName) (item: any) =>
}) item.processDefinitionCode !== workflowCode &&
item.taskType === TASK_TYPES_MAP.DEPENDENT.alias
)
.forEach((item: any) => {
tasks.push(item.processDefinitionName + '->' + item.taskName)
})
} }
return tasks return tasks
} }
const getDependentTasksByWorkflow = async (projectCode: any, workflowCode: any) => { const getDependentTasksByWorkflow = async (
let tasks = [] as any projectCode: any,
workflowCode: any
) => {
const tasks = [] as any
if (workflowCode) { if (workflowCode) {
let dependentTaskReq = {workFlowCode: workflowCode} as DependentTaskReq const dependentTaskReq = {
workFlowCode: workflowCode
} as DependentTaskReq
const res = await queryDependentTasks(projectCode, dependentTaskReq) const res = await queryDependentTasks(projectCode, dependentTaskReq)
res.filter((item: any) => item.processDefinitionCode !== workflowCode && item.taskType === TASK_TYPES_MAP.DEPENDENT.alias) res
.forEach((item: any) => { .filter(
tasks.push(item.processDefinitionName + '->' + item.taskName) (item: any) =>
}) item.processDefinitionCode !== workflowCode &&
item.taskType === TASK_TYPES_MAP.DEPENDENT.alias
)
.forEach((item: any) => {
tasks.push(item.processDefinitionName + '->' + item.taskName)
})
} }
return tasks return tasks
} }
const getDependentTasksByMultipleTasks = async (projectCode: any, workflowCode: any, taskCodes: any[]) => { const getDependentTasksByMultipleTasks = async (
projectCode: any,
workflowCode: any,
taskCodes: any[]
) => {
let tasks = [] as any let tasks = [] as any
if (workflowCode && taskCodes?.length>0) { if (workflowCode && taskCodes?.length > 0) {
for(const taskCode of taskCodes) { for (const taskCode of taskCodes) {
const res = await getDependentTasksBySingleTask(projectCode, workflowCode, taskCode) const res = await getDependentTasksBySingleTask(
if (res?.length >0) { projectCode,
workflowCode,
taskCode
)
if (res?.length > 0) {
tasks = tasks.concat(res) tasks = tasks.concat(res)
} }
} }
@ -60,11 +89,19 @@ export function useDependencies() {
return tasks return tasks
} }
const getDependentTaskLinksByMultipleTasks = async (projectCode: any, workflowCode: any, taskCodes: any[]) => { const getDependentTaskLinksByMultipleTasks = async (
projectCode: any,
workflowCode: any,
taskCodes: any[]
) => {
let dependentTaskLinks = [] as any let dependentTaskLinks = [] as any
if (workflowCode && projectCode) { if (workflowCode && projectCode) {
for (const taskCode of taskCodes) { 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) dependentTaskLinks = dependentTaskLinks.concat(res)
}) })
} }
@ -73,50 +110,74 @@ export function useDependencies() {
} }
const getDependentTaskLinks = async (projectCode: any, workflowCode: any) => { const getDependentTaskLinks = async (projectCode: any, workflowCode: any) => {
let dependentTaskReq = {workFlowCode: workflowCode} as DependentTaskReq const dependentTaskReq = { workFlowCode: workflowCode } as DependentTaskReq
let dependentTaskLinks = [] as any const dependentTaskLinks = [] as any
if (workflowCode && projectCode) { if (workflowCode && projectCode) {
await queryDependentTasks(projectCode, dependentTaskReq).then((res: any) => { await queryDependentTasks(projectCode, dependentTaskReq).then(
res.filter((item: any) => item.processDefinitionCode !== workflowCode && item.taskType === TASK_TYPES_MAP.DEPENDENT.alias) (res: any) => {
.forEach((item: any) => { res
dependentTaskLinks.push( .filter(
{ (item: any) =>
item.processDefinitionCode !== workflowCode &&
item.taskType === TASK_TYPES_MAP.DEPENDENT.alias
)
.forEach((item: any) => {
dependentTaskLinks.push({
text: item.processDefinitionName + '->' + item.taskName, text: item.processDefinitionName + '->' + item.taskName,
show: true, show: true,
action: () => { action: () => {
const url = `/projects/${item.projectCode}/workflow/definitions/${item.processDefinitionCode}` const url = `/projects/${item.projectCode}/workflow/definitions/${item.processDefinitionCode}`
window.open(url, '_blank') window.open(url, '_blank')
}, }
} })
) })
}) }
}) )
} }
return dependentTaskLinks return dependentTaskLinks
} }
const getDependentTaskLinksByTask = async (projectCode: any, workflowCode: any, taskCode: any) => { const getDependentTaskLinksByTask = async (
let dependentTaskReq = {workFlowCode: workflowCode, taskCode: taskCode} as DependentTaskReq projectCode: any,
let dependentTaskLinks = [] as any workflowCode: any,
taskCode: any
) => {
const dependentTaskReq = {
workFlowCode: workflowCode,
taskCode: taskCode
} as DependentTaskReq
const dependentTaskLinks = [] as any
if (workflowCode && projectCode) { if (workflowCode && projectCode) {
await queryDependentTasks(projectCode, dependentTaskReq).then((res: any) => { await queryDependentTasks(projectCode, dependentTaskReq).then(
res.filter((item: any) => item.processDefinitionCode !== workflowCode && item.taskType === TASK_TYPES_MAP.DEPENDENT.alias) (res: any) => {
.forEach((item: any) => { res
dependentTaskLinks.push( .filter(
{ (item: any) =>
item.processDefinitionCode !== workflowCode &&
item.taskType === TASK_TYPES_MAP.DEPENDENT.alias
)
.forEach((item: any) => {
dependentTaskLinks.push({
text: item.processDefinitionName + '->' + item.taskName, text: item.processDefinitionName + '->' + item.taskName,
show: true, show: true,
action: () => { action: () => {
const url = `/projects/${item.projectCode}/workflow/definitions/${item.processDefinitionCode}` const url = `/projects/${item.projectCode}/workflow/definitions/${item.processDefinitionCode}`
window.open(url, '_blank') window.open(url, '_blank')
}, }
} })
) })
}) }
}) )
} }
return dependentTaskLinks return dependentTaskLinks
} }
return { getDependentTasksBySingleTask, getDependentTasksByMultipleTasks, getDependentTaskLinks, getDependentTasksByWorkflow, getDependentTaskLinksByTask, getDependentTaskLinksByMultipleTasks } return {
getDependentTasksBySingleTask,
getDependentTasksByMultipleTasks,
getDependentTaskLinks,
getDependentTasksByWorkflow,
getDependentTaskLinksByTask,
getDependentTaskLinksByMultipleTasks
}
} }

32
dolphinscheduler-ui/src/views/projects/list/components/use-worker-group.ts

@ -17,14 +17,17 @@
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { reactive, ref, SetupContext } from 'vue' import { reactive, ref, SetupContext } from 'vue'
import { Option } from "naive-ui/es/transfer/src/interface" import { Option } from 'naive-ui/es/transfer/src/interface'
import { queryAllWorkerGroups } from "@/service/modules/worker-groups" import { queryAllWorkerGroups } from '@/service/modules/worker-groups'
import { queryWorkerGroupsByProjectCode, assignWorkerGroups } from "@/service/modules/projects-worker-group" import {
import { UpdateProjectWorkerGroupsReq } from "@/service/modules/projects-worker-group/types" queryWorkerGroupsByProjectCode,
assignWorkerGroups
} from '@/service/modules/projects-worker-group'
import { UpdateProjectWorkerGroupsReq } from '@/service/modules/projects-worker-group/types'
export function useWorkerGroup( export function useWorkerGroup(
props: any, props: any,
ctx: SetupContext<('cancelModal' | 'confirmModal')[]> ctx: SetupContext<('cancelModal' | 'confirmModal')[]>
) { ) {
const { t } = useI18n() const { t } = useI18n()
@ -39,14 +42,18 @@ export function useWorkerGroup(
variables.model.workerGroupOptions = [] variables.model.workerGroupOptions = []
queryAllWorkerGroups().then((res: any) => { queryAllWorkerGroups().then((res: any) => {
for (const workerGroup of res) { 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) => { const initAssignedWorkerGroups = (projectCode: number) => {
variables.model.assignedWorkerGroups = ref([] as any) variables.model.assignedWorkerGroups = ref([] as any)
queryWorkerGroupsByProjectCode(projectCode).then((res: any) =>{ queryWorkerGroupsByProjectCode(projectCode).then((res: any) => {
res.data.forEach((item: any) => { res.data.forEach((item: any) => {
variables.model.assignedWorkerGroups.push(item.workerGroup) variables.model.assignedWorkerGroups.push(item.workerGroup)
}) })
@ -56,7 +63,7 @@ export function useWorkerGroup(
initOptions() initOptions()
const handleValidate = () => { const handleValidate = () => {
if (variables.model?.assignedWorkerGroups.length>0) { if (variables.model?.assignedWorkerGroups.length > 0) {
submitModal() submitModal()
ctx.emit('confirmModal', props.showModalRef) ctx.emit('confirmModal', props.showModalRef)
} }
@ -64,8 +71,11 @@ export function useWorkerGroup(
const submitModal = async () => { const submitModal = async () => {
if (props.row.code) { if (props.row.code) {
let data: UpdateProjectWorkerGroupsReq = { const data: UpdateProjectWorkerGroupsReq = {
workerGroups: variables.model.assignedWorkerGroups.length>0? variables.model.assignedWorkerGroups.join(','):'' workerGroups:
variables.model.assignedWorkerGroups.length > 0
? variables.model.assignedWorkerGroups.join(',')
: ''
} }
assignWorkerGroups(data, props.row.code) assignWorkerGroups(data, props.row.code)
} }

49
dolphinscheduler-ui/src/views/projects/list/components/worker-group-modal.tsx

@ -22,10 +22,10 @@ import {
toRefs, toRefs,
watch watch
} from 'vue' } from 'vue'
import { NTransfer} from 'naive-ui' import { NTransfer } from 'naive-ui'
import Modal from '@/components/modal' import Modal from '@/components/modal'
import styles from "@/views/security/user-manage/index.module.scss"; import styles from '@/views/security/user-manage/index.module.scss'
import {useWorkerGroup} from "@/views/projects/list/components/use-worker-group"; import { useWorkerGroup } from '@/views/projects/list/components/use-worker-group'
const props = { const props = {
showModalRef: { showModalRef: {
@ -43,7 +43,8 @@ const WorkerGroupModal = defineComponent({
props, props,
emits: ['cancelModal', 'confirmModal'], emits: ['cancelModal', 'confirmModal'],
setup(props, ctx) { setup(props, ctx) {
const { variables, t, handleValidate, initAssignedWorkerGroups } = useWorkerGroup(props, ctx) const { variables, t, handleValidate, initAssignedWorkerGroups } =
useWorkerGroup(props, ctx)
const cancelModal = () => { const cancelModal = () => {
ctx.emit('cancelModal', props.showModalRef) ctx.emit('cancelModal', props.showModalRef)
@ -56,12 +57,12 @@ const WorkerGroupModal = defineComponent({
} }
watch( watch(
() => props.showModalRef, () => props.showModalRef,
() => { () => {
if (props.showModalRef) { if (props.showModalRef) {
initAssignedWorkerGroups(props.row.code) initAssignedWorkerGroups(props.row.code)
}
} }
}
) )
return { ...toRefs(variables), t, cancelModal, confirmModal, trim } return { ...toRefs(variables), t, cancelModal, confirmModal, trim }
@ -69,21 +70,21 @@ const WorkerGroupModal = defineComponent({
render() { render() {
const { t } = this const { t } = this
return ( return (
<Modal <Modal
title={t('project.list.assign_worker_group')} title={t('project.list.assign_worker_group')}
show={this.showModalRef} show={this.showModalRef}
onConfirm={this.confirmModal} onConfirm={this.confirmModal}
onCancel={this.cancelModal} onCancel={this.cancelModal}
confirmClassName='btn-submit' confirmClassName='btn-submit'
cancelClassName='btn-cancel' cancelClassName='btn-cancel'
> >
<NTransfer <NTransfer
virtualScroll virtualScroll
class={styles.transfer} class={styles.transfer}
options={this.model.workerGroupOptions} options={this.model.workerGroupOptions}
v-model:value={this.model.assignedWorkerGroups} v-model:value={this.model.assignedWorkerGroups}
/> />
</Modal> </Modal>
) )
} }
}) })

10
dolphinscheduler-ui/src/views/projects/list/index.tsx

@ -29,7 +29,7 @@ import { useTable } from './use-table'
import Card from '@/components/card' import Card from '@/components/card'
import Search from '@/components/input-search' import Search from '@/components/input-search'
import ProjectModal from './components/project-modal' 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({ const list = defineComponent({
name: 'list', name: 'list',
@ -173,10 +173,10 @@ const list = defineComponent({
onConfirmModal={this.onConfirmModal} onConfirmModal={this.onConfirmModal}
/> />
<WorkerGroupModal <WorkerGroupModal
showModalRef={this.showWorkerGroupModalRef} showModalRef={this.showWorkerGroupModalRef}
row={this.row} row={this.row}
onCancelModal={this.onCancelWorkerGroupModal} onCancelModal={this.onCancelWorkerGroupModal}
onConfirmModal={this.onConfirmWorkerGroupModal} onConfirmModal={this.onConfirmWorkerGroupModal}
/> />
</NSpace> </NSpace>
) )

40
dolphinscheduler-ui/src/views/projects/list/use-table.ts

@ -39,9 +39,9 @@ import {
} from '@/common/column-width-config' } from '@/common/column-width-config'
import type { Router } from 'vue-router' import type { Router } from 'vue-router'
import type { ProjectRes } from '@/service/modules/projects/types' import type { ProjectRes } from '@/service/modules/projects/types'
import {ControlOutlined, DeleteOutlined, EditOutlined} from '@vicons/antd' import { ControlOutlined, DeleteOutlined, EditOutlined } from '@vicons/antd'
import {useUserStore} from "@/store/user/user"; import { useUserStore } from '@/store/user/user'
import {UserInfoRes} from "@/service/modules/users/types"; import { UserInfoRes } from '@/service/modules/users/types'
export function useTable() { export function useTable() {
const { t } = useI18n() const { t } = useI18n()
@ -177,31 +177,31 @@ export function useTable() {
} }
), ),
IS_ADMIN && IS_ADMIN &&
h( h(
NTooltip, NTooltip,
{ {
trigger: 'hover' trigger: 'hover'
}, },
{ {
trigger: () => trigger: () =>
h( h(
NButton, NButton,
{ {
circle: true, circle: true,
type: 'info', type: 'info',
size: 'small', size: 'small',
class: 'edit', class: 'edit',
onClick: () => { onClick: () => {
handleAssign(row) handleAssign(row)
} }
}, },
{ {
icon: () => h(NIcon, null, () => h(ControlOutlined)) icon: () => h(NIcon, null, () => h(ControlOutlined))
} }
), ),
default: () => t('project.list.assign_worker_group') default: () => t('project.list.assign_worker_group')
} }
), ),
h( h(
NPopconfirm, NPopconfirm,
{ {

2
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 { format } from 'date-fns'
import { toLower } from 'lodash' import { toLower } from 'lodash'
import { useI18n } from 'vue-i18n' 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 type { StateData } from './types'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'

2
dolphinscheduler-ui/src/views/projects/overview/use-task-state.ts

@ -21,7 +21,7 @@ import { format } from 'date-fns'
import { toLower } from 'lodash' import { toLower } from 'lodash'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { countTaskState } from '@/service/modules/projects-analysis' 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 type { StateData } from './types'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'

2
dolphinscheduler-ui/src/views/projects/preference/use-form.ts

@ -120,7 +120,7 @@ export function useForm() {
] ]
const restructurePreferencesItems = (preferencesItems: any) => { const restructurePreferencesItems = (preferencesItems: any) => {
for (let item of preferencesItems) { for (const item of preferencesItems) {
if (item.validate?.required) { if (item.validate?.required) {
item.validate.required = false item.validate.required = false
item.span = 12 item.span = 12

2
dolphinscheduler-ui/src/views/projects/task/components/node/detail-modal.tsx

@ -130,7 +130,7 @@ const NodeDetailModal = defineComponent({
const restructureNodeData = (data: INodeData) => { const restructureNodeData = (data: INodeData) => {
if (!data?.id) { if (!data?.id) {
for (let item in projectPreferences.value) { for (const item in projectPreferences.value) {
if (projectPreferences.value[item] !== null && item in data) { if (projectPreferences.value[item] !== null && item in data) {
Object.assign(data, { item: projectPreferences.value[item] }) Object.assign(data, { item: projectPreferences.value[item] })
} }

9
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.dependentType) {
if (dependItem.depTaskCode == 0) if (dependItem.depTaskCode == 0)
dependItem.dependentType = 'DEPENDENT_ON_WORKFLOW' dependItem.dependentType = 'DEPENDENT_ON_WORKFLOW'
else else dependItem.dependentType = 'DEPENDENT_ON_TASK'
dependItem.dependentType = 'DEPENDENT_ON_TASK'
} }
if (dependItem.projectCode) { if (dependItem.projectCode) {
itemListOptions.value[itemIndex].definitionCodeOptions = itemListOptions.value[itemIndex].definitionCodeOptions =
@ -326,7 +325,8 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
onUpdateValue: (dependentType: string) => { onUpdateValue: (dependentType: string) => {
const item = model.dependTaskList[i].dependItemList[j] const item = model.dependTaskList[i].dependItemList[j]
if (item.definitionCode) if (item.definitionCode)
item.depTaskCode = dependentType === 'DEPENDENT_ON_WORKFLOW' ? 0 : -1 item.depTaskCode =
dependentType === 'DEPENDENT_ON_WORKFLOW' ? 0 : -1
} }
}, },
options: DependentTypeOptions, options: DependentTypeOptions,
@ -388,7 +388,8 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
const item = model.dependTaskList[i].dependItemList[j] const item = model.dependTaskList[i].dependItemList[j]
selectOptions.value[i].dependItemList[j].depTaskCodeOptions = selectOptions.value[i].dependItemList[j].depTaskCodeOptions =
await getTaskList(item.projectCode, processCode) await getTaskList(item.projectCode, processCode)
item.depTaskCode = item.dependentType === 'DEPENDENT_ON_WORKFLOW' ? 0 : -1 item.depTaskCode =
item.dependentType === 'DEPENDENT_ON_WORKFLOW' ? 0 : -1
} }
}, },
options: options:

2
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts

@ -70,7 +70,7 @@ export function useEnvironmentName(
) )
if (model?.environmentCode) { if (model?.environmentCode) {
if (options.value) { if (options.value) {
let elementExists = const elementExists =
options.value.find( options.value.find(
(item) => item.value === model.environmentCode (item) => item.value === model.environmentCode
) !== undefined ) !== undefined

7
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(() => const hiveSqlScriptSpan = computed(() =>
model.hiveCliTaskExecutionType === 'SCRIPT' ? 24 : 0 model.hiveCliTaskExecutionType === 'SCRIPT' ? 24 : 0
) )
const resourcesRequired = ref( const resourcesRequired = ref(model.hiveCliTaskExecutionType !== 'SCRIPT')
model.hiveCliTaskExecutionType !== 'SCRIPT'
)
const resourcesLimit = computed(() => const resourcesLimit = computed(() =>
model.hiveCliTaskExecutionType === 'SCRIPT' ? -1 : 1 model.hiveCliTaskExecutionType === 'SCRIPT' ? -1 : 1
@ -46,8 +44,7 @@ export function useHiveCli(model: { [field: string]: any }): IJsonItem[] {
watch( watch(
() => model.hiveCliTaskExecutionType, () => model.hiveCliTaskExecutionType,
() => { () => {
resourcesRequired.value = resourcesRequired.value = model.hiveCliTaskExecutionType !== 'SCRIPT'
model.hiveCliTaskExecutionType !== 'SCRIPT'
} }
) )

1
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 = [ export const IMAGE_PULL_POLICY_LIST = [
{ {
value: 'IfNotPresent', value: 'IfNotPresent',

2
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-queue.ts

@ -27,6 +27,6 @@ export function useYarnQueue(): IJsonItem {
span: 12, span: 12,
props: { props: {
placeholder: t('project.node.yarn_queue_tips') placeholder: t('project.node.yarn_queue_tips')
}, }
} }
} }

20
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') { if (field === 'target_datasource_id' && typeof value === 'number') {
const result = await getDatasourceDatabasesById(value) const result = await getDatasourceDatabasesById(value)
targetDatabaseOptions.value = result || [] targetDatabaseOptions.value = result || []
if (reset) { if (reset) {
targetTableOptions.value = [] targetTableOptions.value = []
targetTableColumnOptions.value = [] targetTableColumnOptions.value = []
model.target_database = null model.target_database = null
model.target_table = null model.target_table = null
model.target_field = null model.target_field = null
} }
} }
if (field === 'src_database' && typeof value === 'string') { if (field === 'src_database' && typeof value === 'string') {
const result = await getDatasourceTablesById( const result = await getDatasourceTablesById(
model.src_datasource_id, model.src_datasource_id,
value value
) )

8
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 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') 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 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 = [ const SQL_EXECUTION_TYPES = [
{ {

165
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts

@ -15,94 +15,93 @@
* limitations under the License. * limitations under the License.
*/ */
import {onMounted, ref, Ref, watch} from 'vue' import { onMounted, ref, Ref, watch } from 'vue'
import {queryDataSourceList} from '@/service/modules/data-source' import { queryDataSourceList } from '@/service/modules/data-source'
import {useI18n} from 'vue-i18n' import { useI18n } from 'vue-i18n'
import type {IJsonItem, IDataBase} from '../types' import type { IJsonItem, IDataBase } from '../types'
import type {TypeReq} from '@/service/modules/data-source/types' import type { TypeReq } from '@/service/modules/data-source/types'
export function useDatasource( export function useDatasource(
model: { [field: string]: any }, model: { [field: string]: any },
span: Ref, span: Ref,
fieldType: string, fieldType: string,
fieldDatasource: string fieldDatasource: string
): IJsonItem[] { ): IJsonItem[] {
const {t} = useI18n() const { t } = useI18n()
const dataSourceList = ref([]) const dataSourceList = ref([])
const loading = ref(false) const loading = ref(false)
const hadoopSourceTypes = ref(['HIVE', 'HDFS']) const hadoopSourceTypes = ref(['HIVE', 'HDFS'])
const getDataSource = async (type: IDataBase) => { const getDataSource = async (type: IDataBase) => {
if (hadoopSourceTypes.value.some(source => source === type)) { if (hadoopSourceTypes.value.some((source) => source === type)) {
loading.value = false; loading.value = false
return 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
} }
onMounted(() => { loading.value = true
getDataSource(model.sourceType) if (model.modelType === 'import') {
}) model.sourceMysqlDatasource = model.sourceMysqlDatasource
? model.sourceMysqlDatasource
watch( : ''
() => [ model.sourceMysqlType = type
model.sourceType, } else {
], model.sourceMysqlDatasource = model.targetMysqlDatasource
() => { ? model.targetMysqlDatasource
getDataSource(model.sourceType) : ''
} 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( watch(
() => [ () => [model.sourceType],
model.targetType, () => {
], getDataSource(model.sourceType)
() => { }
getDataSource(model.targetType) )
}
)
return [
{
type: 'input',
field: fieldType,
name: t('project.node.datasource'),
span: 0,
validate: {
required: true,
} watch(
}, () => [model.targetType],
{ () => {
type: 'select', getDataSource(model.targetType)
field: fieldDatasource, }
name: t('project.node.datasource'), )
span: span, return [
props: { {
placeholder: t('project.node.datasource_tips'), type: 'input',
filterable: true, field: fieldType,
loading name: t('project.node.datasource'),
}, span: 0,
options: dataSourceList, validate: {
validate: { required: true
trigger: ['blur', 'input'], }
validator(validate, value) { },
if (!value) { {
return new Error(t('project.node.datasource_tips')) 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'))
}
} }
] }
}
]
} }

594
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts

@ -15,312 +15,318 @@
* limitations under the License. * limitations under the License.
*/ */
import {h, onMounted, Ref, ref, watch} from 'vue' import { h, onMounted, Ref, ref, watch } from 'vue'
import {useI18n} from 'vue-i18n' import { useI18n } from 'vue-i18n'
import {useDatasource} from './use-sqoop-datasource' import { useDatasource } from './use-sqoop-datasource'
import {useCustomParams} from '.' import { useCustomParams } from '.'
import styles from '../index.module.scss' import styles from '../index.module.scss'
import type {IJsonItem, IOption, ModelType} from '../types' import type { IJsonItem, IOption, ModelType } from '../types'
export function useSourceType( export function useSourceType(
model: { [field: string]: any }, model: { [field: string]: any },
unCustomSpan: Ref<number> unCustomSpan: Ref<number>
): IJsonItem[] { ): IJsonItem[] {
const {t} = useI18n() const { t } = useI18n()
const rdbmsSpan = ref(24) const rdbmsSpan = ref(24)
const tableSpan = ref(0) const tableSpan = ref(0)
const editorSpan = ref(24) const editorSpan = ref(24)
const columnSpan = ref(0) const columnSpan = ref(0)
const hiveSpan = ref(0) const hiveSpan = ref(0)
const hdfsSpan = ref(0) const hdfsSpan = ref(0)
const datasourceSpan = ref(24) const datasourceSpan = ref(24)
const isChange: any = ref(false) const isChange: any = ref(false)
const rdbmsSourceTypes = ref([ const rdbmsSourceTypes = ref([
{ {
label: 'MYSQL', label: 'MYSQL',
value: 'MYSQL' value: 'MYSQL'
}, },
{ {
label: 'ORACLE', label: 'ORACLE',
value: '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', label: t('project.node.form'),
value: 'SQLSERVER' value: '0'
}, },
{ {
label: 'HANA', label: 'SQL',
value: 'HANA' value: '1'
} }
] as IOption[]) ],
const hadoopSourceTypes = ref([ props: {
{ 'on-update:value': (value: '0' | '1') => {
label: 'HIVE', model.targetType = value === '0' ? 'HIVE' : 'HDFS'
value: 'HIVE'
}, {
label: 'HDFS',
value: 'HDFS'
} }
] as IOption[]) }
const sourceTypes = ref() },
const resetSpan = () => { {
rdbmsSpan.value = type: 'input',
unCustomSpan.value && rdbmsSourceTypes.value.some(source => source.value === model.sourceType) ? 24 : 0 field: 'srcTable',
tableSpan.value = rdbmsSpan.value && model.srcQueryType === '0' ? 24 : 0 name: t('project.node.table'),
editorSpan.value = rdbmsSpan.value && model.srcQueryType === '1' ? 24 : 0 span: tableSpan,
columnSpan.value = tableSpan.value && model.srcColumnType === '1' ? 24 : 0 props: {
hiveSpan.value = unCustomSpan.value && model.sourceType === 'HIVE' ? 24 : 0 placeholder: t('project.node.table_tips')
hdfsSpan.value = unCustomSpan.value && model.sourceType === 'HDFS' ? 24 : 0 },
datasourceSpan.value = validate: {
unCustomSpan.value && rdbmsSourceTypes.value.some(source => source.value === model.sourceType) ? 24 : 0 trigger: ['input', 'blur'],
} required: true,
const resetValue = () => { validator(validate, value) {
if (!isChange.value) { if (tableSpan.value && !value) {
isChange.value = true return new Error(t('project.node.table_tips'))
return }
} }
switch (model.modelType) { }
case 'import': },
model.sourceMysqlDatasource = '' {
break type: 'radio',
case 'export': field: 'srcColumnType',
model.sourceHiveDatabase = '' name: t('project.node.column_type'),
model.sourceHiveTable = '' span: tableSpan,
model.sourceHivePartitionKey = '' options: [
model.sourceHivePartitionValue = '' { label: t('project.node.all_columns'), value: '0' },
model.sourceHdfsExportDir = '' { label: t('project.node.some_columns'), value: '1' }
break ]
default: },
model.sourceMysqlDatasource = '' {
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) { type: 'input',
case 'import': field: 'sourceHiveDatabase',
return rdbmsSourceTypes.value name: t('project.node.database'),
case 'export': span: hiveSpan,
return hadoopSourceTypes.value props: {
default: placeholder: t('project.node.database_tips')
return rdbmsSourceTypes.value },
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]; type: 'input',
}) field: 'sourceHiveTable',
name: t('project.node.table'),
watch( span: hiveSpan,
() => model.modelType, props: {
(modelType: ModelType) => { placeholder: t('project.node.hive_table_tips')
sourceTypes.value = getSourceTypesByModelType(modelType) },
model.sourceType = sourceTypes.value[0].value 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, type: 'input',
model.sourceType, field: 'sourceHivePartitionKey',
model.srcQueryType, name: t('project.node.hive_partition_keys'),
model.srcColumnType span: hiveSpan,
], props: {
() => { placeholder: t('project.node.hive_partition_keys_tips')
resetValue(); }
resetSpan(); },
{
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: 'editor',
type: 'custom', field: 'sourceMysqlSrcQuerySql',
field: 'custom-title-source', name: t('project.node.sql_statement'),
span: unCustomSpan, span: editorSpan,
widget: h( validate: {
'div', trigger: ['blur', 'input'],
{class: styles['field-title']}, required: true,
t('project.node.data_source') validator(validate, value) {
) if (editorSpan.value && !value) {
}, return new Error(t('project.node.sql_statement_tips'))
{ }
type: 'select', }
field: 'sourceType', }
name: t('project.node.type'), },
span: unCustomSpan, ...useCustomParams({
options: sourceTypes model,
}, field: 'mapColumnHive',
...useDatasource( name: 'map_column_hive',
model, isSimple: true,
datasourceSpan, span: rdbmsSpan
'sourceMysqlType', }),
'sourceMysqlDatasource' ...useCustomParams({
), model,
{ field: 'mapColumnJava',
type: 'radio', name: 'map_column_java',
field: 'srcQueryType', isSimple: true,
name: t('project.node.model_type'), span: rdbmsSpan
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
})
]
} }

750
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts

@ -15,407 +15,413 @@
* limitations under the License. * limitations under the License.
*/ */
import {h, onMounted, Ref, ref, watch} from 'vue' import { h, onMounted, Ref, ref, watch } from 'vue'
import {useI18n} from 'vue-i18n' import { useI18n } from 'vue-i18n'
import {useDatasource} from './use-sqoop-datasource' import { useDatasource } from './use-sqoop-datasource'
import styles from '../index.module.scss' import styles from '../index.module.scss'
import type {IJsonItem, IOption, SourceType} from '../types' import type { IJsonItem, IOption, SourceType } from '../types'
export function useTargetType( export function useTargetType(
model: { [field: string]: any }, model: { [field: string]: any },
unCustomSpan: Ref<number> unCustomSpan: Ref<number>
): IJsonItem[] { ): IJsonItem[] {
const {t} = useI18n() const { t } = useI18n()
const hiveSpan = ref(24) const hiveSpan = ref(24)
const hdfsSpan = ref(0) const hdfsSpan = ref(0)
const rdbmsSpan = ref(0) const rdbmsSpan = ref(0)
const dataSourceSpan = ref(0) const dataSourceSpan = ref(0)
const updateSpan = ref(0) const updateSpan = ref(0)
const isChange: any = ref(false) const isChange: any = ref(false)
const rdbmsSourceTypes = ref([ const rdbmsSourceTypes = ref([
{ {
label: 'MYSQL', label: 'MYSQL',
value: 'MYSQL' value: 'MYSQL'
}, },
{ {
label: 'ORACLE', label: 'ORACLE',
value: 'ORACLE' value: 'ORACLE'
}, },
{ {
label: 'SQLSERVER', label: 'SQLSERVER',
value: 'SQLSERVER' value: 'SQLSERVER'
}, },
{ {
label: 'HANA', label: 'HANA',
value: 'HANA' value: 'HANA'
} }
] as IOption[]) ] as IOption[])
const hadoopSourceTypes = ref([ const hadoopSourceTypes = ref([
{ {
label: 'HIVE', label: 'HIVE',
value: 'HIVE' value: 'HIVE'
}, { },
label: 'HDFS', {
value: 'HDFS' 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
} }
] as IOption[])
const targetTypes = ref()
const getTargetTypesBySourceType = ( const resetSpan = () => {
sourceType: SourceType, hiveSpan.value = unCustomSpan.value && model.targetType === 'HIVE' ? 24 : 0
srcQueryType: string hdfsSpan.value = unCustomSpan.value && model.targetType === 'HDFS' ? 24 : 0
): IOption[] => { rdbmsSpan.value =
switch (sourceType) { unCustomSpan.value &&
case 'MYSQL': rdbmsSourceTypes.value.some((target) => target.value === model.targetType)
if (srcQueryType === '1') { ? 24
return hadoopSourceTypes.value : 0
} dataSourceSpan.value =
return hadoopSourceTypes.value unCustomSpan.value &&
case 'HDFS': rdbmsSourceTypes.value.some((target) => target.value === model.targetType)
case 'HIVE': ? 24
return rdbmsSourceTypes.value : 0
default: updateSpan.value = rdbmsSpan.value && model.targetMysqlIsUpdate ? 24 : 0
return hadoopSourceTypes.value }
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 = () => { const resetValue = () => {
if (!isChange.value) { if (!isChange.value) {
isChange.value = true isChange.value = true
return return
} }
switch (model.modelType) { switch (model.modelType) {
case 'import': case 'import':
model.targetHiveDatabase = ''; model.targetHiveDatabase = ''
model.targetHiveTable = ''; model.targetHiveTable = ''
model.targetHdfsTargetPath = ''; model.targetHdfsTargetPath = ''
break break
case 'export': case 'export':
model.targetMysqlDatasource = ''; model.targetMysqlDatasource = ''
model.targetMysqlTable = ''; model.targetMysqlTable = ''
model.targetMysqlColumns = ''; model.targetMysqlColumns = ''
model.targetMysqlFieldsTerminated = ''; model.targetMysqlFieldsTerminated = ''
model.targetMysqlLinesTerminated = ''; model.targetMysqlLinesTerminated = ''
model.targetMysqlTable = ''; model.targetMysqlTable = ''
break break
default: default:
model.sourceMysqlDatasource = ''; 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(() => { watch(
targetTypes.value = [...hadoopSourceTypes.value]; () => [unCustomSpan.value, model.targetType, model.targetMysqlIsUpdate],
}) () => {
resetValue()
resetSpan()
}
)
watch( return [
() => [model.sourceType, model.srcQueryType], {
([sourceType, srcQueryType]) => { type: 'custom',
targetTypes.value = getTargetTypesBySourceType(sourceType, srcQueryType) field: 'custom-title-target',
model.targetType = targetTypes.value[0].value 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], type: 'input',
() => { field: 'targetHiveTable',
resetValue(); name: t('project.node.table'),
resetSpan() 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: 'switch',
type: 'custom', field: 'targetHiveCreateTable',
field: 'custom-title-target', span: hiveSpan,
span: unCustomSpan, name: t('project.node.create_hive_table')
widget: h( },
'div', {
{class: styles['field-title']}, type: 'switch',
t('project.node.data_target') field: 'targetHiveDropDelimiter',
) span: hiveSpan,
}, name: t('project.node.drop_delimiter')
{ },
type: 'select', {
field: 'targetType', type: 'switch',
name: t('project.node.type'), field: 'targetHiveOverWrite',
span: unCustomSpan, span: hiveSpan,
options: targetTypes name: t('project.node.over_write_src')
}, },
{ {
type: 'input', type: 'input',
field: 'targetHiveDatabase', field: 'targetHiveTargetDir',
name: t('project.node.database'), name: t('project.node.hive_target_dir'),
span: hiveSpan, span: hiveSpan,
props: { props: {
placeholder: t('project.node.database_tips') placeholder: t('project.node.hive_target_dir_tips')
}, }
validate: { },
trigger: ['blur', 'input'], {
required: true, type: 'input',
validator(validate, value) { field: 'targetHiveReplaceDelimiter',
if (hiveSpan.value && !value) { name: t('project.node.replace_delimiter'),
return new Error(t('project.node.database_tips')) span: hiveSpan,
} props: {
} placeholder: t('project.node.replace_delimiter_tips')
} }
}, },
{ {
type: 'input', type: 'input',
field: 'targetHiveTable', field: 'targetHivePartitionKey',
name: t('project.node.table'), name: t('project.node.hive_partition_keys'),
span: hiveSpan, span: hiveSpan,
props: { props: {
placeholder: t('project.node.table') placeholder: t('project.node.hive_partition_keys_tips')
}, }
validate: { },
trigger: ['blur', 'input'], {
required: true, type: 'input',
validator(rule, value) { field: 'targetHivePartitionValue',
if (hiveSpan.value && !value) { name: t('project.node.hive_partition_values'),
return new Error(t('project.node.table_tips')) span: hiveSpan,
} props: {
} placeholder: t('project.node.hive_partition_values_tips')
} }
}, },
{ {
type: 'switch', type: 'input',
field: 'targetHiveCreateTable', field: 'targetHdfsTargetPath',
span: hiveSpan, name: t('project.node.target_dir'),
name: t('project.node.create_hive_table') span: hdfsSpan,
}, props: {
{ placeholder: t('project.node.target_dir_tips')
type: 'switch', },
field: 'targetHiveDropDelimiter', validate: {
span: hiveSpan, trigger: ['blur', 'input'],
name: t('project.node.drop_delimiter') required: true,
}, validator(rule, value) {
{ if (hdfsSpan.value && !value) {
type: 'switch', return new Error(t('project.node.target_dir_tips'))
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'
}
]
} }
] }
} },
const COMPRESSIONCODECS = [
{ {
label: 'snappy', type: 'switch',
value: 'snappy' field: 'targetHdfsDeleteTargetDir',
name: t('project.node.delete_target_dir'),
span: hdfsSpan
}, },
{ {
label: 'lzo', type: 'radio',
value: 'lzo' field: 'targetHdfsCompressionCodec',
name: t('project.node.compression_codec'),
span: hdfsSpan,
options: COMPRESSIONCODECS
}, },
{ {
label: 'gzip', type: 'radio',
value: 'gzip' field: 'targetHdfsFileType',
name: t('project.node.file_type'),
span: hdfsSpan,
options: FILETYPES
}, },
{ {
label: 'no', type: 'input',
value: '' field: 'targetHdfsFieldsTerminated',
} name: t('project.node.fields_terminated'),
] span: hdfsSpan,
const FILETYPES = [ 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', type: 'input',
value: '--as-avrodatafile' 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', type: 'input',
value: '--as-sequencefile' field: 'targetMysqlColumns',
name: t('project.node.column'),
span: rdbmsSpan,
props: {
placeholder: t('project.node.column_tips')
}
}, },
{ {
label: 'text', type: 'input',
value: '--as-textfile' field: 'targetMysqlFieldsTerminated',
name: t('project.node.fields_terminated'),
span: rdbmsSpan,
props: {
placeholder: t('project.node.fields_terminated_tips')
}
}, },
{ {
label: 'parquet', type: 'input',
value: '--as-parquetfile' 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'
}
] ]

5
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 if (loading.value) return
loading.value = true loading.value = true
await queryWorkerGroupsByProjectCode(projectCode).then((res: any) => { 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 loading.value = false
} }

16
dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts

@ -25,7 +25,7 @@ import type {
ILocalParam, ILocalParam,
IDependentParameters IDependentParameters
} from './types' } from './types'
import {ref} from "vue"; import { ref } from 'vue'
export function formatParams(data: INodeData): { export function formatParams(data: INodeData): {
processDefinitionCode: string processDefinitionCode: string
@ -132,7 +132,9 @@ export function formatParams(data: INodeData): {
fieldsTerminated: data.targetHdfsFieldsTerminated, fieldsTerminated: data.targetHdfsFieldsTerminated,
linesTerminated: data.targetHdfsLinesTerminated linesTerminated: data.targetHdfsLinesTerminated
} }
} else if (rdbmsSourceTypes.value.some(target => target === data.targetType)){ } else if (
rdbmsSourceTypes.value.some((target) => target === data.targetType)
) {
targetParams = { targetParams = {
targetType: data.targetMysqlType, targetType: data.targetMysqlType,
targetDatasource: data.targetMysqlDatasource, targetDatasource: data.targetMysqlDatasource,
@ -145,16 +147,16 @@ export function formatParams(data: INodeData): {
targetUpdateMode: data.targetMysqlUpdateMode targetUpdateMode: data.targetMysqlUpdateMode
} }
} }
if (rdbmsSourceTypes.value.some(target => target === data.sourceType)) { if (rdbmsSourceTypes.value.some((target) => target === data.sourceType)) {
sourceParams = { sourceParams = {
srcTable: data.srcQueryType === '1' ? '' : data.srcTable, srcTable: data.srcQueryType === '1' ? '' : data.srcTable,
srcColumnType: data.srcQueryType === '1' ? '0' : data.srcColumnType, srcColumnType: data.srcQueryType === '1' ? '0' : data.srcColumnType,
srcColumns: srcColumns:
data.srcQueryType === '1' || data.srcColumnType === '0' data.srcQueryType === '1' || data.srcColumnType === '0'
? '' ? ''
: data.srcColumns, : data.srcColumns,
srcQuerySql: srcQuerySql:
data.srcQueryType === '0' ? '' : data.sourceMysqlSrcQuerySql, data.srcQueryType === '0' ? '' : data.sourceMysqlSrcQuerySql,
srcQueryType: data.srcQueryType, srcQueryType: data.srcQueryType,
srcType: data.sourceMysqlType, srcType: data.sourceMysqlType,
srcDatasource: data.sourceMysqlDatasource, srcDatasource: data.sourceMysqlDatasource,

2
dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mr.ts

@ -45,7 +45,7 @@ export function useMr({
timeout: 30, timeout: 30,
programType: 'SCALA', programType: 'SCALA',
timeoutNotifyStrategy: ['WARN'], timeoutNotifyStrategy: ['WARN'],
yarnQueue: '', yarnQueue: ''
} as INodeData) } as INodeData)
return { return {

2
dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sqoop.ts

@ -59,7 +59,7 @@ export function useSqoop({
targetHdfsDeleteTargetDir: true, targetHdfsDeleteTargetDir: true,
targetHdfsCompressionCodec: 'snappy', targetHdfsCompressionCodec: 'snappy',
targetHdfsFileType: '--as-avrodatafile', targetHdfsFileType: '--as-avrodatafile',
targetMysqlType: 'MYSQL', targetMysqlType: 'MYSQL',
targetMysqlUpdateMode: 'allowinsert', targetMysqlUpdateMode: 'allowinsert',
targetHiveCreateTable: false, targetHiveCreateTable: false,
targetHiveDropDelimiter: false, targetHiveDropDelimiter: false,

97
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 * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {ref, Ref, unref} from 'vue' import { ref, Ref, unref } from 'vue'
import nodes from './tasks' import nodes from './tasks'
import getElementByJson from '@/components/form/get-elements-by-json' import getElementByJson from '@/components/form/get-elements-by-json'
import {useTaskNodeStore} from '@/store/project/task-node' import { useTaskNodeStore } from '@/store/project/task-node'
import {TASK_TYPES_MAP} from '@/store/project/task-type' import { TASK_TYPES_MAP } from '@/store/project/task-type'
import type {EditWorkflowDefinition, FormRules, IFormItem, IJsonItem, INodeData, ITaskData} from './types' import type {
EditWorkflowDefinition,
FormRules,
IFormItem,
IJsonItem,
INodeData,
ITaskData
} from './types'
export function useTask({ export function useTask({
data, data,
projectCode, projectCode,
from, from,
readonly, readonly,
definition definition
}: { }: {
data: ITaskData data: ITaskData
projectCode: number projectCode: number
from?: number from?: number
readonly?: boolean readonly?: boolean
definition?: EditWorkflowDefinition definition?: EditWorkflowDefinition
}): { }): {
elementsRef: Ref<IFormItem[]> elementsRef: Ref<IFormItem[]>
rulesRef: Ref<FormRules> rulesRef: Ref<FormRules>
model: INodeData model: INodeData
} { } {
const taskStore = useTaskNodeStore() const taskStore = useTaskNodeStore()
taskStore.updateDefinition(unref(definition), data?.code) taskStore.updateDefinition(unref(definition), data?.code)
const jsonRef = ref([]) as Ref<IJsonItem[]> const jsonRef = ref([]) as Ref<IJsonItem[]>
const elementsRef = ref([]) as Ref<IFormItem[]> const elementsRef = ref([]) as Ref<IFormItem[]>
const rulesRef = ref({}) const rulesRef = ref({})
const params = { const params = {
projectCode, projectCode,
from, from,
readonly, readonly,
data, data,
jsonRef, jsonRef,
updateElements: () => { updateElements: () => {
getElements() getElements()
}
} }
}
const {model, json} = nodes[data.taskType || 'SHELL'](params) const { model, json } = nodes[data.taskType || 'SHELL'](params)
jsonRef.value = json jsonRef.value = json
model.preTasks = taskStore.getPreTasks model.preTasks = taskStore.getPreTasks
model.name = taskStore.getName model.name = taskStore.getName
model.taskExecuteType = model.taskExecuteType =
TASK_TYPES_MAP[data.taskType || 'SHELL'].taskExecuteType || 'BATCH' TASK_TYPES_MAP[data.taskType || 'SHELL'].taskExecuteType || 'BATCH'
const getElements = () => { const getElements = () => {
const {rules, elements} = getElementByJson(jsonRef.value, model) const { rules, elements } = getElementByJson(jsonRef.value, model)
elementsRef.value = elements elementsRef.value = elements
rulesRef.value = rules rulesRef.value = rules
} }
getElements() getElements()
return {elementsRef, rulesRef, model} return { elementsRef, rulesRef, model }
} }

12
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 VersionModal from './components/version-modal'
import TaskModal from '@/views/projects/task/components/node/detail-modal' import TaskModal from '@/views/projects/task/components/node/detail-modal'
import type { INodeData } from './types' 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({ const BatchTaskDefinition = defineComponent({
name: 'batch-task-definition', name: 'batch-task-definition',
@ -215,11 +215,11 @@ const BatchTaskDefinition = defineComponent({
saving={this.taskSaving} saving={this.taskSaving}
/> />
<DependenciesModal <DependenciesModal
v-model:show={this.dependenciesData.showRef} v-model:show={this.dependenciesData.showRef}
v-model:taskLinks={this.dependenciesData.taskLinks} v-model:taskLinks={this.dependenciesData.taskLinks}
required={this.dependenciesData.required} required={this.dependenciesData.required}
content={this.dependenciesData.tip} content={this.dependenciesData.tip}
onConfirm={this.dependenciesData.action} onConfirm={this.dependenciesData.action}
/> />
</NSpace> </NSpace>
) )

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

@ -56,7 +56,7 @@ export function useTable(onEdit: Function) {
const route = useRoute() const route = useRoute()
const projectCode = Number(route.params.projectCode) const projectCode = Number(route.params.projectCode)
const {getDependentTaskLinksByTask} = useDependencies() const { getDependentTaskLinksByTask } = useDependencies()
const createColumns = (variables: any) => { const createColumns = (variables: any) => {
variables.columns = [ variables.columns = [
@ -268,12 +268,22 @@ export function useTable(onEdit: Function) {
dependentTaskLinksRef: ref([]), dependentTaskLinksRef: ref([]),
row: {}, row: {},
loadingRef: ref(false), 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) => { const handleDelete = (row: any) => {
variables.row = row 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) { if (res && res.length > 0) {
variables.dependenciesData = { variables.dependenciesData = {
showRef: true, showRef: true,
@ -283,18 +293,20 @@ export function useTable(onEdit: Function) {
action: () => {} action: () => {}
} }
} else { } else {
deleteTaskDefinition({ code: row.taskCode }, { projectCode }).then(() => { deleteTaskDefinition({ code: row.taskCode }, { projectCode }).then(
getTableData({ () => {
pageSize: variables.pageSize, getTableData({
pageNo: pageSize: variables.pageSize,
pageNo:
variables.tableData.length === 1 && variables.page > 1 variables.tableData.length === 1 && variables.page > 1
? variables.page - 1 ? variables.page - 1
: variables.page, : variables.page,
searchTaskName: variables.searchTaskName, searchTaskName: variables.searchTaskName,
searchWorkflowName: variables.searchWorkflowName, searchWorkflowName: variables.searchWorkflowName,
taskType: variables.taskType taskType: variables.taskType
}) })
}) }
)
} }
}) })
} }

20
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 styles from './menu.module.scss'
import { uuid } from '@/common/common' import { uuid } from '@/common/common'
import { IWorkflowTaskInstance } from './types' import { IWorkflowTaskInstance } from './types'
import {NButton} from 'naive-ui' import { NButton } from 'naive-ui'
import {useDependencies} from "@/views/projects/components/dependencies/use-dependencies" import { useDependencies } from '@/views/projects/components/dependencies/use-dependencies'
const props = { const props = {
startDisplay: { startDisplay: {
@ -146,13 +146,19 @@ export default defineComponent({
} }
const handleDelete = async () => { const handleDelete = async () => {
let taskCode = props.cell?.id const taskCode = props.cell?.id
let res = await getDependentTaskLinksByTask(projectCode, workflowCode, taskCode) const res = await getDependentTaskLinksByTask(
projectCode,
workflowCode,
taskCode
)
dependenciesData.showRef = false dependenciesData.showRef = false
if (res.length > 0) { if (res.length > 0) {
dependenciesData.showRef = true dependenciesData.showRef = true
dependenciesData.taskLinks = res 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 dependenciesData.required = true
} else { } else {
graph.value?.removeCell(props.cell) graph.value?.removeCell(props.cell)
@ -210,8 +216,8 @@ export default defineComponent({
{t('project.node.copy')} {t('project.node.copy')}
</NButton> </NButton>
<NButton <NButton
class={`${styles['menu-item']}`} class={`${styles['menu-item']}`}
onClick={this.handleDelete} onClick={this.handleDelete}
> >
{t('project.node.delete')} {t('project.node.delete')}
</NButton> </NButton>

12
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 StartupParam from './dag-startup-param'
import VariablesView from '@/views/projects/workflow/instance/components/variables-view' import VariablesView from '@/views/projects/workflow/instance/components/variables-view'
import { WorkflowDefinition, WorkflowInstance } from './types' 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 = { const props = {
layoutToggle: { layoutToggle: {
@ -181,11 +181,17 @@ export default defineComponent({
const codes = cells const codes = cells
.filter((cell) => cell.isNode()) .filter((cell) => cell.isNode())
.map((cell) => +cell.id) .map((cell) => +cell.id)
const res = await getDependentTaskLinksByMultipleTasks(projectCode, workflowCode, codes) const res = await getDependentTaskLinksByMultipleTasks(
projectCode,
workflowCode,
codes
)
if (res.length > 0) { if (res.length > 0) {
dependenciesData.showRef = true dependenciesData.showRef = true
dependenciesData.taskLinks = res 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 dependenciesData.required = true
} else { } else {
context.emit('removeTasks', codes, cells) context.emit('removeTasks', codes, cells)

18
dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx

@ -24,7 +24,8 @@ import {
toRef, toRef,
watch, watch,
onBeforeUnmount, onBeforeUnmount,
computed, reactive computed,
reactive
} from 'vue' } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
@ -57,7 +58,7 @@ import utils from '@/utils'
import { useUISettingStore } from '@/store/ui-setting/ui-setting' import { useUISettingStore } from '@/store/ui-setting/ui-setting'
import { executeTask } from '@/service/modules/executors' import { executeTask } from '@/service/modules/executors'
import { removeTaskInstanceCache } from '@/service/modules/task-instances' 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 = { const props = {
// If this prop is passed, it means from definition detail // If this prop is passed, it means from definition detail
@ -338,7 +339,8 @@ export default defineComponent({
showRef: ref(false), showRef: ref(false),
taskLinks: ref([]), taskLinks: ref([]),
required: ref(false), required: ref(false),
tip: ref(''), action: () => {} tip: ref(''),
action: () => {}
}) })
watch( watch(
@ -440,11 +442,11 @@ export default defineComponent({
v-model:dependenciesData={dependenciesData} v-model:dependenciesData={dependenciesData}
/> />
<DependenciesModal <DependenciesModal
v-model:show={dependenciesData.showRef} v-model:show={dependenciesData.showRef}
v-model:taskLinks={dependenciesData.taskLinks} v-model:taskLinks={dependenciesData.taskLinks}
required={dependenciesData.required} required={dependenciesData.required}
content={dependenciesData.tip} content={dependenciesData.tip}
onConfirm={dependenciesData.action} onConfirm={dependenciesData.action}
/> />
{!!props.definition && ( {!!props.definition && (
<StartModal <StartModal

5
dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-node-status.ts

@ -81,7 +81,10 @@ export function useNodeStatus(options: Options) {
taskList.value.forEach((taskInstance: any) => { taskList.value.forEach((taskInstance: any) => {
setNodeStatus(taskInstance.taskCode, taskInstance.state, taskInstance) setNodeStatus(taskInstance.taskCode, taskInstance.state, taskInstance)
if (taskInstance.dependentResult) { if (taskInstance.dependentResult) {
Object.assign(allDependentResult, JSON.parse(taskInstance.dependentResult)) Object.assign(
allDependentResult,
JSON.parse(taskInstance.dependentResult)
)
} }
}) })
nodeStore.updateDependentResult(allDependentResult) nodeStore.updateDependentResult(allDependentResult)

2
dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx

@ -191,7 +191,7 @@ export default defineComponent({
options: Array<any>, options: Array<any>,
findingValue: string findingValue: string
): boolean => { ): boolean => {
for (let { value } of options) { for (const { value } of options) {
if (findingValue === value) { if (findingValue === value) {
return true return true
} }

9
dolphinscheduler-ui/src/views/projects/workflow/definition/components/table-action.tsx

@ -169,7 +169,10 @@ export default defineComponent({
trigger: () => ( trigger: () => (
<NPopconfirm onPositiveClick={this.handleReleaseWorkflow}> <NPopconfirm onPositiveClick={this.handleReleaseWorkflow}>
{{ {{
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: () => ( trigger: () => (
<NButton <NButton
size='small' size='small'
@ -220,7 +223,9 @@ export default defineComponent({
<NPopconfirm onPositiveClick={this.handleReleaseScheduler}> <NPopconfirm onPositiveClick={this.handleReleaseScheduler}>
{{ {{
default: () => 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: () => ( trigger: () => (
<NButton <NButton
size='small' size='small'

2
dolphinscheduler-ui/src/views/projects/workflow/definition/components/timing-modal.tsx

@ -210,7 +210,7 @@ export default defineComponent({
options: Array<any>, options: Array<any>,
findingValue: string findingValue: string
): boolean => { ): boolean => {
for (let { value } of options) { for (const { value } of options) {
if (findingValue === value) { if (findingValue === value) {
return true return true
} }

5
dolphinscheduler-ui/src/views/projects/workflow/definition/components/use-modal.ts

@ -229,7 +229,10 @@ export function useModal(
const getWorkerGroups = () => { const getWorkerGroups = () => {
queryWorkerGroupsByProjectCode(variables.projectCode).then((res: any) => { 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
}))
}) })
} }

2
dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx

@ -24,7 +24,7 @@ import {
NSpace, NSpace,
NTooltip, NTooltip,
NPopconfirm, NPopconfirm,
NModal, NModal
} from 'naive-ui' } from 'naive-ui'
import { import {
defineComponent, defineComponent,

12
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 Card from '@/components/card'
import TimingModal from '../components/timing-modal' import TimingModal from '../components/timing-modal'
import type { Router } from 'vue-router' 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({ export default defineComponent({
name: 'WorkflowDefinitionTiming', name: 'WorkflowDefinitionTiming',
@ -117,11 +117,11 @@ export default defineComponent({
onUpdateList={this.handleUpdateList} onUpdateList={this.handleUpdateList}
/> />
<DependenciesModal <DependenciesModal
v-model:show={this.dependenciesData.showRef} v-model:show={this.dependenciesData.showRef}
v-model:taskLinks={this.dependenciesData.taskLinks} v-model:taskLinks={this.dependenciesData.taskLinks}
required={this.dependenciesData.required} required={this.dependenciesData.required}
content={this.dependenciesData.tip} content={this.dependenciesData.tip}
onConfirm={this.dependenciesData.action} onConfirm={this.dependenciesData.action}
/> />
</NSpace> </NSpace>
) )

114
dolphinscheduler-ui/src/views/projects/workflow/definition/timing/use-table.ts

@ -39,13 +39,13 @@ import {
import { format } from 'date-fns-tz' import { format } from 'date-fns-tz'
import { ISearchParam } from './types' import { ISearchParam } from './types'
import type { Router } from 'vue-router' 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() { export function useTable() {
const { t } = useI18n() const { t } = useI18n()
const router: Router = useRouter() const router: Router = useRouter()
const {getDependentTaskLinks} = useDependencies() const { getDependentTaskLinks } = useDependencies()
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
@ -62,7 +62,13 @@ export function useTable() {
processDefinitionCode: router.currentRoute.value.params.definitionCode processDefinitionCode: router.currentRoute.value.params.definitionCode
? ref(Number(router.currentRoute.value.params.definitionCode)) ? ref(Number(router.currentRoute.value.params.definitionCode))
: ref(), : 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) => { const renderTime = (time: string, timeZone: string) => {
@ -111,19 +117,19 @@ export function useTable() {
render: (row: any) => { render: (row: any) => {
if (row.releaseState === 'ONLINE') { if (row.releaseState === 'ONLINE') {
return h( return h(
NTag, NTag,
{ type: 'success', size: 'small' }, { type: 'success', size: 'small' },
{ {
default: () => t('project.workflow.up_line') default: () => t('project.workflow.up_line')
} }
) )
} else { } else {
return h( return h(
NTag, NTag,
{ type: 'warning', size: 'small' }, { type: 'warning', size: 'small' },
{ {
default: () => t('project.workflow.down_line') default: () => t('project.workflow.down_line')
} }
) )
} }
} }
@ -136,36 +142,36 @@ export function useTable() {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
h( h(
NTooltip, NTooltip,
{}, {},
{ {
trigger: () => trigger: () =>
h( h(
NButton, NButton,
{ {
circle: true, circle: true,
type: type:
row.releaseState === 'ONLINE' ? 'error' : 'warning', row.releaseState === 'ONLINE' ? 'error' : 'warning',
size: 'small', size: 'small',
onClick: () => { onClick: () => {
handleReleaseState(row) handleReleaseState(row)
} }
}, },
{ {
icon: () => icon: () =>
h( h(
row.releaseState === 'ONLINE' row.releaseState === 'ONLINE'
? ArrowDownOutlined ? ArrowDownOutlined
: ArrowUpOutlined : ArrowUpOutlined
) )
} }
), ),
default: () => default: () =>
row.releaseState === 'ONLINE' row.releaseState === 'ONLINE'
? t('project.workflow.down_line') ? t('project.workflow.down_line')
: t('project.workflow.up_line') : t('project.workflow.up_line')
} }
), )
] ]
}) })
} }
@ -176,7 +182,6 @@ export function useTable() {
} }
} }
const createColumns = (variables: any) => { const createColumns = (variables: any) => {
variables.columns = [ variables.columns = [
{ {
@ -394,11 +399,16 @@ export function useTable() {
const handleReleaseState = (row: any) => { const handleReleaseState = (row: any) => {
if (row.releaseState === 'ONLINE') { if (row.releaseState === 'ONLINE') {
variables.row = row variables.row = row
getDependentTaskLinks(variables.projectCode, row.processDefinitionCode).then((res: any) =>{ getDependentTaskLinks(
variables.projectCode,
row.processDefinitionCode
).then((res: any) => {
if (res && res.length > 0) { if (res && res.length > 0) {
variables.dependenciesData.showRef = true variables.dependenciesData.showRef = true
variables.dependenciesData.taskLinks = res 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.required = false
variables.dependenciesData.action = confirmToOfflineSchedule variables.dependenciesData.action = confirmToOfflineSchedule
} else { } else {
@ -412,7 +422,8 @@ export function useTable() {
processDefinitionCode: variables.processDefinitionCode processDefinitionCode: variables.processDefinitionCode
}) })
}) })
}}) }
})
} else { } else {
online(variables.projectCode, row.id).then(() => { online(variables.projectCode, row.id).then(() => {
window.$message.success(t('project.workflow.success')) window.$message.success(t('project.workflow.success'))
@ -461,11 +472,16 @@ export function useTable() {
variables.page -= 1 variables.page -= 1
} }
variables.row = row variables.row = row
getDependentTaskLinks(variables.projectCode, row.processDefinitionCode).then((res: any) =>{ getDependentTaskLinks(
variables.projectCode,
row.processDefinitionCode
).then((res: any) => {
if (res && res.length > 0) { if (res && res.length > 0) {
variables.dependenciesData.showRef = true variables.dependenciesData.showRef = true
variables.dependenciesData.taskLinks = res 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.required = false
variables.dependenciesData.action = confirmToDeleteSchedule variables.dependenciesData.action = confirmToDeleteSchedule
} else { } else {

99
dolphinscheduler-ui/src/views/projects/workflow/definition/use-table.ts

@ -43,7 +43,7 @@ import {
import type { IDefinitionParam } from './types' import type { IDefinitionParam } from './types'
import type { Router } from 'vue-router' import type { Router } from 'vue-router'
import type { TableColumns, RowKey } from 'naive-ui/es/data-table/src/interface' 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() { export function useTable() {
const { t } = useI18n() const { t } = useI18n()
@ -71,7 +71,13 @@ export function useTable() {
copyShowRef: ref(false), copyShowRef: ref(false),
loadingRef: ref(false), loadingRef: ref(false),
setTimingDialogShowRef: 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) => { const createColumns = (variables: any) => {
@ -352,8 +358,8 @@ export function useTable() {
const data = { const data = {
name: row.name, name: row.name,
releaseState: (row.releaseState === 'ONLINE' ? 'OFFLINE' : 'ONLINE') as releaseState: (row.releaseState === 'ONLINE' ? 'OFFLINE' : 'ONLINE') as
| 'OFFLINE' | 'OFFLINE'
| 'ONLINE' | 'ONLINE'
} }
if (data.releaseState === 'OFFLINE') { if (data.releaseState === 'OFFLINE') {
release(data, variables.projectCode, row.code).then(() => { release(data, variables.projectCode, row.code).then(() => {
@ -385,8 +391,8 @@ export function useTable() {
const data = { const data = {
name: row.name, name: row.name,
releaseState: (row.releaseState === 'ONLINE' ? 'OFFLINE' : 'ONLINE') as releaseState: (row.releaseState === 'ONLINE' ? 'OFFLINE' : 'ONLINE') as
| 'OFFLINE' | 'OFFLINE'
| 'ONLINE' | 'ONLINE'
} }
variables.row = row variables.row = row
if (data.releaseState === 'ONLINE') { if (data.releaseState === 'ONLINE') {
@ -404,26 +410,28 @@ export function useTable() {
}) })
}) })
} else { } else {
getDependentTaskLinks(variables.projectCode, row.code).then((res: any) => { getDependentTaskLinks(variables.projectCode, row.code).then(
if (res && res.length > 0) { (res: any) => {
variables.dependenciesData = { if (res && res.length > 0) {
showRef: true, variables.dependenciesData = {
taskLinks: res, showRef: true,
tip: t('project.workflow.warning_dependent_tasks_desc'), taskLinks: res,
required: false, tip: t('project.workflow.warning_dependent_tasks_desc'),
action: confirmToOfflineWorkflow required: false,
} action: confirmToOfflineWorkflow
} else { }
release(data, variables.projectCode, row.code).then(() => { } else {
window.$message.success(t('project.workflow.success')) release(data, variables.projectCode, row.code).then(() => {
getTableData({ window.$message.success(t('project.workflow.success'))
pageSize: variables.pageSize, getTableData({
pageNo: variables.page, pageSize: variables.pageSize,
searchVal: variables.searchVal pageNo: variables.page,
searchVal: variables.searchVal
})
}) })
}) }
} }
}) )
} }
} }
@ -454,25 +462,30 @@ export function useTable() {
variables.row = row variables.row = row
if (row.schedule) { if (row.schedule) {
if (row.schedule.releaseState === 'ONLINE') { if (row.schedule.releaseState === 'ONLINE') {
getDependentTaskLinks(variables.projectCode, row.code).then((res: any) => { getDependentTaskLinks(variables.projectCode, row.code).then(
if (res && res.length > 0) { (res: any) => {
variables.dependenciesData = { if (res && res.length > 0) {
showRef: true, variables.dependenciesData = {
taskLinks: res, showRef: true,
tip: t('project.workflow.warning_offline_scheduler_dependent_tasks_desc'), taskLinks: res,
required: false, tip: t(
action: confirmToOfflineScheduler 'project.workflow.warning_offline_scheduler_dependent_tasks_desc'
} ),
} else { required: false,
offline(variables.projectCode, row.schedule.id).then(() => { action: confirmToOfflineScheduler
window.$message.success(t('project.workflow.success')) }
getTableData({ } else {
pageSize: variables.pageSize, offline(variables.projectCode, row.schedule.id).then(() => {
pageNo: variables.page, window.$message.success(t('project.workflow.success'))
searchVal: variables.searchVal getTableData({
pageSize: variables.pageSize,
pageNo: variables.page,
searchVal: variables.searchVal
})
}) })
}) }
}}) }
)
} else { } else {
online(variables.projectCode, row.schedule.id).then(() => { online(variables.projectCode, row.schedule.id).then(() => {
window.$message.success(t('project.workflow.success')) window.$message.success(t('project.workflow.success'))
@ -566,6 +579,6 @@ export function useTable() {
getTableData, getTableData,
batchDeleteWorkflow, batchDeleteWorkflow,
batchExportWorkflow, batchExportWorkflow,
batchCopyWorkflow, batchCopyWorkflow
} }
} }

16
dolphinscheduler-ui/src/views/projects/workflow/timing/index.tsx

@ -15,15 +15,15 @@
* limitations under the License. * limitations under the License.
*/ */
import {NDataTable, NPagination, NSpace} from 'naive-ui' import { NDataTable, NPagination, NSpace } from 'naive-ui'
import {defineComponent, onMounted, toRefs, watch} from 'vue' import { defineComponent, onMounted, toRefs, watch } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useTable } from '../definition/timing/use-table' import { useTable } from '../definition/timing/use-table'
import Card from '@/components/card' import Card from '@/components/card'
import TimingModal from '../definition/components/timing-modal' import TimingModal from '../definition/components/timing-modal'
import TimingCondition from '@/views/projects/workflow/timing/components/timing-condition' import TimingCondition from '@/views/projects/workflow/timing/components/timing-condition'
import { ITimingSearch } from '@/views/projects/workflow/timing/types' 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({ export default defineComponent({
name: 'WorkflowTimingList', name: 'WorkflowTimingList',
@ -112,11 +112,11 @@ export default defineComponent({
onUpdateList={this.handleUpdateList} onUpdateList={this.handleUpdateList}
/> />
<DependenciesModal <DependenciesModal
v-model:show={this.dependenciesData.showRef} v-model:show={this.dependenciesData.showRef}
v-model:taskLinks={this.dependenciesData.taskLinks} v-model:taskLinks={this.dependenciesData.taskLinks}
required={this.dependenciesData.required} required={this.dependenciesData.required}
content={this.dependenciesData.tip} content={this.dependenciesData.tip}
onConfirm={this.dependenciesData.action} onConfirm={this.dependenciesData.action}
/> />
</NSpace> </NSpace>
) )

2
dolphinscheduler-ui/src/views/resource/components/resource/edit/index.tsx

@ -32,7 +32,7 @@ export default defineComponent({
const router = useRouter() const router = useRouter()
const isDetailPageStore = useIsDetailPageStore() const isDetailPageStore = useIsDetailPageStore()
isDetailPageStore.$reset() isDetailPageStore.$reset()
const componentName = route.name const componentName = route.name
// fullname is now the id of resources // fullname is now the id of resources
const fullName = String(router.currentRoute.value.query.prefix || '') const fullName = String(router.currentRoute.value.query.prefix || '')

16
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", { export const useIsDetailPageStore = defineStore('isDetailPage', {
state:() => { state: () => {
return { return {
isDetailPage:false isDetailPage: false
} }
}, },
getters: { getters: {
@ -82,9 +82,9 @@ export const useIsDetailPageStore = defineStore("isDetailPage", {
}) })
export const isEmpty = (string: any): boolean => { export const isEmpty = (string: any): boolean => {
if(string === '' || string === undefined || string === null){ if (string === '' || string === undefined || string === null) {
return true return true
}else{ } else {
return false return false
} }
} }

28
dolphinscheduler-ui/src/views/resource/components/resource/index.tsx

@ -106,25 +106,25 @@ export default defineComponent({
const handleRenameFile = () => { const handleRenameFile = () => {
variables.renameShowRef = true variables.renameShowRef = true
} }
const detailPageStore = useDetailPageStore() const detailPageStore = useDetailPageStore()
const isDetailPageStore = useIsDetailPageStore() const isDetailPageStore = useIsDetailPageStore()
const handleDetailBackList = () => { const handleDetailBackList = () => {
if(isDetailPageStore.getIsDetailPage){ if (isDetailPageStore.getIsDetailPage) {
variables.resourceType = detailPageStore.getResourceType variables.resourceType = detailPageStore.getResourceType
variables.fullName = detailPageStore.getFullName variables.fullName = detailPageStore.getFullName
variables.tenantCode = detailPageStore.getTenantCode variables.tenantCode = detailPageStore.getTenantCode
variables.searchRef = detailPageStore.getSearchValue variables.searchRef = detailPageStore.getSearchValue
variables.pagination.page = detailPageStore.getPage variables.pagination.page = detailPageStore.getPage
variables.pagination.pageSize = detailPageStore.getPageSize variables.pagination.pageSize = detailPageStore.getPageSize
if(!isEmpty(variables.searchRef)){ if (!isEmpty(variables.searchRef)) {
handleConditions() handleConditions()
} }
detailPageStore.$reset() detailPageStore.$reset()
isDetailPageStore.$reset() isDetailPageStore.$reset()
} else { } else {
detailPageStore.$reset() detailPageStore.$reset()
isDetailPageStore.$reset() isDetailPageStore.$reset()
} }
} }

80
dolphinscheduler-ui/src/views/resource/components/resource/table/use-table.ts

@ -213,7 +213,7 @@ export function useTable() {
const { getResourceListState } = useFileState(setPagination) const { getResourceListState } = useFileState(setPagination)
const detailPageStore = useDetailPageStore() const detailPageStore = useDetailPageStore()
const requestData = () => { const requestData = () => {
variables.resourceList = getResourceListState( variables.resourceList = getResourceListState(
variables.resourceType!, variables.resourceType!,
@ -245,56 +245,56 @@ export function useTable() {
handleCreateFile: createFile handleCreateFile: createFile
} }
} }
export const useDetailPageStore = defineStore("detailPage", { export const useDetailPageStore = defineStore('detailPage', {
state:() => { state: () => {
var resourceTypeInitValue:ResourceType let resourceTypeInitValue: ResourceType
return { return {
resourceType:resourceTypeInitValue!, resourceType: resourceTypeInitValue!,
fullName:'', fullName: '',
tenantCode:'', tenantCode: '',
searchValue:'', searchValue: '',
page:1, page: 1,
pageSize:10 pageSize: 10
} }
}, },
getters: { getters: {
getResourceType(): ResourceType { getResourceType(): ResourceType {
return this.resourceType return this.resourceType
}, },
getFullName(): string { getFullName(): string {
return this.fullName return this.fullName
}, },
getTenantCode(): string { getTenantCode(): string {
return this.tenantCode return this.tenantCode
}, },
getSearchValue(): string { getSearchValue(): string {
return this.searchValue return this.searchValue
}, },
getPage(): number { getPage(): number {
return this.page return this.page
}, },
getPageSize(): number { getPageSize(): number {
return this.pageSize return this.pageSize
} }
}, },
actions: { actions: {
setResourceType(resourceTypeValue: ResourceType) { setResourceType(resourceTypeValue: ResourceType) {
this.resourceType = resourceTypeValue this.resourceType = resourceTypeValue
}, },
setFullName(fullName: string) { setFullName(fullName: string) {
this.fullName = fullName this.fullName = fullName
}, },
setTenantCode(fullName: string) { setTenantCode(fullName: string) {
this.fullName = fullName this.fullName = fullName
}, },
setSearchValue(searchValue: string) { setSearchValue(searchValue: string) {
this.searchValue = searchValue this.searchValue = searchValue
}, },
setPage(page: number) { setPage(page: number) {
this.page = page this.page = page
}, },
setPageSize(pageSize: number) { setPageSize(pageSize: number) {
this.pageSize = pageSize this.pageSize = pageSize
} }
} }
}) })

57
dolphinscheduler-ui/src/views/resource/task-group/option/use-table.ts

@ -125,37 +125,38 @@ export function useTable(
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return if (variables.loadingRef) return
variables.loadingRef = true variables.loadingRef = true
Promise.all([queryTaskGroupListPaging(params), queryProjectCreatedAndAuthorizedByUser()]).then( Promise.all([
(values: any[]) => { queryTaskGroupListPaging(params),
variables.totalPage = values[0].totalPage queryProjectCreatedAndAuthorizedByUser()
variables.tableData = values[0].totalList.map( ]).then((values: any[]) => {
(item: any, unused: number) => { variables.totalPage = values[0].totalPage
let projectName = '' variables.tableData = values[0].totalList.map(
if (values[1]) { (item: any, unused: number) => {
const project = _.find(values[1], { code: item.projectCode }) let projectName = ''
if (project) { if (values[1]) {
projectName = project.name const project = _.find(values[1], { code: item.projectCode })
} if (project) {
projectName = project.name
} }
}
item.projectName = projectName item.projectName = projectName
item.createTime = format( item.createTime = format(
parseTime(item.createTime), parseTime(item.createTime),
'yyyy-MM-dd HH:mm:ss' 'yyyy-MM-dd HH:mm:ss'
) )
item.updateTime = format( item.updateTime = format(
parseTime(item.updateTime), parseTime(item.updateTime),
'yyyy-MM-dd HH:mm:ss' 'yyyy-MM-dd HH:mm:ss'
) )
item.status = (item.status == 'YES') ? 1 : 0 item.status = item.status == 'YES' ? 1 : 0
return { return {
...item ...item
}
} }
) }
variables.loadingRef = false )
} variables.loadingRef = false
) })
} }
return { getTableData, variables, columns } return { getTableData, variables, columns }

1
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' import type { IRecord, TAuthType } from './types'
export function useTable() { export function useTable() {
const state = reactive({ const state = reactive({
page: 1, page: 1,
pageSize: 10, pageSize: 10,

134
dolphinscheduler-ui/src/views/security/yarn-queue-manage/use-table.ts

@ -17,12 +17,10 @@
import { useAsyncState } from '@vueuse/core' import { useAsyncState } from '@vueuse/core'
import { reactive, h, ref } from 'vue' 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 { useI18n } from 'vue-i18n'
import { queryQueueListPaging, import { queryQueueListPaging, deleteQueueById } from '@/service/modules/queues'
deleteQueueById import { DeleteOutlined, EditOutlined } from '@vicons/antd'
} from '@/service/modules/queues'
import {DeleteOutlined, EditOutlined} from '@vicons/antd'
import type { QueueRes } from '@/service/modules/queues/types' import type { QueueRes } from '@/service/modules/queues/types'
export function useTable() { export function useTable() {
@ -39,9 +37,9 @@ export function useTable() {
getTableData({ getTableData({
pageSize: variables.pageSize, pageSize: variables.pageSize,
pageNo: pageNo:
variables.tableData.length === 1 && variables.page > 1 variables.tableData.length === 1 && variables.page > 1
? variables.page - 1 ? variables.page - 1
: variables.page, : variables.page,
searchVal: variables.searchVal searchVal: variables.searchVal
}) })
}) })
@ -75,69 +73,69 @@ export function useTable() {
title: t('security.yarn_queue.operation'), title: t('security.yarn_queue.operation'),
key: 'operation', key: 'operation',
render(row: any) { render(row: any) {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
h( h(
NTooltip, NTooltip,
{}, {},
{ {
trigger: () => trigger: () =>
h( h(
NButton, NButton,
{ {
circle: true, circle: true,
type: 'info', type: 'info',
size: 'small', size: 'small',
class: 'edit', class: 'edit',
onClick: () => { onClick: () => {
handleEdit(row) handleEdit(row)
} }
}, },
{ {
icon: () => icon: () =>
h(NIcon, null, { default: () => h(EditOutlined) }) h(NIcon, null, { default: () => h(EditOutlined) })
}
),
default: () => t('security.yarn_queue.edit')
}
),
h(
NPopconfirm,
{
onPositiveClick: () => {
handleDelete(row)
} }
}, ),
{ default: () => t('security.yarn_queue.edit')
trigger: () => }
),
h(
NPopconfirm,
{
onPositiveClick: () => {
handleDelete(row)
}
},
{
trigger: () =>
h(
NTooltip,
{},
{
trigger: () =>
h( h(
NTooltip, NButton,
{}, {
{ circle: true,
trigger: () => type: 'error',
h( size: 'small',
NButton, class: 'delete'
{ },
circle: true, {
type: 'error', icon: () =>
size: 'small', h(NIcon, null, {
class: 'delete' default: () => h(DeleteOutlined)
}, })
{ }
icon: () =>
h(NIcon, null, {
default: () => h(DeleteOutlined)
})
}
),
default: () => t('security.yarn_queue.delete')
}
), ),
default: () => t('security.yarn_queue.delete_confirm') default: () => t('security.yarn_queue.delete')
} }
) ),
] default: () => t('security.yarn_queue.delete_confirm')
}) }
)
]
})
} }
} }
] ]

Loading…
Cancel
Save