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 { TriggerStepID, ActionStepID } from "constants/backend/automations"
import { onMount } from "svelte" import { onMount } from "svelte"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
import { FIELDS } from "constants/backend"
export let block export let block
export let testData export let testData
@ -228,6 +229,10 @@
categoryName, categoryName,
bindingName bindingName
) => { ) => {
const field = Object.values(FIELDS).find(
field => field.type === value.type && field.subtype === value.subtype
)
return { return {
readableBinding: bindingName readableBinding: bindingName
? `${bindingName}.${name}` ? `${bindingName}.${name}`
@ -238,7 +243,7 @@
icon, icon,
category: categoryName, category: categoryName,
display: { display: {
type: value.type, type: field?.name || value.type,
name, name,
rank: isLoopBlock ? idx + 1 : idx - loopBlockCount, rank: isLoopBlock ? idx + 1 : idx - loopBlockCount,
}, },
@ -282,6 +287,7 @@
for (const key in table?.schema) { for (const key in table?.schema) {
schema[key] = { schema[key] = {
type: table.schema[key].type, type: table.schema[key].type,
subtype: table.schema[key].subtype,
} }
} }
// remove the original binding // 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 ActionDefinitions from "components/design/settings/controls/ButtonActionEditor/manifest.json"
import { environment, licensing } from "stores/portal" import { environment, licensing } from "stores/portal"
import { convertOldFieldFormat } from "components/design/settings/controls/FieldConfiguration/utils" import { convertOldFieldFormat } from "components/design/settings/controls/FieldConfiguration/utils"
import { FIELDS } from "constants/backend"
const { ContextScopes } = Constants const { ContextScopes } = Constants
@ -1019,6 +1020,12 @@ export const getSchemaForDatasource = (asset, datasource, options) => {
// are objects // are objects
let fixedSchema = {} let fixedSchema = {}
Object.entries(schema || {}).forEach(([fieldName, fieldSchema]) => { 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") { if (typeof fieldSchema === "string") {
fixedSchema[fieldName] = { fixedSchema[fieldName] = {
type: fieldSchema, type: fieldSchema,
@ -1027,6 +1034,7 @@ export const getSchemaForDatasource = (asset, datasource, options) => {
} else { } else {
fixedSchema[fieldName] = { fixedSchema[fieldName] = {
...fieldSchema, ...fieldSchema,
type: field?.name || fieldSchema.name,
name: fieldName, name: fieldName,
} }
} }