Browse Source
Merge pull request #3046 from Budibase/fix/copy-id-and-rev
Add back the ability to copy the ID and Revision (safely)
pull/3087/head
Peter Clement
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
29 additions and
1 deletions
-
packages/bbui/src/Table/CellRenderer.svelte
-
packages/builder/src/components/backend/DataTable/DataTable.svelte
-
packages/builder/src/components/backend/DataTable/formula.js
|
|
|
@ -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) |
|
|
|
|
|
|
|
@ -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} |
|
|
|
|
|
|
|
@ -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 = |
|
|
|
|