Fix binding display types

This commit is contained in:
Adria Navarro 2024-04-26 11:13:56 +02:00
parent 063bdb1d7b
commit 9f3e01ef78
2 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -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,
}
}