Fix display items

This commit is contained in:
Adria Navarro 2024-04-22 13:11:13 +02:00
parent 95cf28a417
commit b13d47e88d
2 changed files with 17 additions and 7 deletions

View File

@ -186,7 +186,10 @@
// don't make field IDs for auto types // don't make field IDs for auto types
if (type === AUTO_TYPE || autocolumn) { if (type === AUTO_TYPE || autocolumn) {
return type.toUpperCase() return type.toUpperCase()
} else if (type === FieldType.BB_REFERENCE) { } else if (
type === FieldType.BB_REFERENCE ||
type === FieldType.BB_REFERENCE_SINGLE
) {
return `${type}${subtype || ""}`.toUpperCase() return `${type}${subtype || ""}`.toUpperCase()
} else { } else {
return type.toUpperCase() return type.toUpperCase()
@ -363,13 +366,11 @@
function getAllowedTypes() { function getAllowedTypes() {
if (originalName) { if (originalName) {
const possibleTypes = ( const possibleTypes = SWITCHABLE_TYPES[field.type] || [
SWITCHABLE_TYPES[field.type] || [editableColumn.type] editableColumn.type,
).map(t => t.toLowerCase()) ]
return Object.entries(FIELDS) return Object.entries(FIELDS)
.filter(([fieldType]) => .filter(([_, field]) => possibleTypes.includes(field.type))
possibleTypes.includes(fieldType.toLowerCase())
)
.map(([_, fieldDefinition]) => fieldDefinition) .map(([_, fieldDefinition]) => fieldDefinition)
} }

View File

@ -166,6 +166,15 @@ export const FIELDS = {
FieldTypeSubtypes.BB_REFERENCE.USER 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: { USERS: {
name: "Users", name: "Users",
type: FieldType.BB_REFERENCE, type: FieldType.BB_REFERENCE,