1
0
Fork 0
mirror of synced 2024-09-30 17:18:14 +13:00

refactor new autocolumn functionality

This commit is contained in:
Peter Clement 2021-10-13 11:39:36 +01:00
parent 2105fb31db
commit a25020aad7
3 changed files with 25 additions and 16 deletions

View file

@ -25,18 +25,11 @@
array: ArrayRenderer,
internal: InternalRenderer,
}
console.log(value)
$: type = schema?.type ?? "string"
$: customRenderer = customRenderers?.find(x => x.column === schema?.name)
$: {
// this has to be done purely in the front-end due to migration issues
// the schema gets overriden on every tables fetch so we can't just set
// these to be a new type unfortunately
if (schema.name === "_id" || schema.name === "_rev") {
renderer = typeMap.internal
} else {
renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
}
}
$: renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
</script>
{#if renderer && (customRenderer || (value != null && value !== ""))}

View file

@ -16,11 +16,31 @@
import { Pagination } from "@budibase/bbui"
let hideAutocolumns = true
let schema
$: isUsersTable = $tables.selected?._id === TableNames.USERS
$: schema = $tables.selected?.schema
$: type = $tables.selected?.type
$: isInternal = type !== "external"
$: {
schema = $tables.selected?.schema
// Manually add these as we don't want them to be 'real' auto-columns
schema._id = {
type: "internal",
editable: false,
displayName: "ID",
name: "ID",
autocolumn: true,
}
if (isInternal) {
schema._rev = {
type: "internal",
editable: false,
displayName: "Revision",
name: "REV",
autocolumn: true,
}
}
}
$: id = $tables.selected?._id
$: search = searchTable(id)
$: columnOptions = Object.keys($search.schema || {})

View file

@ -97,8 +97,6 @@ export const AUTO_COLUMN_SUB_TYPES = {
CREATED_AT: "createdAt",
UPDATED_BY: "updatedBy",
UPDATED_AT: "updatedAt",
_id: "_id",
_rev: "_rev",
}
export const AUTO_COLUMN_DISPLAY_NAMES = {
@ -107,8 +105,6 @@ export const AUTO_COLUMN_DISPLAY_NAMES = {
CREATED_AT: "Created At",
UPDATED_BY: "Updated By",
UPDATED_AT: "Updated At",
_id: "_id",
_rev: "_rev",
}
export const FILE_TYPES = {