From 0439a101a30b893f356cd94cd357991cdcd924f7 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 7 Dec 2020 10:15:27 +0000 Subject: [PATCH 01/39] replace appimage with native linux packages --- packages/server/package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index cb1789c5c9..3f6dba75e7 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -22,8 +22,10 @@ "maintainer": "Budibase", "icon": "./build/icons/", "target": [ - "AppImage", - "deb" + "deb", + "rpm", + "pacman", + "snap" ], "category": "Development" }, From 1188a96877b07e99ffeb6be14838da183c293833 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 14:14:10 +0000 Subject: [PATCH 02/39] Fix crash when adding a link --- packages/standard-components/src/Link.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/standard-components/src/Link.svelte b/packages/standard-components/src/Link.svelte index 705d5051c4..5ae1ae75c4 100644 --- a/packages/standard-components/src/Link.svelte +++ b/packages/standard-components/src/Link.svelte @@ -11,7 +11,7 @@ $: target = openInNewTab ? "_blank" : "_self" - + {text} From 4e748dad2b81309c23eed24c38f59a887f2da05d Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 14:51:42 +0000 Subject: [PATCH 03/39] Fix bugs around selecting screens and layouts when creating them --- .../src/builderStore/store/frontend.js | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 87a46e4a91..f70e5f4d47 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -120,17 +120,13 @@ export const getFrontendStore = () => { state.screens.splice(foundScreen, 1) } state.screens.push(screen) - - if (creatingNewScreen) { - const safeProps = makePropsSafe( - state.components[screen.props._component], - screen.props - ) - state.selectedComponentId = safeProps._id - screen.props = safeProps - } return state }) + + if (creatingNewScreen) { + store.actions.screens.select(screen._id) + } + return screen }, delete: async screens => { @@ -178,28 +174,30 @@ export const getFrontendStore = () => { }, save: async layout => { const layoutToSave = cloneDeep(layout) - + const creatingNewLayout = layoutToSave._id === undefined const response = await api.post(`/api/layouts`, layoutToSave) - - const json = await response.json() + const savedLayout = await response.json() store.update(state => { const layoutIdx = state.layouts.findIndex( - stateLayout => stateLayout._id === json._id + stateLayout => stateLayout._id === savedLayout._id ) - if (layoutIdx >= 0) { // update existing layout - state.layouts.splice(layoutIdx, 1, json) + state.layouts.splice(layoutIdx, 1, savedLayout) } else { // save new layout - state.layouts.push(json) + state.layouts.push(savedLayout) } - - state.currentAssetId = json._id - state.selectedComponentId = json.props._id return state }) + + // Select layout if creating a new one + if (creatingNewLayout) { + store.actions.layouts.select(savedLayout._id) + } + + return savedLayout }, find: layoutId => { if (!layoutId) { @@ -450,7 +448,6 @@ export const getFrontendStore = () => { // Save layout nav._children = [...nav._children, newLink] - state.currentAssetId = layout._id promises.push(store.actions.layouts.save(layout)) } return state From 660345313c9d6ef8e69b791e5431ec340b585a96 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 14:53:03 +0000 Subject: [PATCH 04/39] Navigate to new layout after creating it --- .../src/components/userInterface/NewLayoutModal.svelte | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/components/userInterface/NewLayoutModal.svelte b/packages/builder/src/components/userInterface/NewLayoutModal.svelte index e1cdc4af29..dbc9e3dc7a 100644 --- a/packages/builder/src/components/userInterface/NewLayoutModal.svelte +++ b/packages/builder/src/components/userInterface/NewLayoutModal.svelte @@ -1,19 +1,15 @@ @@ -113,14 +112,18 @@ {/each} {/if} - - - + {#if roles.length} + + {/if} From b842a2addc4972390d993466ca254a5ec59ca29b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 15:35:57 +0000 Subject: [PATCH 06/39] Cache roles in store and add role selector for screens --- .../builder/src/builderStore/store/backend.js | 21 ++++++++++ .../backend/DataTable/cells/RoleCell.svelte | 40 ++----------------- .../DataTable/modals/CreateEditUser.svelte | 36 +++++------------ .../backend/DataTable/modals/EditRoles.svelte | 26 +++++------- .../userInterface/NewScreenModal.svelte | 20 +++------- .../userInterface/RoleSelect.svelte | 15 +++++++ .../userInterface/SettingsView.svelte | 3 +- .../src/pages/[application]/_reset.svelte | 1 + 8 files changed, 70 insertions(+), 92 deletions(-) create mode 100644 packages/builder/src/components/userInterface/RoleSelect.svelte diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 3cdabf1ed5..5592488590 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -6,6 +6,7 @@ const INITIAL_BACKEND_UI_STATE = { tables: [], views: [], users: [], + roles: [], selectedDatabase: {}, selectedTable: {}, draftTable: {}, @@ -177,6 +178,26 @@ export const getBackendUiStore = () => { return state }), }, + roles: { + fetch: async () => { + const response = await api.get("/api/roles") + const roles = await response.json() + store.update(state => { + state.roles = roles + return state + }) + }, + delete: async role => { + const response = await api.delete(`/api/roles/${role._id}/${role._rev}`) + await store.actions.roles.fetch() + return response + }, + save: async role => { + const response = await api.post("/api/roles", role) + await store.actions.roles.fetch() + return response + }, + }, } return store diff --git a/packages/builder/src/components/backend/DataTable/cells/RoleCell.svelte b/packages/builder/src/components/backend/DataTable/cells/RoleCell.svelte index c6f6cbbcdf..a45f376a3e 100644 --- a/packages/builder/src/components/backend/DataTable/cells/RoleCell.svelte +++ b/packages/builder/src/components/backend/DataTable/cells/RoleCell.svelte @@ -1,42 +1,10 @@ - - -
{roleName}
diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte index bde6514f8f..aac515e74b 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte @@ -1,18 +1,14 @@ - {#if rolesLoaded} - - {/if} + {#each customSchemaKeys as [key, meta]} {/each} diff --git a/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte b/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte index 627112d87c..3b97f6d61b 100644 --- a/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte @@ -4,27 +4,26 @@ import api from "builderStore/api" import { notifier } from "builderStore/store/notifications" import ErrorsBox from "components/common/ErrorsBox.svelte" + import { backendUiStore } from "builderStore" - let roles = [] let permissions = [] let selectedRole = {} let errors = [] $: selectedRoleId = selectedRole._id - $: otherRoles = roles.filter(role => role._id !== selectedRoleId) + $: otherRoles = $backendUiStore.roles.filter( + role => role._id !== selectedRoleId + ) $: isCreating = selectedRoleId == null || selectedRoleId === "" - // Loads available roles and permissions from the server - const fetchRoles = async () => { - const rolesResponse = await api.get("/api/roles") - roles = await rolesResponse.json() + const fetchPermissions = async () => { const permissionsResponse = await api.get("/api/permissions") permissions = await permissionsResponse.json() } - // Changes the seleced role + // Changes the selected role const changeRole = event => { const id = event?.target?.value - const role = roles.find(role => role._id === id) + const role = $backendUiStore.roles.find(role => role._id === id) if (role) { selectedRole = { ...role, @@ -61,7 +60,7 @@ } // Save/create the role - const response = await api.post("/api/roles", selectedRole) + const response = await backendUiStore.actions.roles.save(selectedRole) if (response.status === 200) { notifier.success("Role saved successfully.") } else { @@ -72,11 +71,8 @@ // Deletes the selected role const deleteRole = async () => { - const response = await api.delete( - `/api/roles/${selectedRole._id}/${selectedRole._rev}` - ) + const response = await backendUiStore.actions.roles.delete(selectedRole) if (response.status === 200) { - await fetchRoles() changeRole() notifier.success("Role deleted successfully.") } else { @@ -84,7 +80,7 @@ } } - onMount(fetchRoles) + onMount(fetchPermissions) - {#each roles as role} + {#each $backendUiStore.roles as role} {/each} diff --git a/packages/builder/src/components/userInterface/NewScreenModal.svelte b/packages/builder/src/components/userInterface/NewScreenModal.svelte index 4a5186adc0..8d7271601a 100644 --- a/packages/builder/src/components/userInterface/NewScreenModal.svelte +++ b/packages/builder/src/components/userInterface/NewScreenModal.svelte @@ -15,7 +15,6 @@ let templateIndex let draftScreen let createLink = true - let roles = [] let roleId = "BASIC" $: templates = getTemplates($store, $backendUiStore.tables) @@ -30,11 +29,6 @@ } } - const fetchRoles = async () => { - const response = await api.get("/api/roles") - roles = await response.json() - } - const templateChanged = newTemplateIndex => { if (newTemplateIndex === undefined) return const template = templates[newTemplateIndex] @@ -96,8 +90,6 @@ route = "/" + event.target.value } } - - onMount(fetchRoles) @@ -118,12 +110,10 @@ error={routeError} bind:value={route} on:change={routeChanged} /> - {#if roles.length} - - {/if} + diff --git a/packages/builder/src/components/userInterface/RoleSelect.svelte b/packages/builder/src/components/userInterface/RoleSelect.svelte new file mode 100644 index 0000000000..e49222d2c0 --- /dev/null +++ b/packages/builder/src/components/userInterface/RoleSelect.svelte @@ -0,0 +1,15 @@ + + + diff --git a/packages/builder/src/components/userInterface/SettingsView.svelte b/packages/builder/src/components/userInterface/SettingsView.svelte index f90e071b08..eee50d8cf6 100644 --- a/packages/builder/src/components/userInterface/SettingsView.svelte +++ b/packages/builder/src/components/userInterface/SettingsView.svelte @@ -4,6 +4,7 @@ import { FrontendTypes } from "constants" import PropertyControl from "./PropertyControl.svelte" import LayoutSelect from "./LayoutSelect.svelte" + import RoleSelect from "./RoleSelect.svelte" import Input from "./PropertyPanelControls/Input.svelte" import { excludeProps } from "./propertyCategories.js" import { store, allScreens, currentAsset } from "builderStore" @@ -36,8 +37,8 @@ const screenDefinition = [ { key: "description", label: "Description", control: Input }, { key: "routing.route", label: "Route", control: Input }, + { key: "routing.roleId", label: "Access", control: RoleSelect }, { key: "layoutId", label: "Layout", control: LayoutSelect }, - { key: "routing.roleId", label: "Role", control: Input }, ] const layoutDefinition = [{ key: "title", label: "Title", control: Input }] diff --git a/packages/builder/src/pages/[application]/_reset.svelte b/packages/builder/src/pages/[application]/_reset.svelte index a6f7e86454..e1daf7da1d 100644 --- a/packages/builder/src/pages/[application]/_reset.svelte +++ b/packages/builder/src/pages/[application]/_reset.svelte @@ -20,6 +20,7 @@ backendUiStore.actions.reset() await store.actions.initialise(pkg) await automationStore.actions.fetch() + await backendUiStore.actions.roles.fetch() return pkg } else { throw new Error(pkg) From 80e1c4f97887e861f879fc22bac14aa3d772a968 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 15:42:44 +0000 Subject: [PATCH 07/39] Fix z index in beta warning --- packages/builder/src/pages/[application]/_reset.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/builder/src/pages/[application]/_reset.svelte b/packages/builder/src/pages/[application]/_reset.svelte index e1daf7da1d..74367c794d 100644 --- a/packages/builder/src/pages/[application]/_reset.svelte +++ b/packages/builder/src/pages/[application]/_reset.svelte @@ -218,5 +218,6 @@ position: absolute; bottom: var(--spacing-m); left: var(--spacing-m); + z-index: 1; } From c0c2583e093102603bd1410327ecf0e4dbe34f36 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 15:43:06 +0000 Subject: [PATCH 08/39] Force white background behind prevrew iframe regardless of theme to better reflect what the real app will look like --- .../userInterface/AppPreview/CurrentItemPreview.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte b/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte index ccb0153e45..0c0fa6156f 100644 --- a/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte +++ b/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte @@ -84,6 +84,7 @@ overflow: hidden; margin: auto; height: 100%; + background-color: white; } .component-container iframe { border: 0; From e0d902d27927eb4d929968c65e06c82dcfd1114d Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 15:58:34 +0000 Subject: [PATCH 09/39] Fix merge bug --- packages/builder/src/builderStore/store/frontend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index e857689eba..c4d9ed6503 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -88,7 +88,7 @@ export const getFrontendStore = () => { const screen = get(allScreens).find(screen => screen._id === screenId) if (!screen) return state state.currentFrontEndType = FrontendTypes.SCREEN - state.currentAssetId = selectedScreen._id + state.currentAssetId = screen._id state.currentView = "detail" state.selectedComponentId = screen.props?._id return state From 248a1f456f49c72558d51c00ad1d99221a015850 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 16:01:16 +0000 Subject: [PATCH 10/39] Fix empty screen list when deleting a table backing an autoscreen which is currently selected --- packages/builder/src/builderStore/store/frontend.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index c4d9ed6503..a853a98dce 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -85,7 +85,9 @@ export const getFrontendStore = () => { screens: { select: screenId => { store.update(state => { - const screen = get(allScreens).find(screen => screen._id === screenId) + let screens = get(allScreens) + let screen = + screens.find(screen => screen._id === screenId) || screens[0] if (!screen) return state state.currentFrontEndType = FrontendTypes.SCREEN state.currentAssetId = screen._id From e5a34871c7eb1fe01a226a0d50c75f83af7be497 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 18:18:47 +0000 Subject: [PATCH 11/39] Add role selection for viewing screens and smart handling of preview screen --- packages/builder/src/builderStore/index.js | 4 +- .../src/builderStore/store/frontend.js | 1 + .../ComponentNavigationTree/PathTree.svelte | 2 + .../ComponentNavigationTree/index.svelte | 65 +++++++++++++++++-- .../userInterface/FrontendNavigatePane.svelte | 30 +++++++-- .../components/userInterface/Layout.svelte | 3 +- .../userInterface/NewScreenModal.svelte | 2 +- 7 files changed, 96 insertions(+), 11 deletions(-) diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index 887ef733e4..f1914efab2 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -2,7 +2,7 @@ import { getFrontendStore } from "./store/frontend" import { getBackendUiStore } from "./store/backend" import { getAutomationStore } from "./store/automation/" import { getThemeStore } from "./store/theme" -import { derived } from "svelte/store" +import { derived, writable } from "svelte/store" import analytics from "analytics" import { LAYOUT_NAMES } from "../constants" import { makePropsSafe } from "components/userInterface/assetParsing/createProps" @@ -74,6 +74,8 @@ export const mainLayout = derived(store, $store => { ) }) +export const selectedAccessRole = writable("BASIC") + export const initialise = async () => { try { await analytics.activate() diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index a853a98dce..754cd6e127 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -110,6 +110,7 @@ export const getFrontendStore = () => { const creatingNewScreen = screen._id === undefined const response = await api.post(`/api/screens`, screen) screen = await response.json() + await store.actions.routing.fetch() store.update(state => { const foundScreen = state.screens.findIndex( diff --git a/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte b/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte index 765041b184..5dd4ed9a7c 100644 --- a/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte +++ b/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte @@ -20,6 +20,7 @@ export let route export let path export let indent + export let border $: selectedScreen = $currentAsset @@ -34,6 +35,7 @@ icon="ri-folder-line" text={path} opened={true} + {border} withArrow={route.subpaths} /> {#each Object.entries(route.subpaths) as [url, subpath]} diff --git a/packages/builder/src/components/userInterface/ComponentNavigationTree/index.svelte b/packages/builder/src/components/userInterface/ComponentNavigationTree/index.svelte index 9528b2844c..a88c6feb34 100644 --- a/packages/builder/src/components/userInterface/ComponentNavigationTree/index.svelte +++ b/packages/builder/src/components/userInterface/ComponentNavigationTree/index.svelte @@ -1,12 +1,69 @@
- {#each paths as path} - + {#each paths as path, idx} + 0} {path} route={routes[path]} /> {/each} + + {#if !paths.length} +
+ There aren't any screens configured with this access role. +
+ {/if}
+ + diff --git a/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte b/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte index 23d2e6cf1a..25f939d2f1 100644 --- a/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte +++ b/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte @@ -1,13 +1,18 @@ From 7768b9ace8fe9baf60daf00bb24e44e29949f8bf Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 18:39:49 +0000 Subject: [PATCH 12/39] Allow multiple screens to have the same URL as long as role is different --- .../components/userInterface/NewScreenModal.svelte | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/components/userInterface/NewScreenModal.svelte b/packages/builder/src/components/userInterface/NewScreenModal.svelte index d7e65a84b2..db9181b1bd 100644 --- a/packages/builder/src/components/userInterface/NewScreenModal.svelte +++ b/packages/builder/src/components/userInterface/NewScreenModal.svelte @@ -48,10 +48,10 @@ const save = async () => { if (!route) { - routeError = "Url is required" + routeError = "URL is required" } else { - if (routeNameExists(route)) { - routeError = "This url is already taken" + if (routeExists(route, roleId)) { + routeError = "This URL is already taken for this access role" } else { routeError = "" } @@ -79,9 +79,11 @@ $goto(`./${createdScreen._id}`) } - const routeNameExists = route => { + const routeExists = (route, roleId) => { return $allScreens.some( - screen => screen.routing.route.toLowerCase() === route.toLowerCase() + screen => + screen.routing.route.toLowerCase() === route.toLowerCase() && + screen.routing.roleId === roleId ) } From 01ee1a1145cf50369970681e09fb8c974339d53a Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 18:41:18 +0000 Subject: [PATCH 13/39] Reduce nav item selected state border radius slightly --- packages/builder/src/components/common/NavItem.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/common/NavItem.svelte b/packages/builder/src/components/common/NavItem.svelte index 5b1ede4394..8eca07b1b0 100644 --- a/packages/builder/src/components/common/NavItem.svelte +++ b/packages/builder/src/components/common/NavItem.svelte @@ -61,7 +61,7 @@ } .nav-item:hover, .nav-item.selected { - border-radius: var(--border-radius-m); + border-radius: var(--border-radius-s); } .content { From 48a1932bc37a6d7b9dbaf621729aa5d7d1f76e0a Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 18:56:54 +0000 Subject: [PATCH 14/39] Lint --- packages/builder/src/builderStore/store/frontend.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 754cd6e127..280af804cb 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -3,7 +3,6 @@ import { cloneDeep } from "lodash/fp" import { createProps, getBuiltin, - makePropsSafe, } from "components/userInterface/assetParsing/createProps" import { allScreens, From 8022fc12300c86bbf45bf78374e84bcf6e09ba6b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Dec 2020 19:04:46 +0000 Subject: [PATCH 15/39] Select new role when creating screen with a different role than the selected one --- packages/builder/src/builderStore/store/frontend.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 280af804cb..dc6706373a 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -10,6 +10,7 @@ import { currentAsset, mainLayout, selectedComponent, + selectedAccessRole, } from "builderStore" import { fetchComponentLibDefinitions } from "../loadComponentLibraries" import api from "../api" @@ -88,6 +89,11 @@ export const getFrontendStore = () => { let screen = screens.find(screen => screen._id === screenId) || screens[0] if (!screen) return state + + // Update role to the screen's role setting so that it will always + // be visible + selectedAccessRole.set(screen.routing.roleId) + state.currentFrontEndType = FrontendTypes.SCREEN state.currentAssetId = screen._id state.currentView = "detail" From 2a55f2abf2eef423c77eb147a796ef7dbc6c3205 Mon Sep 17 00:00:00 2001 From: Joe <49767913+joebudi@users.noreply.github.com> Date: Thu, 10 Dec 2020 11:11:53 +0000 Subject: [PATCH 16/39] Text changed Changing 'Invalid chart options' to 'Use the settings panel to build your chart'. I feel this is more appropriate. --- packages/standard-components/src/Card.svelte | 12 ++++++++++-- .../standard-components/src/CardHorizontal.svelte | 14 +++++++++++--- .../src/charts/ApexChart.svelte | 4 +++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/packages/standard-components/src/Card.svelte b/packages/standard-components/src/Card.svelte index e8248b7a01..74121590e3 100644 --- a/packages/standard-components/src/Card.svelte +++ b/packages/standard-components/src/Card.svelte @@ -29,11 +29,19 @@ class="container" use:styleable={$component.styles} style="--cardWidth: {cardWidth}"> - {#if showImage}{/if} + {#if showImage} + + {/if}

{heading}

{description}

- {linkText} + {linkText}
diff --git a/packages/standard-components/src/CardHorizontal.svelte b/packages/standard-components/src/CardHorizontal.svelte index f0741fd7de..5d7596e296 100644 --- a/packages/standard-components/src/CardHorizontal.svelte +++ b/packages/standard-components/src/CardHorizontal.svelte @@ -24,15 +24,23 @@ use:styleable={$component.styles} class="container" style="--cardWidth: {cardWidth}"> - {#if showImage}{/if} + {#if showImage} + + {/if}

{heading}

{description}

-
diff --git a/packages/standard-components/src/charts/ApexChart.svelte b/packages/standard-components/src/charts/ApexChart.svelte index 88719ecddb..0c2e1b0e41 100644 --- a/packages/standard-components/src/charts/ApexChart.svelte +++ b/packages/standard-components/src/charts/ApexChart.svelte @@ -11,7 +11,9 @@ {#if options}
{:else if options === false} -
Invalid chart options
+
+ Use the settings panel to build your chart --> +
{/if} diff --git a/packages/builder/yarn.lock b/packages/builder/yarn.lock index 7f650a83bc..f2f7363669 100644 --- a/packages/builder/yarn.lock +++ b/packages/builder/yarn.lock @@ -842,10 +842,10 @@ lodash "^4.17.19" to-fast-properties "^2.0.0" -"@budibase/bbui@^1.52.2": - version "1.52.2" - resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.52.2.tgz#a0774880fb755eb81c762bc355550af7f4562b09" - integrity sha512-PxiN5xvr+Z/RpypMDYh3lNhCUnejH1moMoWW7PiuCiho5VXGauR+M8T49p5eTKoFSqRMC7BUdFJJ9ye/cnQxNA== +"@budibase/bbui@^1.52.4": + version "1.52.4" + resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.52.4.tgz#ae3c17e1f49f14e65831703958bcddc6e64afd24" + integrity sha512-/wiv5dSyvXLgy2/zGEslnCsjwE8qqng1D8k5ScSOPEyMab8tzzd1XxfZAN9rp84zIMgAXeH6s5a4j4riR+jVkg== dependencies: markdown-it "^12.0.2" quill "^1.3.7" From 17dd8abf58d44e397cf7900ef8114da4ab91f349 Mon Sep 17 00:00:00 2001 From: kevmodrome Date: Wed, 16 Dec 2020 15:22:31 +0100 Subject: [PATCH 34/39] lint fix --- packages/builder/src/analytics.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/analytics.js b/packages/builder/src/analytics.js index 10d67addb3..f59d71ac30 100644 --- a/packages/builder/src/analytics.js +++ b/packages/builder/src/analytics.js @@ -45,17 +45,16 @@ async function identifyByApiKey(apiKey) { ) if (response.status === 200) { const id = await response.json() - + await api.put("/api/keys/userId", { value: id }) identify(id) return true } - + return false } catch (error) { console.log(error) } - } function captureException(err) { From b7d7968009017c533c98047a001937b52fc84138 Mon Sep 17 00:00:00 2001 From: kevmodrome Date: Wed, 16 Dec 2020 15:31:20 +0100 Subject: [PATCH 35/39] add back accidently removed line of code --- packages/builder/src/components/start/CreateAppModal.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/builder/src/components/start/CreateAppModal.svelte b/packages/builder/src/components/start/CreateAppModal.svelte index 184eaeb2d6..b88397b6c4 100644 --- a/packages/builder/src/components/start/CreateAppModal.svelte +++ b/packages/builder/src/components/start/CreateAppModal.svelte @@ -27,6 +27,7 @@ // make sure we only fetch once, unless API Key is changed if (isApiKeyValid === undefined || apiKey !== lastApiKey) { + lastApiKey = apiKey // svelte reactivity was causing a requst to get fired mutiple times // so, we make everything await the same promise, if one exists if (!fetchApiKeyPromise) { From b3497d3846bce5cd9045d67acd0a072758deae24 Mon Sep 17 00:00:00 2001 From: kevmodrome Date: Fri, 18 Dec 2020 11:10:36 +0100 Subject: [PATCH 36/39] fixes encoding issue of file to work with non-english chars --- .../components/backend/TableNavigator/TableDataImport.svelte | 4 +++- packages/server/src/utilities/tests/test.csv | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte b/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte index d328df4b40..f7b612b296 100644 --- a/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte +++ b/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte @@ -18,6 +18,7 @@ let schema = {} let fields = [] + $: console.log(files[0]) $: valid = !schema || fields.every(column => schema[column].success) $: dataImport = { valid, @@ -43,6 +44,7 @@ } async function validateCSV() { + console.log(csvString) const response = await api.post("/api/tables/csv/validate", { csvString, schema: schema || {}, @@ -82,7 +84,7 @@ files = fileArray validateCSV() }) - reader.readAsBinaryString(fileArray[0]) + reader.readAsText(fileArray[0]) } async function omitColumn(columnName) { diff --git a/packages/server/src/utilities/tests/test.csv b/packages/server/src/utilities/tests/test.csv index 2266b348cd..2a193e4df2 100644 --- a/packages/server/src/utilities/tests/test.csv +++ b/packages/server/src/utilities/tests/test.csv @@ -1,4 +1,4 @@ "Name","Age","Address" -"Bert","4324","5 Sesame Street" +"Bertå","4324","5 Sesame Street" "Ernie","34","1 World Trade Center" "Big Bird","23423","44 Second Avenue" \ No newline at end of file From 55e364071f531e0c9faceec5de07cdbd1f554c9b Mon Sep 17 00:00:00 2001 From: kevmodrome Date: Fri, 18 Dec 2020 11:12:00 +0100 Subject: [PATCH 37/39] remove console logs --- .../components/backend/TableNavigator/TableDataImport.svelte | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte b/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte index f7b612b296..810d7960f5 100644 --- a/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte +++ b/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte @@ -18,7 +18,6 @@ let schema = {} let fields = [] - $: console.log(files[0]) $: valid = !schema || fields.every(column => schema[column].success) $: dataImport = { valid, @@ -44,7 +43,6 @@ } async function validateCSV() { - console.log(csvString) const response = await api.post("/api/tables/csv/validate", { csvString, schema: schema || {}, From 67d98119b546e0d6847a741586d7ab6081b5ae12 Mon Sep 17 00:00:00 2001 From: kevmodrome Date: Fri, 18 Dec 2020 11:20:25 +0100 Subject: [PATCH 38/39] updates test --- packages/server/src/utilities/tests/csvParser.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/utilities/tests/csvParser.spec.js b/packages/server/src/utilities/tests/csvParser.spec.js index 5fc4a9ffe3..48e275fdd1 100644 --- a/packages/server/src/utilities/tests/csvParser.spec.js +++ b/packages/server/src/utilities/tests/csvParser.spec.js @@ -89,7 +89,7 @@ describe("CSV Parser", () => { }) ).toEqual([ { - Name: "Bert", + Name: "Bertå", }, { Name: "Ernie", From b6974cba0878f4e23180362872dbd68950a908e2 Mon Sep 17 00:00:00 2001 From: kevmodrome Date: Fri, 18 Dec 2020 11:29:26 +0100 Subject: [PATCH 39/39] update test snapshot --- .../src/utilities/tests/__snapshots__/csvParser.spec.js.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/utilities/tests/__snapshots__/csvParser.spec.js.snap b/packages/server/src/utilities/tests/__snapshots__/csvParser.spec.js.snap index 1966637f56..3c532413fa 100644 --- a/packages/server/src/utilities/tests/__snapshots__/csvParser.spec.js.snap +++ b/packages/server/src/utilities/tests/__snapshots__/csvParser.spec.js.snap @@ -5,7 +5,7 @@ Array [ Object { "Address": "5 Sesame Street", "Age": 4324, - "Name": "Bert", + "Name": "Bertå", }, Object { "Address": "1 World Trade Center",