Skip to content

Commit

Permalink
[Fix][UI] Add mapping_columns filed for the data_quality ruleInputPar…
Browse files Browse the repository at this point in the history
…amter. (apache#10286)
  • Loading branch information
Amy0104 authored and wangjiucheng committed Jul 8, 2022
1 parent 9c5c01f commit f17de6c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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,
Expand All @@ -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) {
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -562,6 +563,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ interface IRuleParameters {
target_datasource_id?: number
target_table?: string
threshold?: string
mapping_columns?: string
}

interface ITaskParams {
Expand Down Expand Up @@ -352,7 +353,7 @@ interface INodeData
>,
ISqoopTargetData,
ISqoopSourceData,
IRuleParameters {
Omit<IRuleParameters, 'mapping_columns'> {
id?: string
taskType?: ITaskType
processName?: number
Expand Down Expand Up @@ -387,6 +388,7 @@ interface INodeData
failedBranch?: number
udfs?: string[]
customConfig?: boolean
mapping_columns?: object[]
}

interface ITaskData
Expand Down

0 comments on commit f17de6c

Please sign in to comment.