Skip to content

Commit

Permalink
fix: web
Browse files Browse the repository at this point in the history
fix package web dist error
  • Loading branch information
hunter-cloud09 committed Mar 1, 2024
1 parent 114e34a commit 749cb47
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const props = {
default: false
},
nodeInfo: {
type: Object as PropType<NodeInfo>,
type: Object as any,
default: {}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ export function useNodeSettingModal(

const formatParams = (values: any) => {
const params = {
pluginId: props.nodeInfo.pluginId,
pluginId: props.nodeInfo?.pluginId,
name: values.name,
type: props.nodeInfo.type.toUpperCase(),
type: props.nodeInfo?.type.toUpperCase(),
connectorType:
props.nodeInfo.type === 'transform'
? props.nodeInfo.connectorType
props.nodeInfo?.type === 'transform'
? props.nodeInfo?.connectorType
: null
} as { [key: string]: any }
} as any;
const config = omit(values, [
'name',
'datasourceInstanceId',
Expand Down Expand Up @@ -119,8 +119,8 @@ export function useNodeSettingModal(

// Determine whether the current node type is Transform or Sink and there is no previous node.
if (
(props.nodeInfo.type === 'transform' || props.nodeInfo.type === 'sink') &&
!props.nodeInfo.predecessorsNodeId
(props.nodeInfo?.type === 'transform' || props.nodeInfo?.type === 'sink') &&
!props.nodeInfo?.predecessorsNodeId
) {
window.$message.warning(t('project.synchronization_definition.node_prev_check_tips'))
return false
Expand All @@ -138,7 +138,7 @@ export function useNodeSettingModal(
const values = configurationFormRef.value.getValues()

let modelOutputTableData
if (props.nodeInfo.type === 'source') {
if (props.nodeInfo?.type === 'source') {
const resultSchema = modelRef.value.getOutputSchema()
// check debezium
if (values.format && values.format === 'COMPATIBLE_DEBEZIUM_JSON') {
Expand Down Expand Up @@ -172,13 +172,13 @@ export function useNodeSettingModal(
}
}

if (props.nodeInfo.type === 'transform' && props.nodeInfo.predecessorsNodeId) {
if (props.nodeInfo?.type === 'transform' && props.nodeInfo?.predecessorsNodeId) {
const resultSchema = modelRef.value.getOutputSchema()
if (resultSchema.allTableData.length) {
if (
props.nodeInfo.connectorType === 'FieldMapper' ||
props.nodeInfo.connectorType === 'MultiFieldSplit' ||
props.nodeInfo.connectorType === 'Copy'
props.nodeInfo?.connectorType === 'FieldMapper' ||
props.nodeInfo?.connectorType === 'MultiFieldSplit' ||
props.nodeInfo?.connectorType === 'Copy'
) {
const result = resultSchema.allTableData
if (resultSchema.outputTableData.length) {
Expand All @@ -197,7 +197,7 @@ export function useNodeSettingModal(

const transformOptions: any = {}

if (props.nodeInfo.connectorType === 'FieldMapper') {
if (props.nodeInfo?.connectorType === 'FieldMapper') {
const resultSchema = modelRef.value.getOutputSchema()
transformOptions.changeOrders = resultSchema.outputTableData.map((o: any, i: number) => {
return {
Expand All @@ -212,7 +212,7 @@ export function useNodeSettingModal(
const outputTableDataNames = resultSchema.outputTableData.map((o: any) => ({sourceFieldName: o.original_field}))
const inputTableDataNames = resultSchema.inputTableData.map((o: any) => ({sourceFieldName: o.name}))
transformOptions.deleteFields = _.xorWith(outputTableDataNames, inputTableDataNames, _.isEqual)
} else if (props.nodeInfo.connectorType === 'MultiFieldSplit') {
} else if (props.nodeInfo?.connectorType === 'MultiFieldSplit') {
const resultSchema = modelRef.value.getOutputSchema()
const hasSeparator = resultSchema.outputTableData.filter((o: any) => o.separator)
transformOptions.splits = _.uniqWith(hasSeparator.map((o: any) => {
Expand All @@ -222,14 +222,14 @@ export function useNodeSettingModal(
outputFields: _.groupBy(hasSeparator, 'separator')[o.separator].map((h: any) => h.name)
}
}), _.isEqual)
} else if (props.nodeInfo.connectorType === 'Copy') {
} else if (props.nodeInfo?.connectorType === 'Copy') {
const resultSchema = modelRef.value.getOutputSchema()
const hasCopyColumn = resultSchema.outputTableData.filter((o: any) => o.copyTimes === -1)
transformOptions.copyList = hasCopyColumn.map((h: any) => ({
sourceFieldName: h.original_field,
targetFieldName: h.name
}))
} else if(props.nodeInfo.connectorType === 'Sql') {
} else if(props.nodeInfo?.connectorType === 'Sql') {
const resultSchema = modelRef.value.getOutputSchema()
const tableInfo = resultSchema.allTableData[0].tableInfos
transformOptions.sql = {
Expand Down Expand Up @@ -286,9 +286,9 @@ export function useNodeSettingModal(
datasourceName: node.datasourceName,
datasourceInstanceId: node.datasourceInstanceId,
columnSelectable: node.columnSelectable,
outputSchema: props.nodeInfo.outputSchema,
outputSchema: props.nodeInfo?.outputSchema,
sceneMode: node.sceneMode ? node.sceneMode : '',
transformOptions: props.nodeInfo.transformOptions
transformOptions: props.nodeInfo?.transformOptions
}

if (node.format && node.format === 'COMPATIBLE_DEBEZIUM_JSON') {
Expand Down

0 comments on commit 749cb47

Please sign in to comment.