You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by so...@apache.org on 2022/05/30 05:54:18 UTC
[dolphinscheduler] branch dev updated: [Fix][UI] Add mapping_columns filed for the data_quality ruleInputParamter. (#10286)
This is an automated email from the ASF dual-hosted git repository.
songjian pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new e7fbfa3a26 [Fix][UI] Add mapping_columns filed for the data_quality ruleInputParamter. (#10286)
e7fbfa3a26 is described below
commit e7fbfa3a26cfe1e697d8f99f1381c2942164d2d8
Author: Amy0104 <97...@users.noreply.github.com>
AuthorDate: Mon May 30 13:54:10 2022 +0800
[Fix][UI] Add mapping_columns filed for the data_quality ruleInputParamter. (#10286)
---
.../task/components/node/fields/use-rules.ts | 20 ++++++++++++++++----
.../projects/task/components/node/format-data.ts | 7 ++++++-
.../src/views/projects/task/components/node/types.ts | 4 +++-
3 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-rules.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-rules.ts
index 78c9592a6c..dde32cbc62 100644
--- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-rules.ts
+++ b/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
}
diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts
index 1d03d650b3..d993aaa234 100644
--- a/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts
+++ b/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,
@@ -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
diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts
index 8d595a5737..78f48c6b24 100644
--- a/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts
+++ b/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 {
@@ -352,7 +353,7 @@ interface INodeData
>,
ISqoopTargetData,
ISqoopSourceData,
- IRuleParameters {
+ Omit<IRuleParameters, 'mapping_columns'> {
id?: string
taskType?: ITaskType
processName?: number
@@ -387,6 +388,7 @@ interface INodeData
failedBranch?: number
udfs?: string[]
customConfig?: boolean
+ mapping_columns?: object[]
}
interface ITaskData