You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/05/16 12:18:22 UTC

[dolphinscheduler] 04/15: [Fix][UI] Fix the task name validator error. (#10008)

This is an automated email from the ASF dual-hosted git repository.

zhongjiajie pushed a commit to branch 3.0.0-beta-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git

commit ca0f41c10f57b2c42260efe3a1813144768b8e68
Author: Amy0104 <97...@users.noreply.github.com>
AuthorDate: Thu May 12 15:27:55 2022 +0800

    [Fix][UI] Fix the task name validator error. (#10008)
    
    
    (cherry picked from commit 00f102959b5a07f56cb2d6f8973949cc4eee22b0)
---
 .../projects/task/components/node/fields/use-dependent.ts    | 12 +++++++-----
 .../src/views/projects/task/components/node/types.ts         |  4 +++-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts
index 1a149484f9..c650a815f0 100644
--- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts
+++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts
@@ -31,7 +31,8 @@ import type {
   IJsonItem,
   IDependpendItem,
   IDependTask,
-  ITaskState
+  ITaskState,
+  IDateType
 } from '../types'
 
 export function useDependent(model: { [field: string]: any }): IJsonItem[] {
@@ -172,7 +173,7 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
         label: t('project.node.last_month_end')
       }
     ]
-  }
+  } as { [key in IDateType]: { value: string; label: string }[] }
 
   const getProjectList = async () => {
     const result = await queryAllProjectList()
@@ -338,8 +339,8 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
             rule: {
               required: true,
               trigger: ['input', 'blur'],
-              validator(validate: any, value: string) {
-                if (!value) {
+              validator(validate: any, value: number) {
+                if (!value && value !== 0) {
                   return Error(t('project.node.task_name_tips'))
                 }
               }
@@ -351,9 +352,10 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
             span: 10,
             name: t('project.node.cycle_time'),
             props: {
-              onUpdateValue: (value: 'month') => {
+              onUpdateValue: (value: IDateType) => {
                 model.dependTaskList[i].dependItemList[j].dateOptions =
                   DATE_LSIT[value]
+                model.dependTaskList[i].dependItemList[j].dateValue = null
               }
             },
             options: CYCLE_LIST,
diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts
index 368125f20f..6750d84fc9 100644
--- a/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts
+++ b/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts
@@ -37,6 +37,7 @@ type SourceType = 'MYSQL' | 'HDFS' | 'HIVE'
 type ModelType = 'import' | 'export'
 type RelationType = 'AND' | 'OR'
 type ITaskType = TaskType
+type IDateType = 'hour' | 'day' | 'week' | 'month'
 
 interface IOption {
   label: string
@@ -383,5 +384,6 @@ export {
   IJsonItem,
   FormRules,
   IJsonItemParams,
-  IResponseJsonItem
+  IResponseJsonItem,
+  IDateType
 }