From 9f3e01ef78865c9109aefe25a3799a3e203bb284 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 26 Apr 2024 11:13:56 +0200 Subject: [PATCH] Fix binding display types --- .../automation/SetupPanel/AutomationBlockSetup.svelte | 8 +++++++- packages/builder/src/dataBinding.js | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 2d2022299c..60300434f8 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -48,6 +48,7 @@ import { TriggerStepID, ActionStepID } from "constants/backend/automations" import { onMount } from "svelte" import { cloneDeep } from "lodash/fp" + import { FIELDS } from "constants/backend" export let block export let testData @@ -228,6 +229,10 @@ categoryName, bindingName ) => { + const field = Object.values(FIELDS).find( + field => field.type === value.type && field.subtype === value.subtype + ) + return { readableBinding: bindingName ? `${bindingName}.${name}` @@ -238,7 +243,7 @@ icon, category: categoryName, display: { - type: value.type, + type: field?.name || value.type, name, rank: isLoopBlock ? idx + 1 : idx - loopBlockCount, }, @@ -282,6 +287,7 @@ for (const key in table?.schema) { schema[key] = { type: table.schema[key].type, + subtype: table.schema[key].subtype, } } // remove the original binding diff --git a/packages/builder/src/dataBinding.js b/packages/builder/src/dataBinding.js index 5efbb79611..50eb2c1b66 100644 --- a/packages/builder/src/dataBinding.js +++ b/packages/builder/src/dataBinding.js @@ -29,6 +29,7 @@ import { JSONUtils, Constants } from "@budibase/frontend-core" import ActionDefinitions from "components/design/settings/controls/ButtonActionEditor/manifest.json" import { environment, licensing } from "stores/portal" import { convertOldFieldFormat } from "components/design/settings/controls/FieldConfiguration/utils" +import { FIELDS } from "constants/backend" const { ContextScopes } = Constants @@ -1019,6 +1020,12 @@ export const getSchemaForDatasource = (asset, datasource, options) => { // are objects let fixedSchema = {} Object.entries(schema || {}).forEach(([fieldName, fieldSchema]) => { + const field = Object.values(FIELDS).find( + field => + field.type === fieldSchema.type && + field.subtype === fieldSchema.subtype + ) + if (typeof fieldSchema === "string") { fixedSchema[fieldName] = { type: fieldSchema, @@ -1027,6 +1034,7 @@ export const getSchemaForDatasource = (asset, datasource, options) => { } else { fixedSchema[fieldName] = { ...fieldSchema, + type: field?.name || fieldSchema.name, name: fieldName, } }