1
0
Fork 0
mirror of synced 2024-06-29 11:31:06 +12:00

Adding a few fixes for bugs related to user table, user table views and some async functions that weren't awaiting promises.

This commit is contained in:
mike12345567 2021-02-23 16:29:50 +00:00
parent 1ac43cd252
commit dbd172428e
7 changed files with 21 additions and 13 deletions

View file

@ -289,7 +289,7 @@ export const getFrontendStore = () => {
...extras,
}
},
create: (componentName, presetProps) => {
create: async (componentName, presetProps) => {
const selected = get(selectedComponent)
const asset = get(currentAsset)
const state = get(store)
@ -345,7 +345,7 @@ export const getFrontendStore = () => {
parentComponent._children.push(componentInstance)
// Save components and update UI
store.actions.preview.saveSelected()
await store.actions.preview.saveSelected()
store.update(state => {
state.currentView = "component"
state.selectedComponentId = componentInstance._id
@ -359,7 +359,7 @@ export const getFrontendStore = () => {
return componentInstance
},
delete: component => {
delete: async component => {
if (!component) {
return
}
@ -374,7 +374,7 @@ export const getFrontendStore = () => {
)
store.actions.components.select(parent)
}
store.actions.preview.saveSelected()
await store.actions.preview.saveSelected()
},
copy: (component, cut = false) => {
const selectedAsset = get(currentAsset)
@ -479,7 +479,7 @@ export const getFrontendStore = () => {
selected._styles = { normal: {}, hover: {}, active: {} }
await store.actions.preview.saveSelected()
},
updateProp: (name, value) => {
updateProp: async (name, value) => {
let component = get(selectedComponent)
if (!name || !component) {
return
@ -489,7 +489,7 @@ export const getFrontendStore = () => {
state.selectedComponentId = component._id
return state
})
store.actions.preview.saveSelected()
await store.actions.preview.saveSelected()
},
links: {
save: async (url, title) => {

View file

@ -15,7 +15,7 @@
import TableLoadingOverlay from "./TableLoadingOverlay"
import TableHeader from "./TableHeader"
import "@budibase/svelte-ag-grid/dist/index.css"
import { TableNames } from "constants"
import { TableNames, UNEDITABLE_USER_FIELDS } from "constants"
export let schema = {}
export let data = []
@ -53,6 +53,7 @@
if (isUsersTable) {
schema.email.displayFieldName = "Email"
schema.roleId.displayFieldName = "Role"
schema.status.displayFieldName = "Status"
}
}
@ -83,7 +84,7 @@
if (!allowEditing) {
return false
}
return !(isUsersTable && ["email", "roleId"].includes(key))
return !(isUsersTable && UNEDITABLE_USER_FIELDS.includes(key))
}
for (let [key, value] of Object.entries(schema || {})) {

View file

@ -53,6 +53,7 @@
<Table
title={decodeURI(name)}
schema={view.schema}
tableId={view.tableId}
{data}
{loading}
bind:hideAutocolumns>

View file

@ -168,7 +168,9 @@
</div>
{/if}
<div class="footer">
<div class="add-filter">
<Button text on:click={addFilter}>Add Filter</Button>
</div>
<div class="buttons">
<Button secondary on:click={onClosed}>Cancel</Button>
<Button primary on:click={saveView}>Save</Button>
@ -213,4 +215,8 @@
margin: 0;
font-size: var(--font-size-xs);
}
.add-filter {
margin-right: 16px;
}
</style>

View file

@ -39,14 +39,14 @@
return enrichedStructure
}
const onItemChosen = (item, idx) => {
const onItemChosen = async (item, idx) => {
if (item.isCategory) {
// Select and open this category
selectedIndex = idx
popover.show()
} else {
// Add this component
store.actions.components.create(item.component)
await store.actions.components.create(item.component)
popover.hide()
}
}

View file

@ -64,8 +64,8 @@
pasteComponent("below")
}
const deleteComponent = () => {
store.actions.components.delete(component)
const deleteComponent = async () => {
await store.actions.components.delete(component)
}
const storeComponentForCopy = (cut = false) => {

View file

@ -10,7 +10,7 @@ export const FrontendTypes = {
}
// fields on the user table that cannot be edited
export const UNEDITABLE_USER_FIELDS = ["email", "password", "roleId"]
export const UNEDITABLE_USER_FIELDS = ["email", "password", "roleId", "status"]
export const LAYOUT_NAMES = {
MASTER: {