From 5b45771c2ab3de3d9fd84ea5221f0c125a2e9831 Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Tue, 21 May 2024 09:38:58 +0200 Subject: [PATCH] fix: editing table identifier template (#1516) * fix: editing table identifier template * Update dull-coins-thank.md --- .changeset/dirty-kids-joke.md | 5 ++++ .changeset/dull-coins-thank.md | 5 ++++ apis/core/lib/domain/table/update.ts | 5 +--- .../editors/IdentifierTemplateEditor.vue | 29 ------------------- 4 files changed, 11 insertions(+), 33 deletions(-) create mode 100644 .changeset/dirty-kids-joke.md create mode 100644 .changeset/dull-coins-thank.md diff --git a/.changeset/dirty-kids-joke.md b/.changeset/dirty-kids-joke.md new file mode 100644 index 000000000..5a569dc23 --- /dev/null +++ b/.changeset/dirty-kids-joke.md @@ -0,0 +1,5 @@ +--- +"@cube-creator/ui": patch +--- + +CSV mapping: Removed the default value of the identifier field. Fixes #1494 diff --git a/.changeset/dull-coins-thank.md b/.changeset/dull-coins-thank.md new file mode 100644 index 000000000..b0bdec373 --- /dev/null +++ b/.changeset/dull-coins-thank.md @@ -0,0 +1,5 @@ +--- +"@cube-creator/ui": patch +--- + +CSV mapping: it was impossible to save an existing table with auto-generated identifier. Fixes #1373 diff --git a/apis/core/lib/domain/table/update.ts b/apis/core/lib/domain/table/update.ts index 3063e6b9f..5af34d807 100644 --- a/apis/core/lib/domain/table/update.ts +++ b/apis/core/lib/domain/table/update.ts @@ -44,12 +44,9 @@ export async function updateTable({ table.color = color.value const identifierTemplate = resource.out(cc.identifierTemplate) - if (!identifierTemplate?.value) { - throw new Error('cc.identifierTemplate missing from the payload') - } if (identifierTemplate.value !== table.identifierTemplate) { - table.identifierTemplate = identifierTemplate.value + table.identifierTemplate = identifierTemplate.value || '' const csvSource = await store.getResource(table.csvSource) const columns = table.parsedTemplate.columnNames diff --git a/ui/src/forms/editors/IdentifierTemplateEditor.vue b/ui/src/forms/editors/IdentifierTemplateEditor.vue index fe623a0b5..4c877dee2 100644 --- a/ui/src/forms/editors/IdentifierTemplateEditor.vue +++ b/ui/src/forms/editors/IdentifierTemplateEditor.vue @@ -49,11 +49,6 @@ export default defineComponent({ type: Object as PropType, default: undefined, }, - autoPrefill: { - type: Boolean, - // TODO: Should only be true on table creation - default: true, - }, }, emits: ['input'], @@ -150,30 +145,6 @@ export default defineComponent({ return newValue }, - - prefill (): void { - if (this.wasModified) return - - if (!this.tableName) return - - const prefix = this.tableName.split(' ').join('') - const prefillValue = !this.isObservationTable - ? `${prefix}/{REPLACE}` - : '' - - this.update(prefillValue) - this.$emit('input', prefillValue) - }, - }, - - watch: { - tableName () { - this.prefill() - }, - - isObservationTable () { - this.prefill() - } }, })