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 }) => { saveField: ({ originalName, field, primaryDisplay = false }) => {
store.update(state => { store.update(state => {
// delete the original if renaming // 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] delete state.draftTable.schema[originalName]
state.draftTable._rename = { state.draftTable._rename = {
old: originalName, old: originalName,

View File

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

View File

@ -36,7 +36,10 @@ exports.save = async function(ctx) {
let renameDocs = [] let renameDocs = []
// if the table obj had an _id then it will have been retrieved // 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 // Don't rename if the name is the same
let { _rename } = tableToSave let { _rename } = tableToSave