From b13d47e88d880eeb7f8b2413a1064d21e281bffc Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 22 Apr 2024 13:11:13 +0200 Subject: [PATCH] Fix display items --- .../DataTable/modals/CreateEditColumn.svelte | 15 ++++++++------- packages/builder/src/constants/backend/index.js | 9 +++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index 574b15de1a..642dde5db1 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -186,7 +186,10 @@ // don't make field IDs for auto types if (type === AUTO_TYPE || autocolumn) { return type.toUpperCase() - } else if (type === FieldType.BB_REFERENCE) { + } else if ( + type === FieldType.BB_REFERENCE || + type === FieldType.BB_REFERENCE_SINGLE + ) { return `${type}${subtype || ""}`.toUpperCase() } else { return type.toUpperCase() @@ -363,13 +366,11 @@ function getAllowedTypes() { if (originalName) { - const possibleTypes = ( - SWITCHABLE_TYPES[field.type] || [editableColumn.type] - ).map(t => t.toLowerCase()) + const possibleTypes = SWITCHABLE_TYPES[field.type] || [ + editableColumn.type, + ] return Object.entries(FIELDS) - .filter(([fieldType]) => - possibleTypes.includes(fieldType.toLowerCase()) - ) + .filter(([_, field]) => possibleTypes.includes(field.type)) .map(([_, fieldDefinition]) => fieldDefinition) } diff --git a/packages/builder/src/constants/backend/index.js b/packages/builder/src/constants/backend/index.js index 30f6e20b45..1996395420 100644 --- a/packages/builder/src/constants/backend/index.js +++ b/packages/builder/src/constants/backend/index.js @@ -166,6 +166,15 @@ export const FIELDS = { FieldTypeSubtypes.BB_REFERENCE.USER ], }, + // Used for display of editing existing columns + OLD_USER: { + name: "User", + type: FieldType.BB_REFERENCE, + subtype: FieldSubtype.USER, + icon: TypeIconMap[FieldType.BB_REFERENCE_SINGLE][ + FieldTypeSubtypes.BB_REFERENCE.USER + ], + }, USERS: { name: "Users", type: FieldType.BB_REFERENCE,