Browse Source

[Fix][UI] Add mapping_columns filed for the data_quality ruleInputParamter. (#10286)

(cherry picked from commit e7fbfa3a26)
3.0.0/version-upgrade
Amy0104 2 years ago committed by devosend
parent
commit
3687eb7a9a
  1. 20
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-rules.ts
  2. 7
      dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts
  3. 4
      dolphinscheduler-ui/src/views/projects/task/components/node/types.ts

20
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-rules.ts

@ -42,7 +42,7 @@ export function useRules(
const targetTableColumnOptions = ref([] as { label: string; value: number }[])
const writerDatasourceOptions = ref([] as { label: string; value: number }[])
const fixValueSpan = computed(() => model.comparison_type === 1 ? 24 : 0)
const fixValueSpan = computed(() => (model.comparison_type === 1 ? 24 : 0))
let preItemLen = 0
@ -67,7 +67,9 @@ export function useRules(
if (ruleLoading.value) return
ruleLoading.value = true
const result = await getRuleFormCreateJson(ruleId)
const items = JSON.parse(result).map((item: IResponseJsonItem) => formatResponseJson(item))
const items = JSON.parse(result).map((item: IResponseJsonItem) =>
formatResponseJson(item)
)
updateRules(items, preItemLen)
preItemLen = items.length
ruleLoading.value = false
@ -76,7 +78,6 @@ export function useRules(
const formatResponseJson = (
responseItem: IResponseJsonItem
): IJsonItemParams => {
responseItem.props.placeholder = t('project.node.' + responseItem.props.placeholder.split(' ').join('_').split(',').join('').toLowerCase())
const item: IJsonItemParams = {
field: responseItem.field,
options: responseItem.options,
@ -95,7 +96,7 @@ export function useRules(
child.span = Math.floor(22 / item.props.rules.length)
return child
})
model[item.field] = []
model[item.field] = model[item.field] || []
delete item.props.rules
}
if (responseItem.emit) {
@ -107,6 +108,17 @@ export function useRules(
}
})
}
if (responseItem.props.placeholder) {
item.props.placeholder = t(
'project.node.' +
responseItem.props.placeholder
.split(' ')
.join('_')
.split(',')
.join('')
.toLowerCase()
)
}
if (item.field === 'src_datasource_id') {
item.options = srcDatasourceOptions
}

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

@ -294,7 +294,8 @@ export function formatParams(data: INodeData): {
target_connector_type: data.target_connector_type,
target_datasource_id: data.target_datasource_id,
target_table: data.target_table,
threshold: data.threshold
threshold: data.threshold,
mapping_columns: JSON.stringify(data.mapping_columns)
}
taskParams.sparkParameters = {
deployMode: data.deployMode,
@ -524,6 +525,10 @@ export function formatModel(data: ITaskData) {
data.taskParams.ruleInputParameter.target_datasource_id
params.target_table = data.taskParams.ruleInputParameter.target_table
params.threshold = data.taskParams.ruleInputParameter.threshold
if (data.taskParams.ruleInputParameter.mapping_columns)
params.mapping_columns = JSON.parse(
data.taskParams.ruleInputParameter.mapping_columns
)
}
if (data.taskParams?.sparkParameters) {
params.deployMode = data.taskParams.sparkParameters.deployMode

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

@ -213,6 +213,7 @@ interface IRuleParameters {
target_datasource_id?: number
target_table?: string
threshold?: string
mapping_columns?: string
}
interface ITaskParams {
@ -322,7 +323,7 @@ interface INodeData
>,
ISqoopTargetData,
ISqoopSourceData,
IRuleParameters {
Omit<IRuleParameters, 'mapping_columns'> {
id?: string
taskType?: ITaskType
processName?: number
@ -357,6 +358,7 @@ interface INodeData
failedBranch?: number
udfs?: string[]
customConfig?: boolean
mapping_columns?: object[]
}
interface ITaskData

Loading…
Cancel
Save