Merge branch 'more-bug-fixes' of github.com:Budibase/budibase into screen-updates

This commit is contained in:
Andrew Kingston 2020-10-14 20:16:01 +01:00
commit 90e46ab254
3 changed files with 17 additions and 3 deletions

View File

@ -94,7 +94,8 @@ export const getBackendUiStore = () => {
saveField: ({ originalName, field, primaryDisplay = false }) => {
store.update(state => {
// delete the original if renaming
if (originalName) {
// need to handle if the column had no name, empty string
if (originalName || originalName === "") {
delete state.draftTable.schema[originalName]
state.draftTable._rename = {
old: originalName,

View File

@ -43,7 +43,11 @@
function sort(direction, column) {
backendUiStore.update(state => {
state.sort = { direction, column }
if (direction !== "none") {
state.sort = {direction, column}
} else {
state.sort = undefined
}
return state
})
hideEditor()
@ -70,6 +74,12 @@
<Icon name="delete" />
Delete
</li>
{#if sortDirection === 'desc' || sortDirection === 'asc'}
<li on:click={() => sort('none', field.name)}>
<Icon name="close" />
Remove sort
</li>
{/if}
{#if sortDirection === 'desc' || sortColumn !== field.name}
<li on:click={() => sort('asc', field.name)}>
<Icon name="sortascending" />

View File

@ -36,7 +36,10 @@ exports.save = async function(ctx) {
let renameDocs = []
// if the table obj had an _id then it will have been retrieved
const oldTable = ctx.preExisting
let oldTable
if (ctx.request.body && ctx.request.body._id) {
oldTable = await db.get(ctx.request.body._id)
}
// Don't rename if the name is the same
let { _rename } = tableToSave