Browse Source

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

3.1.0-release
Amy0104 3 years ago committed by GitHub
parent
commit
e7fbfa3a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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 targetTableColumnOptions = ref([] as { label: string; value: number }[])
const writerDatasourceOptions = 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 let preItemLen = 0
@ -67,7 +67,9 @@ export function useRules(
if (ruleLoading.value) return if (ruleLoading.value) return
ruleLoading.value = true ruleLoading.value = true
const result = await getRuleFormCreateJson(ruleId) 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) updateRules(items, preItemLen)
preItemLen = items.length preItemLen = items.length
ruleLoading.value = false ruleLoading.value = false
@ -76,7 +78,6 @@ export function useRules(
const formatResponseJson = ( const formatResponseJson = (
responseItem: IResponseJsonItem responseItem: IResponseJsonItem
): IJsonItemParams => { ): IJsonItemParams => {
responseItem.props.placeholder = t('project.node.' + responseItem.props.placeholder.split(' ').join('_').split(',').join('').toLowerCase())
const item: IJsonItemParams = { const item: IJsonItemParams = {
field: responseItem.field, field: responseItem.field,
options: responseItem.options, options: responseItem.options,
@ -95,7 +96,7 @@ export function useRules(
child.span = Math.floor(22 / item.props.rules.length) child.span = Math.floor(22 / item.props.rules.length)
return child return child
}) })
model[item.field] = [] model[item.field] = model[item.field] || []
delete item.props.rules delete item.props.rules
} }
if (responseItem.emit) { 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') { if (item.field === 'src_datasource_id') {
item.options = srcDatasourceOptions 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_connector_type: data.target_connector_type,
target_datasource_id: data.target_datasource_id, target_datasource_id: data.target_datasource_id,
target_table: data.target_table, target_table: data.target_table,
threshold: data.threshold threshold: data.threshold,
mapping_columns: JSON.stringify(data.mapping_columns)
} }
taskParams.sparkParameters = { taskParams.sparkParameters = {
deployMode: data.deployMode, deployMode: data.deployMode,
@ -562,6 +563,10 @@ export function formatModel(data: ITaskData) {
data.taskParams.ruleInputParameter.target_datasource_id data.taskParams.ruleInputParameter.target_datasource_id
params.target_table = data.taskParams.ruleInputParameter.target_table params.target_table = data.taskParams.ruleInputParameter.target_table
params.threshold = data.taskParams.ruleInputParameter.threshold 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) { if (data.taskParams?.sparkParameters) {
params.deployMode = data.taskParams.sparkParameters.deployMode 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_datasource_id?: number
target_table?: string target_table?: string
threshold?: string threshold?: string
mapping_columns?: string
} }
interface ITaskParams { interface ITaskParams {
@ -352,7 +353,7 @@ interface INodeData
>, >,
ISqoopTargetData, ISqoopTargetData,
ISqoopSourceData, ISqoopSourceData,
IRuleParameters { Omit<IRuleParameters, 'mapping_columns'> {
id?: string id?: string
taskType?: ITaskType taskType?: ITaskType
processName?: number processName?: number
@ -387,6 +388,7 @@ interface INodeData
failedBranch?: number failedBranch?: number
udfs?: string[] udfs?: string[]
customConfig?: boolean customConfig?: boolean
mapping_columns?: object[]
} }
interface ITaskData interface ITaskData

Loading…
Cancel
Save