Merge pull request #551 from Budibase/backendbugs

renaming bug
This commit is contained in:
Martin McKeaveney 2020-08-21 10:18:05 +01:00 committed by GitHub
commit 1a45fd2110
3 changed files with 13 additions and 7 deletions

View File

@ -38,10 +38,10 @@ context('Create a Table', () => {
it('edits a record', () => {
cy.get("tbody .ri-more-line").click()
cy.get("[data-cy=edit-row]").click()
cy.get(".actions input").type("updatedRecord")
cy.get(".actions input").type("Updated")
cy.contains("Save").click()
cy.contains('updatedRecord').should('have.text', 'updatedRecord')
cy.contains('RoverUpdated').should('have.text', 'RoverUpdated')
})
it('deletes a record', () => {
@ -49,7 +49,7 @@ context('Create a Table', () => {
cy.get("[data-cy=delete-row]").click()
cy.get(".modal-actions").contains("Delete").click()
cy.contains('updatedRecord').should('not.exist')
cy.contains('RoverUpdated').should('not.exist')
})
it('deletes a column', () => {

View File

@ -93,7 +93,13 @@ export const getBackendUiStore = () => {
saveField: ({ originalName, field }) => {
store.update(state => {
// delete the original if renaming
delete state.draftModel.schema[originalName]
if (originalName) {
delete state.draftModel.schema[originalName]
state.draftModel._rename = {
old: originalName,
updated: field.name,
}
}
state.draftModel.schema[field.name] = cloneDeep(field)

View File

@ -45,9 +45,9 @@
$: sort = $backendUiStore.sort
$: sorted = sort ? fsort(data)[sort.direction](sort.column) : data
$: headers = Object.keys($backendUiStore.selectedModel.schema).filter(
id => !INTERNAL_HEADERS.includes(id)
)
$: headers = Object.keys($backendUiStore.selectedModel.schema)
.sort()
.filter(id => !INTERNAL_HEADERS.includes(id))
$: schema = $backendUiStore.selectedModel.schema
</script>