Merge pull request #13687 from Budibase/rename-data-types

Update naming of some data types and update order
This commit is contained in:
Andrew Kingston 2024-05-15 10:32:15 +01:00 committed by GitHub
commit 2a09e591dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 30 deletions

View File

@ -398,44 +398,50 @@
if (!externalTable) { if (!externalTable) {
return [ return [
FIELDS.STRING, FIELDS.STRING,
FIELDS.BARCODEQR, FIELDS.NUMBER,
FIELDS.LONGFORM,
FIELDS.OPTIONS, FIELDS.OPTIONS,
FIELDS.ARRAY, FIELDS.ARRAY,
FIELDS.NUMBER,
FIELDS.BIGINT,
FIELDS.BOOLEAN, FIELDS.BOOLEAN,
FIELDS.DATETIME, FIELDS.DATETIME,
FIELDS.ATTACHMENT_SINGLE,
FIELDS.ATTACHMENTS,
FIELDS.LINK, FIELDS.LINK,
FIELDS.FORMULA, FIELDS.LONGFORM,
FIELDS.JSON,
FIELDS.USER, FIELDS.USER,
FIELDS.USERS, FIELDS.USERS,
FIELDS.ATTACHMENT_SINGLE,
FIELDS.ATTACHMENTS,
FIELDS.FORMULA,
FIELDS.JSON,
FIELDS.BARCODEQR,
FIELDS.BIGINT,
FIELDS.AUTO, FIELDS.AUTO,
] ]
} else { } else {
let fields = [ let fields = [
FIELDS.STRING, FIELDS.STRING,
FIELDS.BARCODEQR,
FIELDS.LONGFORM,
FIELDS.OPTIONS,
FIELDS.DATETIME,
FIELDS.NUMBER, FIELDS.NUMBER,
FIELDS.OPTIONS,
FIELDS.ARRAY,
FIELDS.BOOLEAN, FIELDS.BOOLEAN,
FIELDS.FORMULA, FIELDS.DATETIME,
FIELDS.BIGINT, FIELDS.LINK,
FIELDS.LONGFORM,
FIELDS.USER, FIELDS.USER,
FIELDS.USERS,
FIELDS.FORMULA,
FIELDS.BARCODEQR,
FIELDS.BIGINT,
] ]
if (datasource && datasource.source !== SourceName.GOOGLE_SHEETS) { // Filter out multiple users for google sheets
fields.push(FIELDS.USERS) if (datasource?.source === SourceName.GOOGLE_SHEETS) {
fields = fields.filter(x => x !== FIELDS.USERS)
} }
// no-sql or a spreadsheet
if (!externalTable || table.sql) { // Filter out SQL-specific types for non-SQL datasources
fields = [...fields, FIELDS.LINK, FIELDS.ARRAY] if (!table.sql) {
fields = fields.filter(x => x !== FIELDS.LINK && x !== FIELDS.ARRAY)
} }
return fields return fields
} }
} }

View File

@ -33,7 +33,7 @@ export const FIELDS = {
}, },
}, },
BARCODEQR: { BARCODEQR: {
name: "Barcode/QR", name: "Barcode / QR",
type: FieldType.BARCODEQR, type: FieldType.BARCODEQR,
icon: TypeIconMap[FieldType.BARCODEQR], icon: TypeIconMap[FieldType.BARCODEQR],
constraints: { constraints: {
@ -43,7 +43,7 @@ export const FIELDS = {
}, },
}, },
LONGFORM: { LONGFORM: {
name: "Long Form Text", name: "Long form text",
type: FieldType.LONGFORM, type: FieldType.LONGFORM,
icon: TypeIconMap[FieldType.LONGFORM], icon: TypeIconMap[FieldType.LONGFORM],
constraints: { constraints: {
@ -53,7 +53,7 @@ export const FIELDS = {
}, },
}, },
OPTIONS: { OPTIONS: {
name: "Options", name: "Single select",
type: FieldType.OPTIONS, type: FieldType.OPTIONS,
icon: TypeIconMap[FieldType.OPTIONS], icon: TypeIconMap[FieldType.OPTIONS],
constraints: { constraints: {
@ -63,7 +63,7 @@ export const FIELDS = {
}, },
}, },
ARRAY: { ARRAY: {
name: "Multi-select", name: "Multi select",
type: FieldType.ARRAY, type: FieldType.ARRAY,
icon: TypeIconMap[FieldType.ARRAY], icon: TypeIconMap[FieldType.ARRAY],
constraints: { constraints: {
@ -83,7 +83,7 @@ export const FIELDS = {
}, },
}, },
BIGINT: { BIGINT: {
name: "BigInt", name: "Big integer",
type: FieldType.BIGINT, type: FieldType.BIGINT,
icon: TypeIconMap[FieldType.BIGINT], icon: TypeIconMap[FieldType.BIGINT],
}, },
@ -97,7 +97,7 @@ export const FIELDS = {
}, },
}, },
DATETIME: { DATETIME: {
name: "Date/Time", name: "Date / time",
type: FieldType.DATETIME, type: FieldType.DATETIME,
icon: TypeIconMap[FieldType.DATETIME], icon: TypeIconMap[FieldType.DATETIME],
constraints: { constraints: {
@ -111,7 +111,7 @@ export const FIELDS = {
}, },
}, },
ATTACHMENT_SINGLE: { ATTACHMENT_SINGLE: {
name: "Attachment", name: "Single attachment",
type: FieldType.ATTACHMENT_SINGLE, type: FieldType.ATTACHMENT_SINGLE,
icon: TypeIconMap[FieldType.ATTACHMENT_SINGLE], icon: TypeIconMap[FieldType.ATTACHMENT_SINGLE],
constraints: { constraints: {
@ -119,7 +119,7 @@ export const FIELDS = {
}, },
}, },
ATTACHMENTS: { ATTACHMENTS: {
name: "Attachment List", name: "Multi attachment",
type: FieldType.ATTACHMENTS, type: FieldType.ATTACHMENTS,
icon: TypeIconMap[FieldType.ATTACHMENTS], icon: TypeIconMap[FieldType.ATTACHMENTS],
constraints: { constraints: {
@ -137,7 +137,7 @@ export const FIELDS = {
}, },
}, },
AUTO: { AUTO: {
name: "Auto Column", name: "Auto column",
type: FieldType.AUTO, type: FieldType.AUTO,
icon: TypeIconMap[FieldType.AUTO], icon: TypeIconMap[FieldType.AUTO],
constraints: {}, constraints: {},
@ -158,7 +158,7 @@ export const FIELDS = {
}, },
}, },
USER: { USER: {
name: "User", name: "Single user",
type: FieldType.BB_REFERENCE_SINGLE, type: FieldType.BB_REFERENCE_SINGLE,
subtype: BBReferenceFieldSubType.USER, subtype: BBReferenceFieldSubType.USER,
icon: TypeIconMap[FieldType.BB_REFERENCE_SINGLE][ icon: TypeIconMap[FieldType.BB_REFERENCE_SINGLE][
@ -166,7 +166,7 @@ export const FIELDS = {
], ],
}, },
USERS: { USERS: {
name: "User List", name: "Multi user",
type: FieldType.BB_REFERENCE, type: FieldType.BB_REFERENCE,
subtype: BBReferenceFieldSubType.USER, subtype: BBReferenceFieldSubType.USER,
icon: TypeIconMap[FieldType.BB_REFERENCE][BBReferenceFieldSubType.USER], icon: TypeIconMap[FieldType.BB_REFERENCE][BBReferenceFieldSubType.USER],