From 4c2e57cfb3947ca6071d78e375beb91bbc820632 Mon Sep 17 00:00:00 2001 From: calvin Date: Wed, 24 May 2023 08:50:53 +0800 Subject: [PATCH] [Feature][UI] Support to view and manage all timing settings of a project. (#14178) --- .../api/controller/SchedulerController.java | 2 +- .../service/impl/SchedulerServiceImpl.java | 16 +- .../dao/mapper/ScheduleMapper.java | 14 + .../dao/mapper/ScheduleMapper.xml | 19 + .../dao/mapper/ScheduleMapperTest.java | 38 ++ .../src/common/column-width-config.ts | 2 +- dolphinscheduler-ui/src/common/common.ts | 7 +- .../src/components/input-search/index.tsx | 19 +- .../content/components/navbar/index.tsx | 8 +- .../components/sidebar/use-menuClick.ts | 4 +- .../src/layouts/content/use-dataList.ts | 21 +- .../src/locales/en_US/datasource.ts | 12 +- .../src/locales/en_US/input-search.ts | 4 +- dolphinscheduler-ui/src/locales/en_US/menu.ts | 3 +- .../src/locales/en_US/project.ts | 3 +- .../src/locales/en_US/resource.ts | 2 +- .../src/locales/en_US/security.ts | 2 +- .../src/locales/zh_CN/datasource.ts | 12 +- .../src/locales/zh_CN/input-search.ts | 4 +- dolphinscheduler-ui/src/locales/zh_CN/menu.ts | 1 + .../src/locales/zh_CN/project.ts | 1 + .../src/locales/zh_CN/security.ts | 2 +- .../src/router/modules/projects.ts | 11 + .../src/service/modules/data-source/types.ts | 34 +- .../src/service/modules/dynamic-dag/index.ts | 2 +- .../src/service/modules/login/index.ts | 2 +- .../modules/process-definition/index.ts | 6 +- .../modules/process-instances/index.ts | 1 - .../src/service/modules/projects/index.ts | 12 +- .../src/service/modules/resources/index.ts | 49 +- .../src/service/modules/resources/types.ts | 2 +- .../src/service/modules/schedules/types.ts | 2 +- .../service/modules/task-instances/index.ts | 5 +- .../src/store/project/dynamic/dag.ts | 2 +- .../src/store/project/dynamic/types.ts | 2 +- .../src/utils/environmental-distinction.ts | 47 +- dolphinscheduler-ui/src/utils/tree-format.ts | 7 +- .../src/views/data-quality/rule/index.tsx | 8 +- .../views/data-quality/task-result/index.tsx | 6 +- .../src/views/datasource/list/detail.tsx | 126 +++-- .../src/views/datasource/list/use-columns.ts | 5 +- .../src/views/datasource/list/use-form.ts | 48 +- .../src/views/datasource/list/use-table.ts | 2 +- dolphinscheduler-ui/src/views/login/index.tsx | 36 +- .../src/views/login/use-login.ts | 2 +- .../src/views/profile/use-form.ts | 4 +- .../src/views/projects/list/index.tsx | 18 +- .../src/views/projects/list/use-table.ts | 2 +- .../task/components/node/fields/use-cache.ts | 14 +- .../node/fields/use-custom-labels.ts | 108 ++-- .../components/node/fields/use-datasource.ts | 2 +- .../components/node/fields/use-datasync.ts | 117 +++-- .../task/components/node/fields/use-datax.ts | 466 +++++++++--------- .../node/fields/use-dependent-timeout.ts | 4 +- .../task/components/node/fields/use-dms.ts | 7 +- .../node/fields/use-environment-name.ts | 6 +- .../task/components/node/fields/use-flink.ts | 3 +- .../components/node/fields/use-hive-cli.ts | 14 +- .../task/components/node/fields/use-linkis.ts | 4 +- .../components/node/fields/use-namespace.ts | 2 +- .../components/node/fields/use-resources.ts | 2 +- .../components/node/fields/use-sea-tunnel.ts | 32 +- .../components/node/fields/use-zeppelin.ts | 2 +- .../task/components/node/format-data.ts | 14 +- .../components/node/tasks/use-datasync.ts | 110 ++--- .../task/components/node/tasks/use-dms.ts | 2 +- .../task/components/node/tasks/use-linkis.ts | 2 +- .../components/node/tasks/use-sea-tunnel.ts | 46 +- .../projects/task/components/node/types.ts | 6 +- .../projects/task/definition/use-table.ts | 14 +- .../projects/task/instance/batch-task.tsx | 2 +- .../views/projects/task/instance/index.tsx | 3 +- .../views/projects/task/instance/use-table.ts | 28 +- .../workflow/components/dag/dag-config.ts | 2 +- .../components/dag/dag-context-menu.tsx | 79 +-- .../workflow/components/dag/dag-sidebar.tsx | 51 +- .../workflow/components/dag/dag-toolbar.tsx | 58 +-- .../workflow/components/dag/index.tsx | 37 +- .../components/dag/use-canvas-init.ts | 16 +- .../components/dynamic-dag/dag-canvas.tsx | 23 +- .../components/dynamic-dag/dag-sidebar.tsx | 22 +- .../workflow/components/dynamic-dag/index.tsx | 18 +- .../components/dynamic-dag/task/index.tsx | 81 +-- .../components/dynamic-dag/task/types.ts | 2 +- .../dynamic-dag/task/use-dynamic-locales.ts | 2 +- .../dynamic-dag/task/use-form-field.ts | 9 +- .../dynamic-dag/task/use-form-request.ts | 4 +- .../dynamic-dag/task/use-form-structure.ts | 2 +- .../dynamic-dag/task/use-form-validate.ts | 2 +- .../dynamic-dag/task/use-task-form.ts | 4 +- .../dynamic-dag/use-add-dag-shape.ts | 2 +- .../components/dynamic-dag/use-dag-edge.ts | 2 +- .../components/dynamic-dag/use-dag-graph.ts | 2 +- .../components/dynamic-dag/use-dag-node.ts | 2 +- .../components/dynamic-dag/use-dag-resize.ts | 2 +- .../components/dynamic-dag/use-sidebar.ts | 5 +- .../definition/components/use-modal.ts | 2 +- .../workflow/definition/create/index.tsx | 8 +- .../projects/workflow/definition/index.tsx | 10 +- .../workflow/definition/timing/index.tsx | 4 +- .../workflow/definition/timing/types.ts | 2 + .../workflow/definition/timing/use-table.ts | 59 ++- .../projects/workflow/definition/use-table.ts | 2 +- .../instance/components/variables-view.tsx | 19 +- .../projects/workflow/instance/use-table.ts | 2 +- .../projects/workflow/relation/index.tsx | 17 +- .../timing/components/timing-condition.tsx | 87 ++++ .../views/projects/workflow/timing/index.tsx | 116 +++++ .../views/projects/workflow/timing/types.ts | 22 + .../components/resource/create/use-form.ts | 2 +- .../components/resource/edit/index.tsx | 6 +- .../components/resource/edit/use-edit.ts | 17 +- .../components/resource/folder/index.tsx | 2 +- .../components/resource/folder/use-form.ts | 2 +- .../resource/components/resource/index.tsx | 66 ++- .../components/resource/rename/index.tsx | 10 +- .../components/resource/rename/use-form.ts | 34 +- .../components/resource/rename/use-rename.ts | 10 +- .../resource/table/table-action.tsx | 103 ++-- .../components/resource/table/use-table.ts | 97 ++-- .../resource/components/resource/types.ts | 69 +-- .../components/resource/upload/index.tsx | 11 +- .../components/resource/upload/use-form.ts | 2 +- .../src/views/resource/file/create/index.tsx | 7 +- .../src/views/resource/file/edit/index.tsx | 7 +- .../src/views/resource/file/index.tsx | 9 +- .../resource/task-group/option/index.tsx | 20 +- .../views/resource/task-group/queue/index.tsx | 16 +- .../function/components/function-modal.tsx | 4 +- .../udf/function/components/use-form.ts | 2 +- .../udf/function/components/use-modal.ts | 10 +- .../src/views/resource/udf/function/index.tsx | 10 +- .../views/resource/udf/function/use-table.ts | 4 +- .../src/views/resource/udf/resource/index.tsx | 9 +- .../security/alarm-group-manage/index.tsx | 10 +- .../security/alarm-instance-manage/index.tsx | 10 +- .../views/security/cluster-manage/index.tsx | 10 +- .../security/environment-manage/index.tsx | 10 +- .../security/k8s-namespace-manage/index.tsx | 10 +- .../views/security/tenant-manage/index.tsx | 10 +- .../src/views/security/token-manage/index.tsx | 10 +- .../components/authorize-modal.tsx | 89 ++-- .../user-manage/components/use-authorize.ts | 30 +- .../user-manage/components/use-columns.ts | 7 +- .../src/views/security/user-manage/index.tsx | 16 +- .../security/worker-group-manage/index.tsx | 10 +- .../security/yarn-queue-manage/index.tsx | 10 +- 147 files changed, 1825 insertions(+), 1360 deletions(-) create mode 100644 dolphinscheduler-ui/src/views/projects/workflow/timing/components/timing-condition.tsx create mode 100644 dolphinscheduler-ui/src/views/projects/workflow/timing/index.tsx create mode 100644 dolphinscheduler-ui/src/views/projects/workflow/timing/types.ts diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java index e0b5fdc8c4..5935e2b30b 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java @@ -250,7 +250,7 @@ public class SchedulerController extends BaseController { @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryScheduleListPaging(@Parameter(hidden = true) @RequestAttribute(value = SESSION_USER) User loginUser, @Parameter(name = "projectCode", description = "PROJECT_CODE", required = true) @PathVariable long projectCode, - @RequestParam long processDefinitionCode, + @RequestParam(value = "processDefinitionCode", required = false, defaultValue = "0") long processDefinitionCode, @RequestParam(value = "searchVal", required = false) String searchVal, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java index 419f1151df..589d509ae0 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java @@ -568,16 +568,20 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe return result; } - ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode); - if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - log.error("Process definition does not exist, processDefinitionCode:{}.", processDefineCode); - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefineCode)); - return result; + if (processDefineCode != 0) { + ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode); + if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { + log.error("Process definition does not exist, processDefinitionCode:{}.", processDefineCode); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefineCode)); + return result; + } } Page page = new Page<>(pageNo, pageSize); + IPage schedulePage = - scheduleMapper.queryByProcessDefineCodePaging(page, processDefineCode, searchVal); + scheduleMapper.queryByProjectAndProcessDefineCodePaging(page, projectCode, processDefineCode, + searchVal); List scheduleList = new ArrayList<>(); for (Schedule schedule : schedulePage.getRecords()) { diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java index 953fa35c47..8bf63269c2 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java @@ -63,6 +63,20 @@ public interface ScheduleMapper extends BaseMapper { @Param("processDefinitionCode") long processDefinitionCode, @Param("searchVal") String searchVal); + /** + * scheduler page + * + * @param page page + * @param projectCode projectCode + * @param processDefinitionCode processDefinitionCode + * @param searchVal searchVal + * @return scheduler IPage + */ + IPage queryByProjectAndProcessDefineCodePaging(IPage page, + @Param("projectCode") long projectCode, + @Param("processDefinitionCode") long processDefinitionCode, + @Param("searchVal") String searchVal); + /** * Filter schedule * diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml index 86001a1fce..5c047fb3b3 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml @@ -44,6 +44,25 @@ order by s.update_time desc +