Browse Source

Fix item, workflow, and task parameters in dependent task nodes can be searched (#13918)

3.1.6-release
Kerwin 2 years ago committed by zhuangchong
parent
commit
dc40cd76bc
  1. 33
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts
  2. 5
      dolphinscheduler-ui/src/views/projects/task/components/node/types.ts

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

@ -36,6 +36,7 @@ import type {
ITaskState, ITaskState,
IDateType IDateType
} from '../types' } from '../types'
import {IRenderOption} from "../types";
export function useDependent(model: { [field: string]: any }): IJsonItem[] { export function useDependent(model: { [field: string]: any }): IJsonItem[] {
const { t } = useI18n() const { t } = useI18n()
@ -44,12 +45,12 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
const dependentResult = nodeStore.getDependentResult const dependentResult = nodeStore.getDependentResult
const TasksStateConfig = tasksState(t) const TasksStateConfig = tasksState(t)
const projectList = ref([] as { label: string; value: number }[]) const projectList = ref([] as IRenderOption[])
const processCache = {} as { const processCache = {} as {
[key: number]: { label: string; value: number }[] [key: number]: IRenderOption[]
} }
const taskCache = {} as { const taskCache = {} as {
[key: number]: { label: string; value: number }[] [key: number]: IRenderOption[]
} }
const selectOptions = ref([] as IDependTaskOptions[]) const selectOptions = ref([] as IDependTaskOptions[])
@ -182,7 +183,8 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
const result = await queryAllProjectListForDependent() const result = await queryAllProjectListForDependent()
projectList.value = result.map((item: { code: number; name: string }) => ({ projectList.value = result.map((item: { code: number; name: string }) => ({
value: item.code, value: item.code,
label: () => h(NEllipsis, null, item.name) label: () => h(NEllipsis, null, item.name),
filterLabel: item.name
})) }))
return projectList return projectList
} }
@ -193,7 +195,8 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
const result = await queryProcessDefinitionList(code) const result = await queryProcessDefinitionList(code)
const processList = result.map((item: { code: number; name: string }) => ({ const processList = result.map((item: { code: number; name: string }) => ({
value: item.code, value: item.code,
label: () => h(NEllipsis, null, item.name) label: () => h(NEllipsis, null, item.name),
filterLabel: item.name
})) }))
processCache[code] = processList processCache[code] = processList
@ -207,7 +210,8 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
const result = await getTasksByDefinitionList(code, processCode) const result = await getTasksByDefinitionList(code, processCode)
const taskList = result.map((item: { code: number; name: string }) => ({ const taskList = result.map((item: { code: number; name: string }) => ({
value: item.code, value: item.code,
label: () => h(NEllipsis, null, item.name) label: () => h(NEllipsis, null, item.name),
filterLabel: item.name
})) }))
taskList.unshift({ taskList.unshift({
value: 0, value: 0,
@ -283,6 +287,11 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
span: 24, span: 24,
props: { props: {
filterable: true, filterable: true,
filter: (query: string, option: IRenderOption) => {
return option.filterLabel
.toLowerCase()
.includes(query.toLowerCase())
},
onUpdateValue: async (projectCode: number) => { onUpdateValue: async (projectCode: number) => {
const item = model.dependTaskList[i].dependItemList[j] const item = model.dependTaskList[i].dependItemList[j]
const options = selectOptions?.value[i] || {} const options = selectOptions?.value[i] || {}
@ -315,6 +324,11 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
name: t('project.node.process_name'), name: t('project.node.process_name'),
props: { props: {
filterable: true, filterable: true,
filter: (query: string, option: IRenderOption) => {
return option.filterLabel
.toLowerCase()
.includes(query.toLowerCase())
},
onUpdateValue: async (processCode: number) => { onUpdateValue: async (processCode: number) => {
const item = model.dependTaskList[i].dependItemList[j] const item = model.dependTaskList[i].dependItemList[j]
selectOptions.value[i].dependItemList[j].depTaskCodeOptions = await getTaskList( selectOptions.value[i].dependItemList[j].depTaskCodeOptions = await getTaskList(
@ -343,7 +357,12 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
span: 24, span: 24,
name: t('project.node.task_name'), name: t('project.node.task_name'),
props: { props: {
filterable: true filterable: true,
filter: (query: string, option: IRenderOption) => {
return option.filterLabel
.toLowerCase()
.includes(query.toLowerCase())
}
}, },
options: options:
selectOptions.value[i]?.dependItemList[j]?.depTaskCodeOptions || selectOptions.value[i]?.dependItemList[j]?.depTaskCodeOptions ||

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

@ -48,6 +48,10 @@ interface IOption {
value: string | number value: string | number
} }
interface IRenderOption extends IOption {
filterLabel: string
}
interface ITaskPriorityOption extends SelectOption { interface ITaskPriorityOption extends SelectOption {
icon: VNode icon: VNode
color: string color: string
@ -461,6 +465,7 @@ export {
INodeData, INodeData,
ITaskParams, ITaskParams,
IOption, IOption,
IRenderOption,
IDataBase, IDataBase,
ModelType, ModelType,
SourceType, SourceType,

Loading…
Cancel
Save