From dbd172428e79b83131b9bc264becf7284710f29f Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 23 Feb 2021 16:29:50 +0000 Subject: [PATCH 1/3] Adding a few fixes for bugs related to user table, user table views and some async functions that weren't awaiting promises. --- packages/builder/src/builderStore/store/frontend.js | 12 ++++++------ .../src/components/backend/DataTable/Table.svelte | 5 +++-- .../backend/DataTable/ViewDataTable.svelte | 1 + .../backend/DataTable/popovers/FilterPopover.svelte | 6 ++++++ .../design/AppPreview/ComponentSelectionList.svelte | 4 ++-- .../NavigationPanel/ComponentDropdownMenu.svelte | 4 ++-- packages/builder/src/constants/index.js | 2 +- 7 files changed, 21 insertions(+), 13 deletions(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 27427c6ef0..d0d1f69793 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -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) => { diff --git a/packages/builder/src/components/backend/DataTable/Table.svelte b/packages/builder/src/components/backend/DataTable/Table.svelte index fa04829634..1878e63b02 100644 --- a/packages/builder/src/components/backend/DataTable/Table.svelte +++ b/packages/builder/src/components/backend/DataTable/Table.svelte @@ -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 || {})) { diff --git a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte index 4ac5ec80a8..365f9aee9e 100644 --- a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte @@ -53,6 +53,7 @@ diff --git a/packages/builder/src/components/backend/DataTable/popovers/FilterPopover.svelte b/packages/builder/src/components/backend/DataTable/popovers/FilterPopover.svelte index 871b1a699e..7bbaf52f17 100644 --- a/packages/builder/src/components/backend/DataTable/popovers/FilterPopover.svelte +++ b/packages/builder/src/components/backend/DataTable/popovers/FilterPopover.svelte @@ -168,7 +168,9 @@ {/if}