Skip to content

Commit

Permalink
fix: editing table identifier template (#1516)
Browse files Browse the repository at this point in the history
* fix: editing table identifier template

* Update dull-coins-thank.md
  • Loading branch information
tpluscode authored May 21, 2024
1 parent 4a9a139 commit 5b45771
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 33 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-kids-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-creator/ui": patch
---

CSV mapping: Removed the default value of the identifier field. Fixes #1494
5 changes: 5 additions & 0 deletions .changeset/dull-coins-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-creator/ui": patch
---

CSV mapping: it was impossible to save an existing table with auto-generated identifier. Fixes #1373
5 changes: 1 addition & 4 deletions apis/core/lib/domain/table/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 0 additions & 29 deletions ui/src/forms/editors/IdentifierTemplateEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ export default defineComponent({
type: Object as PropType<Term>,
default: undefined,
},
autoPrefill: {
type: Boolean,
// TODO: Should only be true on table creation
default: true,
},
},
emits: ['input'],
Expand Down Expand Up @@ -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()
}
},
})
</script>

0 comments on commit 5b45771

Please sign in to comment.