|
|
@ -14,243 +14,243 @@ |
|
|
|
* See the License for the specific language governing permissions and |
|
|
|
* See the License for the specific language governing permissions and |
|
|
|
* limitations under the License. |
|
|
|
* limitations under the License. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
import {ref, onMounted, watch} from 'vue' |
|
|
|
import { ref, onMounted, watch } from 'vue' |
|
|
|
import {useI18n} from 'vue-i18n' |
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
import {useCustomParams, useDatasource, useResources} from '.' |
|
|
|
import { useCustomParams, useDatasource, useResources } from '.' |
|
|
|
import type {IJsonItem} from '../types' |
|
|
|
import type { IJsonItem } from '../types' |
|
|
|
|
|
|
|
|
|
|
|
export function useDataX(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
export function useDataX(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
const {t} = useI18n() |
|
|
|
const { t } = useI18n() |
|
|
|
const jobSpeedByteOptions: any[] = [ |
|
|
|
const jobSpeedByteOptions: any[] = [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: `0(${t('project.node.unlimited')})`, |
|
|
|
label: `0(${t('project.node.unlimited')})`, |
|
|
|
value: 0 |
|
|
|
value: 0 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '1KB', |
|
|
|
label: '1KB', |
|
|
|
value: 1024 |
|
|
|
value: 1024 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '10KB', |
|
|
|
label: '10KB', |
|
|
|
value: 10240 |
|
|
|
value: 10240 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '50KB', |
|
|
|
label: '50KB', |
|
|
|
value: 51200 |
|
|
|
value: 51200 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '100KB', |
|
|
|
label: '100KB', |
|
|
|
value: 102400 |
|
|
|
value: 102400 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '512KB', |
|
|
|
label: '512KB', |
|
|
|
value: 524288 |
|
|
|
value: 524288 |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
|
const jobSpeedRecordOptions: any[] = [ |
|
|
|
const jobSpeedRecordOptions: any[] = [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: `0(${t('project.node.unlimited')})`, |
|
|
|
label: `0(${t('project.node.unlimited')})`, |
|
|
|
value: 0 |
|
|
|
value: 0 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '500', |
|
|
|
label: '500', |
|
|
|
value: 500 |
|
|
|
value: 500 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '1000', |
|
|
|
label: '1000', |
|
|
|
value: 1000 |
|
|
|
value: 1000 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '1500', |
|
|
|
label: '1500', |
|
|
|
value: 1500 |
|
|
|
value: 1500 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '2000', |
|
|
|
label: '2000', |
|
|
|
value: 2000 |
|
|
|
value: 2000 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '2500', |
|
|
|
label: '2500', |
|
|
|
value: 2500 |
|
|
|
value: 2500 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '3000', |
|
|
|
label: '3000', |
|
|
|
value: 3000 |
|
|
|
value: 3000 |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
|
const memoryLimitOptions = [ |
|
|
|
const memoryLimitOptions = [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '1G', |
|
|
|
label: '1G', |
|
|
|
value: 1 |
|
|
|
value: 1 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '2G', |
|
|
|
label: '2G', |
|
|
|
value: 2 |
|
|
|
value: 2 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '3G', |
|
|
|
label: '3G', |
|
|
|
value: 3 |
|
|
|
value: 3 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '4G', |
|
|
|
label: '4G', |
|
|
|
value: 4 |
|
|
|
value: 4 |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
const sqlEditorSpan = ref(24) |
|
|
|
const sqlEditorSpan = ref(24) |
|
|
|
const jsonEditorSpan = ref(0) |
|
|
|
const jsonEditorSpan = ref(0) |
|
|
|
const datasourceSpan = ref(12) |
|
|
|
const datasourceSpan = ref(12) |
|
|
|
const destinationDatasourceSpan = ref(8) |
|
|
|
const destinationDatasourceSpan = ref(8) |
|
|
|
const otherStatementSpan = ref(22) |
|
|
|
const otherStatementSpan = ref(22) |
|
|
|
const jobSpeedSpan = ref(12) |
|
|
|
const jobSpeedSpan = ref(12) |
|
|
|
const useResourcesSpan = ref(0) |
|
|
|
const useResourcesSpan = ref(0) |
|
|
|
|
|
|
|
|
|
|
|
const initConstants = () => { |
|
|
|
const initConstants = () => { |
|
|
|
if (model.customConfig) { |
|
|
|
if (model.customConfig) { |
|
|
|
sqlEditorSpan.value = 0 |
|
|
|
sqlEditorSpan.value = 0 |
|
|
|
jsonEditorSpan.value = 24 |
|
|
|
jsonEditorSpan.value = 24 |
|
|
|
datasourceSpan.value = 0 |
|
|
|
datasourceSpan.value = 0 |
|
|
|
destinationDatasourceSpan.value = 0 |
|
|
|
destinationDatasourceSpan.value = 0 |
|
|
|
otherStatementSpan.value = 0 |
|
|
|
otherStatementSpan.value = 0 |
|
|
|
jobSpeedSpan.value = 0 |
|
|
|
jobSpeedSpan.value = 0 |
|
|
|
useResourcesSpan.value = 24 |
|
|
|
useResourcesSpan.value = 24 |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
sqlEditorSpan.value = 24 |
|
|
|
sqlEditorSpan.value = 24 |
|
|
|
jsonEditorSpan.value = 0 |
|
|
|
jsonEditorSpan.value = 0 |
|
|
|
datasourceSpan.value = 12 |
|
|
|
datasourceSpan.value = 12 |
|
|
|
destinationDatasourceSpan.value = 8 |
|
|
|
destinationDatasourceSpan.value = 8 |
|
|
|
otherStatementSpan.value = 22 |
|
|
|
otherStatementSpan.value = 22 |
|
|
|
jobSpeedSpan.value = 12 |
|
|
|
jobSpeedSpan.value = 12 |
|
|
|
useResourcesSpan.value = 0 |
|
|
|
useResourcesSpan.value = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const supportedDatasourceType = [ |
|
|
|
|
|
|
|
'MYSQL', |
|
|
|
|
|
|
|
'POSTGRESQL', |
|
|
|
|
|
|
|
'ORACLE', |
|
|
|
|
|
|
|
'SQLSERVER', |
|
|
|
|
|
|
|
'CLICKHOUSE', |
|
|
|
|
|
|
|
'DATABEND', |
|
|
|
|
|
|
|
'HIVE', |
|
|
|
|
|
|
|
'PRESTO' |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
|
|
|
initConstants() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
watch( |
|
|
|
|
|
|
|
() => model.customConfig, |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
initConstants() |
|
|
|
} |
|
|
|
} |
|
|
|
const supportedDatasourceType = [ |
|
|
|
) |
|
|
|
'MYSQL', |
|
|
|
|
|
|
|
'POSTGRESQL', |
|
|
|
|
|
|
|
'ORACLE', |
|
|
|
|
|
|
|
'SQLSERVER', |
|
|
|
|
|
|
|
'CLICKHOUSE', |
|
|
|
|
|
|
|
'DATABEND', |
|
|
|
|
|
|
|
'HIVE', |
|
|
|
|
|
|
|
'PRESTO' |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
|
|
|
initConstants() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
watch( |
|
|
|
|
|
|
|
() => model.customConfig, |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
initConstants() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return [ |
|
|
|
return [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'switch', |
|
|
|
type: 'switch', |
|
|
|
field: 'customConfig', |
|
|
|
field: 'customConfig', |
|
|
|
name: t('project.node.datax_custom_template') |
|
|
|
name: t('project.node.datax_custom_template') |
|
|
|
}, |
|
|
|
}, |
|
|
|
...useDatasource(model, { |
|
|
|
...useDatasource(model, { |
|
|
|
typeField: 'dsType', |
|
|
|
typeField: 'dsType', |
|
|
|
sourceField: 'dataSource', |
|
|
|
sourceField: 'dataSource', |
|
|
|
span: datasourceSpan, |
|
|
|
span: datasourceSpan, |
|
|
|
supportedDatasourceType |
|
|
|
supportedDatasourceType |
|
|
|
}), |
|
|
|
}), |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'editor', |
|
|
|
type: 'editor', |
|
|
|
field: 'sql', |
|
|
|
field: 'sql', |
|
|
|
name: t('project.node.sql_statement'), |
|
|
|
name: t('project.node.sql_statement'), |
|
|
|
span: sqlEditorSpan, |
|
|
|
span: sqlEditorSpan, |
|
|
|
validate: { |
|
|
|
validate: { |
|
|
|
trigger: ['input', 'trigger'], |
|
|
|
trigger: ['input', 'trigger'], |
|
|
|
required: true, |
|
|
|
required: true, |
|
|
|
message: t('project.node.sql_empty_tips') |
|
|
|
message: t('project.node.sql_empty_tips') |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'editor', |
|
|
|
type: 'editor', |
|
|
|
field: 'json', |
|
|
|
field: 'json', |
|
|
|
name: t('project.node.datax_json_template'), |
|
|
|
name: t('project.node.datax_json_template'), |
|
|
|
span: jsonEditorSpan, |
|
|
|
span: jsonEditorSpan, |
|
|
|
validate: { |
|
|
|
validate: { |
|
|
|
trigger: ['input', 'trigger'], |
|
|
|
trigger: ['input', 'trigger'], |
|
|
|
required: true, |
|
|
|
required: true, |
|
|
|
message: t('project.node.sql_empty_tips') |
|
|
|
message: t('project.node.sql_empty_tips') |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
useResources(useResourcesSpan), |
|
|
|
useResources(useResourcesSpan), |
|
|
|
...useDatasource(model, { |
|
|
|
...useDatasource(model, { |
|
|
|
typeField: 'dtType', |
|
|
|
typeField: 'dtType', |
|
|
|
sourceField: 'dataTarget', |
|
|
|
sourceField: 'dataTarget', |
|
|
|
span: destinationDatasourceSpan, |
|
|
|
span: destinationDatasourceSpan, |
|
|
|
supportedDatasourceType |
|
|
|
supportedDatasourceType |
|
|
|
}), |
|
|
|
}), |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'input', |
|
|
|
type: 'input', |
|
|
|
field: 'targetTable', |
|
|
|
field: 'targetTable', |
|
|
|
name: t('project.node.datax_target_table'), |
|
|
|
name: t('project.node.datax_target_table'), |
|
|
|
span: destinationDatasourceSpan, |
|
|
|
span: destinationDatasourceSpan, |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
placeholder: t('project.node.datax_target_table_tips') |
|
|
|
placeholder: t('project.node.datax_target_table_tips') |
|
|
|
}, |
|
|
|
}, |
|
|
|
validate: { |
|
|
|
validate: { |
|
|
|
trigger: ['input', 'blur'], |
|
|
|
trigger: ['input', 'blur'], |
|
|
|
required: true |
|
|
|
required: true |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'multi-input', |
|
|
|
type: 'multi-input', |
|
|
|
field: 'preStatements', |
|
|
|
field: 'preStatements', |
|
|
|
name: t('project.node.datax_target_database_pre_sql'), |
|
|
|
name: t('project.node.datax_target_database_pre_sql'), |
|
|
|
span: otherStatementSpan, |
|
|
|
span: otherStatementSpan, |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
placeholder: t('project.node.datax_non_query_sql_tips'), |
|
|
|
placeholder: t('project.node.datax_non_query_sql_tips'), |
|
|
|
type: 'textarea', |
|
|
|
type: 'textarea', |
|
|
|
autosize: {minRows: 1} |
|
|
|
autosize: { minRows: 1 } |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'multi-input', |
|
|
|
type: 'multi-input', |
|
|
|
field: 'postStatements', |
|
|
|
field: 'postStatements', |
|
|
|
name: t('project.node.datax_target_database_post_sql'), |
|
|
|
name: t('project.node.datax_target_database_post_sql'), |
|
|
|
span: otherStatementSpan, |
|
|
|
span: otherStatementSpan, |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
placeholder: t('project.node.datax_non_query_sql_tips'), |
|
|
|
placeholder: t('project.node.datax_non_query_sql_tips'), |
|
|
|
type: 'textarea', |
|
|
|
type: 'textarea', |
|
|
|
autosize: {minRows: 1} |
|
|
|
autosize: { minRows: 1 } |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'select', |
|
|
|
type: 'select', |
|
|
|
field: 'jobSpeedByte', |
|
|
|
field: 'jobSpeedByte', |
|
|
|
name: t('project.node.datax_job_speed_byte'), |
|
|
|
name: t('project.node.datax_job_speed_byte'), |
|
|
|
span: jobSpeedSpan, |
|
|
|
span: jobSpeedSpan, |
|
|
|
options: jobSpeedByteOptions, |
|
|
|
options: jobSpeedByteOptions, |
|
|
|
value: 0 |
|
|
|
value: 0 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'select', |
|
|
|
type: 'select', |
|
|
|
field: 'jobSpeedRecord', |
|
|
|
field: 'jobSpeedRecord', |
|
|
|
name: t('project.node.datax_job_speed_record'), |
|
|
|
name: t('project.node.datax_job_speed_record'), |
|
|
|
span: jobSpeedSpan, |
|
|
|
span: jobSpeedSpan, |
|
|
|
options: jobSpeedRecordOptions, |
|
|
|
options: jobSpeedRecordOptions, |
|
|
|
value: 1000 |
|
|
|
value: 1000 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'select', |
|
|
|
type: 'select', |
|
|
|
field: 'xms', |
|
|
|
field: 'xms', |
|
|
|
name: t('project.node.datax_job_runtime_memory_xms'), |
|
|
|
name: t('project.node.datax_job_runtime_memory_xms'), |
|
|
|
span: 12, |
|
|
|
span: 12, |
|
|
|
options: memoryLimitOptions, |
|
|
|
options: memoryLimitOptions, |
|
|
|
value: 1 |
|
|
|
value: 1 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'select', |
|
|
|
type: 'select', |
|
|
|
field: 'xmx', |
|
|
|
field: 'xmx', |
|
|
|
name: t('project.node.datax_job_runtime_memory_xmx'), |
|
|
|
name: t('project.node.datax_job_runtime_memory_xmx'), |
|
|
|
span: 12, |
|
|
|
span: 12, |
|
|
|
options: memoryLimitOptions, |
|
|
|
options: memoryLimitOptions, |
|
|
|
value: 1 |
|
|
|
value: 1 |
|
|
|
}, |
|
|
|
}, |
|
|
|
...useCustomParams({model, field: 'localParams', isSimple: true}) |
|
|
|
...useCustomParams({ model, field: 'localParams', isSimple: true }) |
|
|
|
] |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|