Browse Source

[Fix][UI] Fix the task name validator error. (#10008)

(cherry picked from commit 00f102959b)
3.0.0/version-upgrade
Amy0104 3 years ago committed by Jiajie Zhong
parent
commit
ca0f41c10f
  1. 12
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts
  2. 4
      dolphinscheduler-ui/src/views/projects/task/components/node/types.ts

12
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts

@ -31,7 +31,8 @@ import type {
IJsonItem, IJsonItem,
IDependpendItem, IDependpendItem,
IDependTask, IDependTask,
ITaskState ITaskState,
IDateType
} from '../types' } from '../types'
export function useDependent(model: { [field: string]: any }): IJsonItem[] { 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') label: t('project.node.last_month_end')
} }
] ]
} } as { [key in IDateType]: { value: string; label: string }[] }
const getProjectList = async () => { const getProjectList = async () => {
const result = await queryAllProjectList() const result = await queryAllProjectList()
@ -338,8 +339,8 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
rule: { rule: {
required: true, required: true,
trigger: ['input', 'blur'], trigger: ['input', 'blur'],
validator(validate: any, value: string) { validator(validate: any, value: number) {
if (!value) { if (!value && value !== 0) {
return Error(t('project.node.task_name_tips')) return Error(t('project.node.task_name_tips'))
} }
} }
@ -351,9 +352,10 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
span: 10, span: 10,
name: t('project.node.cycle_time'), name: t('project.node.cycle_time'),
props: { props: {
onUpdateValue: (value: 'month') => { onUpdateValue: (value: IDateType) => {
model.dependTaskList[i].dependItemList[j].dateOptions = model.dependTaskList[i].dependItemList[j].dateOptions =
DATE_LSIT[value] DATE_LSIT[value]
model.dependTaskList[i].dependItemList[j].dateValue = null
} }
}, },
options: CYCLE_LIST, options: CYCLE_LIST,

4
dolphinscheduler-ui/src/views/projects/task/components/node/types.ts

@ -37,6 +37,7 @@ type SourceType = 'MYSQL' | 'HDFS' | 'HIVE'
type ModelType = 'import' | 'export' type ModelType = 'import' | 'export'
type RelationType = 'AND' | 'OR' type RelationType = 'AND' | 'OR'
type ITaskType = TaskType type ITaskType = TaskType
type IDateType = 'hour' | 'day' | 'week' | 'month'
interface IOption { interface IOption {
label: string label: string
@ -383,5 +384,6 @@ export {
IJsonItem, IJsonItem,
FormRules, FormRules,
IJsonItemParams, IJsonItemParams,
IResponseJsonItem IResponseJsonItem,
IDateType
} }

Loading…
Cancel
Save