Browse Source

[Fix][UI Next][V1.0.0-Alpha]Fix the default value of custom template incorrect in DATAX. (#9163)

3.0.0/version-upgrade
Amy0104 3 years ago committed by GitHub
parent
commit
327a60efd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-datax.ts
  2. 5
      dolphinscheduler-ui-next/src/views/projects/task/components/node/format-data.ts
  3. 25
      dolphinscheduler-ui-next/src/views/projects/task/components/node/tasks/use-datax.ts
  4. 2
      dolphinscheduler-ui-next/src/views/projects/task/components/node/types.ts

8
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-datax.ts

@ -205,8 +205,7 @@ export function useDataX(model: { [field: string]: any }): IJsonItem[] {
const customParameterSpan = ref(0) const customParameterSpan = ref(0)
const initConstants = () => { const initConstants = () => {
if (model.customConfigSwitch) { if (model.customConfig) {
model.customConfig = 1
sqlEditorSpan.value = 0 sqlEditorSpan.value = 0
jsonEditorSpan.value = 24 jsonEditorSpan.value = 24
datasourceSpan.value = 0 datasourceSpan.value = 0
@ -215,7 +214,6 @@ export function useDataX(model: { [field: string]: any }): IJsonItem[] {
jobSpeedSpan.value = 0 jobSpeedSpan.value = 0
customParameterSpan.value = 24 customParameterSpan.value = 24
} else { } else {
model.customConfig = 0
sqlEditorSpan.value = 24 sqlEditorSpan.value = 24
jsonEditorSpan.value = 0 jsonEditorSpan.value = 0
datasourceSpan.value = 12 datasourceSpan.value = 12
@ -244,7 +242,7 @@ export function useDataX(model: { [field: string]: any }): IJsonItem[] {
} }
watch( watch(
() => model.customConfigSwitch, () => model.customConfig,
() => { () => {
initConstants() initConstants()
} }
@ -253,7 +251,7 @@ export function useDataX(model: { [field: string]: any }): IJsonItem[] {
return [ return [
{ {
type: 'switch', type: 'switch',
field: 'customConfigSwitch', field: 'customConfig',
name: t('project.node.datax_custom_template') name: t('project.node.datax_custom_template')
}, },
{ {

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

@ -227,7 +227,7 @@ export function formatParams(data: INodeData): {
} }
if (data.taskType === 'DATAX') { if (data.taskType === 'DATAX') {
taskParams.customConfig = data.customConfig taskParams.customConfig = data.customConfig ? 1 : 0
if (taskParams.customConfig === 0) { if (taskParams.customConfig === 0) {
taskParams.dsType = data.dsType taskParams.dsType = data.dsType
taskParams.dataSource = data.dataSource taskParams.dataSource = data.dataSource
@ -484,6 +484,9 @@ export function formatModel(data: ITaskData) {
if (data.taskParams?.udfs) { if (data.taskParams?.udfs) {
params.udfs = data.taskParams.udfs?.split(',') params.udfs = data.taskParams.udfs?.split(',')
} }
if (data.taskParams?.customConfig !== void 0) {
params.customConfig = data.taskParams.customConfig === 1 ? true : false
}
return params return params
} }

25
dolphinscheduler-ui-next/src/views/projects/task/components/node/tasks/use-datax.ts

@ -44,26 +44,11 @@ export function useDataX({
workerGroup: 'default', workerGroup: 'default',
delayTime: 0, delayTime: 0,
timeout: 30, timeout: 30,
customConfig: data?.taskParams?.customConfig customConfig: false,
? data?.taskParams?.customConfig dsType: 'MYSQL',
: 0, dtType: 'MYSQL',
customConfigSwitch: data?.taskParams?.customConfig !== 0, preStatements: [],
dsType: data?.taskParams?.dsType ? data?.taskParams?.dsType : 'MYSQL', postStatements: []
dataSource: data?.taskParams?.dataSource,
dtType: data?.taskParams?.dtType ? data?.taskParams?.dtType : 'MYSQL',
dataTarget: data?.taskParams?.dataTarget,
sql: data?.taskParams?.sql,
targetTable: data?.taskParams?.targetTable,
preStatements: data?.taskParams?.preStatements
? data?.taskParams?.preStatements
: [],
postStatements: data?.taskParams?.postStatements
? data?.taskParams?.postStatements
: [],
jobSpeedByte: data?.taskParams?.jobSpeedByte,
jobSpeedRecord: data?.taskParams?.jobSpeedRecord,
xms: data?.taskParams?.xms,
xmx: data?.taskParams?.xmx
} as INodeData) } as INodeData)
let extra: IJsonItem[] = [] let extra: IJsonItem[] = []

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

@ -299,6 +299,7 @@ interface INodeData
| 'sparkParameters' | 'sparkParameters'
| 'conditionResult' | 'conditionResult'
| 'udfs' | 'udfs'
| 'customConfig'
>, >,
ISqoopTargetData, ISqoopTargetData,
ISqoopSourceData, ISqoopSourceData,
@ -336,6 +337,7 @@ interface INodeData
successBranch?: number successBranch?: number
failedBranch?: number failedBranch?: number
udfs?: string[] udfs?: string[]
customConfig?: boolean
} }
interface ITaskData interface ITaskData

Loading…
Cancel
Save