Skip to content

Commit

Permalink
fix(action): issue when creating datalayers action
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinplemelon authored and ysfscream committed Aug 26, 2024
1 parent 37a9743 commit 593bccb
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/hooks/Flow/useFlowNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export const SinkType = {
Elasticsearch: BridgeType.Elasticsearch,
SysKeeperForwarder: BridgeType.SysKeeperForwarder,
S3: BridgeType.S3,
AzureBlobStorage: BridgeType.AzureBlobStorage,
Couchbase: BridgeType.Couchbase,
Datalayers: BridgeType.Datalayers,
RePub: 'republish',
Console: 'console',
}
Expand Down
1 change: 1 addition & 0 deletions src/hooks/Flow/useNodeDrawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default (): {
[SinkType.Console]: ConsoleForm,
[SinkType.MQTTBroker]: UsingSchemaBridgeConfig,
[SinkType.InfluxDB]: BridgeInfluxdbConfig,
[SinkType.Datalayers]: BridgeInfluxdbConfig,
}
const getFormComponent = (type: string) => {
if (!type) {
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/Flow/useNodeForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default (): {
isUsingSchemaBridgeType: (type: string) => boolean
checkFormIsEmpty: (type: string, form: Record<string, any>) => boolean
} => {
const { createRawInfluxDBForm } = useBridgeFormCreator()
const { createRawInfluxDBForm, createRawDataLayersForm } = useBridgeFormCreator()
/**
* If you are using a schema bridge, create an empty object directly
*/
Expand All @@ -96,6 +96,7 @@ export default (): {
[SinkType.Console]: createConsoleForm,
[SinkType.GCP]: () => ({ role: Role.Producer }),
[SinkType.InfluxDB]: createRawInfluxDBForm,
[SinkType.Datalayers]: createRawDataLayersForm,
[SinkType.Pulsar]: emptyCreator,
}
const getFormDataByType = (type: string) => {
Expand Down
7 changes: 7 additions & 0 deletions src/hooks/Rule/bridge/useBridgeFormCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
export default (): {
createRawMQTTForm: (direction?: BridgeDirection) => any
createRawInfluxDBForm: () => OtherBridge
createRawDataLayersForm: () => OtherBridge
} => {
const { createDefaultResourceOptsForm } = useResourceOpt()
const { createSSLForm } = useSSL()
Expand Down Expand Up @@ -76,8 +77,14 @@ export default (): {
}),
})

const createRawDataLayersForm = () => ({
...createRawInfluxDBForm(),
type: BridgeType.Datalayers,
})

return {
createRawMQTTForm,
createRawInfluxDBForm,
createRawDataLayersForm,
}
}
2 changes: 2 additions & 0 deletions src/hooks/Rule/bridge/useBridgeTypeValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ const bridgesOrder = [
BridgeType.Elasticsearch,
BridgeType.S3,
BridgeType.AzureBlobStorage,
BridgeType.Couchbase,
BridgeType.SysKeeperProxy,
BridgeType.SysKeeperForwarder,
BridgeType.Datalayers,
]
export const bridgeOrderIndex: Record<string, number> = bridgesOrder.reduce(
(obj, type, index) => ({ ...obj, [type]: index }),
Expand Down
1 change: 1 addition & 0 deletions src/views/Flow/components/NodeDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ const formComponentPropsMap: ComputedRef<Record<string, { [key: string]: any }>>
[ProcessingType.Function]: { sourceNodes: addedSourceNodes.value },
[SinkType.RePub]: { isUsingInFlow: true },
[SinkType.InfluxDB]: { ...bridgeFormProps, labelWidth: '152px' },
[SinkType.Datalayers]: { ...bridgeFormProps, labelWidth: '152px' },
}))
const getFormComponentProps = (type: string) => {
const ret = formComponentPropsMap.value[type]
Expand Down
1 change: 1 addition & 0 deletions src/views/RuleEngine/Bridge/BridgeCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
v-if="[BridgeType.InfluxDB, BridgeType.Datalayers].includes(chosenBridgeType)"
v-model="bridgeData"
ref="formCom"
:type="chosenBridgeType"
/>
<using-schema-bridge-config
v-else-if="chosenBridgeType && !BRIDGE_TYPES_NOT_USE_SCHEMA.includes(chosenBridgeType)"
Expand Down
1 change: 1 addition & 0 deletions src/views/RuleEngine/Bridge/BridgeDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
v-model="bridgeInfo"
ref="formCom"
:edit="true"
:type="bridgeType"
:disabled="disabled"
:hide-name="hideName"
@init="resetRawBridgeInfoAfterComponentInit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ import useGetInfoFromComponents from '@/hooks/Rule/bridge/useGetInfoFromComponen
import useSchemaForm from '@/hooks/Schema/useSchemaForm'
import useFormRules from '@/hooks/useFormRules'
import useI18nTl from '@/hooks/useI18nTl'
import { BridgeType } from '@/types/enum'
import { BridgeItem, OtherBridge } from '@/types/rule'
import { Property } from '@/types/schemaForm'
import { cloneDeep, isEqual } from 'lodash'
Expand All @@ -103,6 +104,9 @@ const props = defineProps({
modelValue: {
type: Object,
},
type: {
type: String,
},
edit: {
type: Boolean,
},
Expand Down Expand Up @@ -140,7 +144,13 @@ const { components } = useSchemaForm(getAPIPath(`/schemas/actions`), {
})
const { getPropItem } = useGetInfoFromComponents(components)
const { createRawInfluxDBForm: createDefaultValue } = useBridgeFormCreator()
const { createRawInfluxDBForm, createRawDataLayersForm } = useBridgeFormCreator()
const createDefaultValue = () => {
if (props.type === BridgeType.Datalayers) {
return createRawDataLayersForm()
}
return createRawInfluxDBForm()
}
const formData: Ref<OtherBridge> = ref(createDefaultValue())
const formCom = ref()
Expand Down

0 comments on commit 593bccb

Please sign in to comment.