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:
parent
1ac43cd252
commit
dbd172428e
|
@ -289,7 +289,7 @@ export const getFrontendStore = () => {
|
||||||
...extras,
|
...extras,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
create: (componentName, presetProps) => {
|
create: async (componentName, presetProps) => {
|
||||||
const selected = get(selectedComponent)
|
const selected = get(selectedComponent)
|
||||||
const asset = get(currentAsset)
|
const asset = get(currentAsset)
|
||||||
const state = get(store)
|
const state = get(store)
|
||||||
|
@ -345,7 +345,7 @@ export const getFrontendStore = () => {
|
||||||
parentComponent._children.push(componentInstance)
|
parentComponent._children.push(componentInstance)
|
||||||
|
|
||||||
// Save components and update UI
|
// Save components and update UI
|
||||||
store.actions.preview.saveSelected()
|
await store.actions.preview.saveSelected()
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state.currentView = "component"
|
state.currentView = "component"
|
||||||
state.selectedComponentId = componentInstance._id
|
state.selectedComponentId = componentInstance._id
|
||||||
|
@ -359,7 +359,7 @@ export const getFrontendStore = () => {
|
||||||
|
|
||||||
return componentInstance
|
return componentInstance
|
||||||
},
|
},
|
||||||
delete: component => {
|
delete: async component => {
|
||||||
if (!component) {
|
if (!component) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ export const getFrontendStore = () => {
|
||||||
)
|
)
|
||||||
store.actions.components.select(parent)
|
store.actions.components.select(parent)
|
||||||
}
|
}
|
||||||
store.actions.preview.saveSelected()
|
await store.actions.preview.saveSelected()
|
||||||
},
|
},
|
||||||
copy: (component, cut = false) => {
|
copy: (component, cut = false) => {
|
||||||
const selectedAsset = get(currentAsset)
|
const selectedAsset = get(currentAsset)
|
||||||
|
@ -479,7 +479,7 @@ export const getFrontendStore = () => {
|
||||||
selected._styles = { normal: {}, hover: {}, active: {} }
|
selected._styles = { normal: {}, hover: {}, active: {} }
|
||||||
await store.actions.preview.saveSelected()
|
await store.actions.preview.saveSelected()
|
||||||
},
|
},
|
||||||
updateProp: (name, value) => {
|
updateProp: async (name, value) => {
|
||||||
let component = get(selectedComponent)
|
let component = get(selectedComponent)
|
||||||
if (!name || !component) {
|
if (!name || !component) {
|
||||||
return
|
return
|
||||||
|
@ -489,7 +489,7 @@ export const getFrontendStore = () => {
|
||||||
state.selectedComponentId = component._id
|
state.selectedComponentId = component._id
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
store.actions.preview.saveSelected()
|
await store.actions.preview.saveSelected()
|
||||||
},
|
},
|
||||||
links: {
|
links: {
|
||||||
save: async (url, title) => {
|
save: async (url, title) => {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
import TableLoadingOverlay from "./TableLoadingOverlay"
|
import TableLoadingOverlay from "./TableLoadingOverlay"
|
||||||
import TableHeader from "./TableHeader"
|
import TableHeader from "./TableHeader"
|
||||||
import "@budibase/svelte-ag-grid/dist/index.css"
|
import "@budibase/svelte-ag-grid/dist/index.css"
|
||||||
import { TableNames } from "constants"
|
import { TableNames, UNEDITABLE_USER_FIELDS } from "constants"
|
||||||
|
|
||||||
export let schema = {}
|
export let schema = {}
|
||||||
export let data = []
|
export let data = []
|
||||||
|
@ -53,6 +53,7 @@
|
||||||
if (isUsersTable) {
|
if (isUsersTable) {
|
||||||
schema.email.displayFieldName = "Email"
|
schema.email.displayFieldName = "Email"
|
||||||
schema.roleId.displayFieldName = "Role"
|
schema.roleId.displayFieldName = "Role"
|
||||||
|
schema.status.displayFieldName = "Status"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +84,7 @@
|
||||||
if (!allowEditing) {
|
if (!allowEditing) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return !(isUsersTable && ["email", "roleId"].includes(key))
|
return !(isUsersTable && UNEDITABLE_USER_FIELDS.includes(key))
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let [key, value] of Object.entries(schema || {})) {
|
for (let [key, value] of Object.entries(schema || {})) {
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
<Table
|
<Table
|
||||||
title={decodeURI(name)}
|
title={decodeURI(name)}
|
||||||
schema={view.schema}
|
schema={view.schema}
|
||||||
|
tableId={view.tableId}
|
||||||
{data}
|
{data}
|
||||||
{loading}
|
{loading}
|
||||||
bind:hideAutocolumns>
|
bind:hideAutocolumns>
|
||||||
|
|
|
@ -168,7 +168,9 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
|
<div class="add-filter">
|
||||||
<Button text on:click={addFilter}>Add Filter</Button>
|
<Button text on:click={addFilter}>Add Filter</Button>
|
||||||
|
</div>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<Button secondary on:click={onClosed}>Cancel</Button>
|
<Button secondary on:click={onClosed}>Cancel</Button>
|
||||||
<Button primary on:click={saveView}>Save</Button>
|
<Button primary on:click={saveView}>Save</Button>
|
||||||
|
@ -213,4 +215,8 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: var(--font-size-xs);
|
font-size: var(--font-size-xs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.add-filter {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -39,14 +39,14 @@
|
||||||
return enrichedStructure
|
return enrichedStructure
|
||||||
}
|
}
|
||||||
|
|
||||||
const onItemChosen = (item, idx) => {
|
const onItemChosen = async (item, idx) => {
|
||||||
if (item.isCategory) {
|
if (item.isCategory) {
|
||||||
// Select and open this category
|
// Select and open this category
|
||||||
selectedIndex = idx
|
selectedIndex = idx
|
||||||
popover.show()
|
popover.show()
|
||||||
} else {
|
} else {
|
||||||
// Add this component
|
// Add this component
|
||||||
store.actions.components.create(item.component)
|
await store.actions.components.create(item.component)
|
||||||
popover.hide()
|
popover.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,8 +64,8 @@
|
||||||
pasteComponent("below")
|
pasteComponent("below")
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteComponent = () => {
|
const deleteComponent = async () => {
|
||||||
store.actions.components.delete(component)
|
await store.actions.components.delete(component)
|
||||||
}
|
}
|
||||||
|
|
||||||
const storeComponentForCopy = (cut = false) => {
|
const storeComponentForCopy = (cut = false) => {
|
||||||
|
|
|
@ -10,7 +10,7 @@ export const FrontendTypes = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// fields on the user table that cannot be edited
|
// 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 = {
|
export const LAYOUT_NAMES = {
|
||||||
MASTER: {
|
MASTER: {
|
||||||
|
|
Loading…
Reference in New Issue