Merge pull request #3046 from Budibase/fix/copy-id-and-rev

Add back the ability to copy the ID and Revision (safely)
This commit is contained in:
Peter Clement 2021-10-19 13:01:18 +01:00 committed by GitHub
commit 29f7fa0326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 1 deletions

View File

@ -5,6 +5,7 @@
import RelationshipRenderer from "./RelationshipRenderer.svelte"
import AttachmentRenderer from "./AttachmentRenderer.svelte"
import ArrayRenderer from "./ArrayRenderer.svelte"
import InternalRenderer from "./InternalRenderer.svelte"
export let row
export let schema
@ -22,6 +23,7 @@
number: StringRenderer,
longform: StringRenderer,
array: ArrayRenderer,
internal: InternalRenderer,
}
$: type = schema?.type ?? "string"
$: customRenderer = customRenderers?.find(x => x.column === schema?.name)

View File

@ -20,10 +20,30 @@
$: type = $tables.selected?.type
$: isInternal = type !== "external"
$: schema = $tables.selected?.schema
$: enrichedSchema = enrichSchema($tables.selected?.schema)
$: id = $tables.selected?._id
$: search = searchTable(id)
$: columnOptions = Object.keys($search.schema || {})
const enrichSchema = schema => {
let tempSchema = { ...schema }
tempSchema._id = {
type: "internal",
editable: false,
displayName: "ID",
autocolumn: true,
}
if (isInternal) {
tempSchema._rev = {
type: "internal",
editable: false,
displayName: "Revision",
autocolumn: true,
}
}
return tempSchema
}
// Fetches new data whenever the table changes
const searchTable = tableId => {
return fetchTableData({
@ -66,7 +86,7 @@
<div>
<Table
title={$tables.selected?.name}
{schema}
schema={enrichedSchema}
{type}
tableId={id}
data={$search.rows}

View File

@ -4,10 +4,15 @@ import { get as svelteGet } from "svelte/store"
// currently supported level of relationship depth (server side)
const MAX_DEPTH = 1
//https://github.com/Budibase/budibase/issues/3030
const internalType = "internal"
const TYPES_TO_SKIP = [
FIELDS.FORMULA.type,
FIELDS.LONGFORM.type,
FIELDS.ATTACHMENT.type,
internalType,
]
export function getBindings({
@ -53,6 +58,7 @@ export function getBindings({
const field = Object.values(FIELDS).find(
field => field.type === schema.type
)
const label = path == null ? column : `${path}.0.${column}`
// only supply a description for relationship paths
const description =