From 38e052c429ddda4f74ac08e19bfec9817438741d Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Wed, 14 Oct 2020 20:48:24 +0100 Subject: [PATCH 01/22] sort screens alphabetically --- .../userInterface/ComponentsHierarchy.svelte | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/components/userInterface/ComponentsHierarchy.svelte b/packages/builder/src/components/userInterface/ComponentsHierarchy.svelte index 74ec5694cd..8393299b12 100644 --- a/packages/builder/src/components/userInterface/ComponentsHierarchy.svelte +++ b/packages/builder/src/components/userInterface/ComponentsHierarchy.svelte @@ -11,6 +11,9 @@ export let screens = [] + $: sortedScreens = screens.sort( + (s1, s2) => s1.props._instanceName > s2.props._instanceName + ) /* Using a store here seems odd.... have a look in the code file to find out why. @@ -24,12 +27,15 @@ const joinPath = join("/") const normalizedName = name => - pipe(name, [ - trimCharsStart("./"), - trimCharsStart("~/"), - trimCharsStart("../"), - trimChars(" "), - ]) + pipe( + name, + [ + trimCharsStart("./"), + trimCharsStart("~/"), + trimCharsStart("../"), + trimChars(" "), + ] + ) const changeScreen = screen => { store.setCurrentScreen(screen.props._instanceName) @@ -38,7 +44,7 @@
- {#each screens as screen} + {#each sortedScreens as screen}
Date: Wed, 14 Oct 2020 20:54:07 +0100 Subject: [PATCH 02/22] app screen routing - routes are no case insensitive --- packages/client/src/render/screenRouter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/client/src/render/screenRouter.js b/packages/client/src/render/screenRouter.js index fb84248d94..901a05a2b9 100644 --- a/packages/client/src/render/screenRouter.js +++ b/packages/client/src/render/screenRouter.js @@ -28,7 +28,9 @@ export const screenRouter = ({ screens, onScreenSelected, window }) => { function route(url) { const _url = makeRootedPath(url.state || url) current = routes.findIndex( - p => p !== "*" && new RegExp("^" + p + "$").test(_url) + p => + p !== "*" && + new RegExp("^" + p.toLowerCase() + "$").test(_url.toLowerCase()) ) const params = {} From 3abf7daa73c75239ef55e6d0f1bcd140f04905e9 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 14 Oct 2020 21:43:36 +0100 Subject: [PATCH 03/22] frontend bug fixes, remove bindable prop, add not equals filter --- .../backend/DataTable/ViewDataTable.svelte | 4 +--- .../popovers/CreateEditColumnPopover.svelte | 23 +++++++++---------- .../DataTable/popovers/FilterPopover.svelte | 4 ++++ .../userInterface/PropertyControl.svelte | 3 ++- .../userInterface/SettingsView.svelte | 1 + .../src/api/controllers/view/viewBuilder.js | 1 + .../server/src/middleware/authenticated.js | 2 +- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte index d3c82e4f7c..5bafadd767 100644 --- a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte @@ -37,8 +37,6 @@ - {#if view.calculation} - - {/if} +
diff --git a/packages/builder/src/components/backend/DataTable/popovers/CreateEditColumnPopover.svelte b/packages/builder/src/components/backend/DataTable/popovers/CreateEditColumnPopover.svelte index 14755ce6fe..8fb843ee77 100644 --- a/packages/builder/src/components/backend/DataTable/popovers/CreateEditColumnPopover.svelte +++ b/packages/builder/src/components/backend/DataTable/popovers/CreateEditColumnPopover.svelte @@ -65,18 +65,17 @@
- {#if !originalName} - - {/if} + {#if field.type !== 'link'}
- {#if control === Input && !key.startsWith('_')} + {#if bindable && control === Input && !key.startsWith('_')} diff --git a/packages/builder/src/components/userInterface/SettingsView.svelte b/packages/builder/src/components/userInterface/SettingsView.svelte index bae1b364c9..91d9ba6b2b 100644 --- a/packages/builder/src/components/userInterface/SettingsView.svelte +++ b/packages/builder/src/components/userInterface/SettingsView.svelte @@ -88,6 +88,7 @@ {#if screenOrPageInstance} {#each screenOrPageDefinition as def} ", diff --git a/packages/server/src/middleware/authenticated.js b/packages/server/src/middleware/authenticated.js index 33cafca17a..8a046f4327 100644 --- a/packages/server/src/middleware/authenticated.js +++ b/packages/server/src/middleware/authenticated.js @@ -40,7 +40,7 @@ module.exports = async (ctx, next) => { ctx.user = { // if appId can't be determined from path param or subdomain - appId: appId, + appId, } await next() return From 11927d2340feae13d70f8cc6c68ba51822c7e525 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 15 Oct 2020 10:48:57 +0100 Subject: [PATCH 04/22] adding sum and count functionality, preventing user from doing bad filters --- .../BlockList/AutomationBlock.svelte | 4 +++- .../automation/SetupPanel/SetupPanel.svelte | 5 +++- .../components/backend/DataTable/Table.svelte | 3 +-- .../backend/DataTable/TablePagination.svelte | 17 +++++++------ .../backend/DataTable/ViewDataTable.svelte | 9 +++---- .../popovers/CalculatePopover.svelte | 24 ++++++++++++++----- .../Notification/NotificationDisplay.svelte | 4 +++- .../components/settings/Integration.svelte | 4 +++- .../src/components/settings/tabs/Users.svelte | 4 ++-- .../src/components/start/AppCard.svelte | 4 +--- .../src/components/start/AppList.svelte | 4 ++-- .../src/components/start/TemplateList.svelte | 11 +++++---- .../ComponentDropdownMenu.svelte | 4 +++- .../EventsEditor/StateBindingCascader.svelte | 4 +++- .../IconSelect/IconSelect.svelte | 4 +++- .../userInterface/ItemTab/Item.svelte | 4 +++- .../src/pages/[application]/_reset.svelte | 4 ++-- .../table/[selectedTable]/index.svelte | 4 +++- .../[application]/backend/table/index.svelte | 4 +++- .../backend/view/[selectedView]/index.svelte | 4 +++- packages/server/src/api/controllers/row.js | 24 ++++++++++++++----- .../src/api/controllers/view/viewBuilder.js | 12 ++++++++-- packages/standard-components/src/Card.svelte | 4 +++- .../src/CardHorizontal.svelte | 4 +++- .../src/DataGrid/AttachmentCell/Button.svelte | 13 +++++++++- .../src/DataGrid/Component.svelte | 6 ++--- packages/standard-components/src/Login.svelte | 4 +++- .../standard-components/src/Navigation.svelte | 4 +++- .../src/Test/TestApp.svelte | 2 +- packages/standard-components/src/Text.svelte | 4 +++- .../src/attachments/AttachmentList.svelte | 4 +++- 31 files changed, 140 insertions(+), 66 deletions(-) diff --git a/packages/builder/src/components/automation/AutomationPanel/BlockList/AutomationBlock.svelte b/packages/builder/src/components/automation/AutomationPanel/BlockList/AutomationBlock.svelte index 2419999475..b8ac6638ae 100644 --- a/packages/builder/src/components/automation/AutomationPanel/BlockList/AutomationBlock.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/BlockList/AutomationBlock.svelte @@ -23,7 +23,9 @@ class="automation-block hoverable" on:click={addBlockToAutomation} data-cy={stepId}> -
+
+ +

{blockDefinition.name}

{blockDefinition.description}

diff --git a/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte b/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte index 37ca1f2252..f2b7a8b711 100644 --- a/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte +++ b/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte @@ -62,7 +62,10 @@ {#if $automationStore.selectedBlock} {:else if $automationStore.selectedAutomation} -
Automation {automation.name}
+
+ Automation + {automation.name} +
{/if}
diff --git a/packages/builder/src/components/backend/DataTable/Table.svelte b/packages/builder/src/components/backend/DataTable/Table.svelte index 4c0dc06d39..dde114a76c 100644 --- a/packages/builder/src/components/backend/DataTable/Table.svelte +++ b/packages/builder/src/components/backend/DataTable/Table.svelte @@ -108,8 +108,7 @@
selectRelationship(row, header)}> - {row[header] ? row[header].length : 0} - related row(s) + {row[header] ? row[header].length : 0} related row(s)
{:else if schema[header].type === 'attachment'} diff --git a/packages/builder/src/components/backend/DataTable/TablePagination.svelte b/packages/builder/src/components/backend/DataTable/TablePagination.svelte index ca5a58700d..ccb7d0fc4c 100644 --- a/packages/builder/src/components/backend/DataTable/TablePagination.svelte +++ b/packages/builder/src/components/backend/DataTable/TablePagination.svelte @@ -49,7 +49,9 @@ - {#if currentPage > 3}{/if} + {#if currentPage > 3} + + {/if} {#each pagesAroundCurrent as idx} {/if} + {#if currentPage < numPages - 4} + + {/if}
diff --git a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte index 5bafadd767..9d00edf351 100644 --- a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte @@ -15,15 +15,16 @@ // Fetch rows for specified view $: { if (!name.startsWith("all_")) { - fetchViewData(name, view.field, view.groupBy) + fetchViewData(name, view.field, view.groupBy, view.calculation) } } - async function fetchViewData(name, field, groupBy) { + async function fetchViewData(name, field, groupBy, calculation) { const params = new URLSearchParams() - if (field) { + if (calculation) { params.set("field", field) - params.set("stats", true) + // todo, maybe won't work + params.set("calculation", calculation) } if (groupBy) { params.set("group", groupBy) diff --git a/packages/builder/src/components/backend/DataTable/popovers/CalculatePopover.svelte b/packages/builder/src/components/backend/DataTable/popovers/CalculatePopover.svelte index 1b079dbb4a..7dee7fb3d5 100644 --- a/packages/builder/src/components/backend/DataTable/popovers/CalculatePopover.svelte +++ b/packages/builder/src/components/backend/DataTable/popovers/CalculatePopover.svelte @@ -9,6 +9,14 @@ name: "Statistics", key: "stats", }, + { + name: "Count", + key: "count", + }, + { + name: "Sum", + key: "sum", + }, ] export let view = {} @@ -22,6 +30,7 @@ Object.keys(viewTable.schema).filter( field => viewTable.schema[field].type === "number" ) + $: valid = view.calculation === "count" || view.field function saveView() { if (!view.calculation) view.calculation = "stats" @@ -35,17 +44,20 @@
Calculate
- -

The statistics of

+

of

diff --git a/packages/builder/src/components/userInterface/ItemTab/Item.svelte b/packages/builder/src/components/userInterface/ItemTab/Item.svelte index 7d118afe61..86044cb617 100644 --- a/packages/builder/src/components/userInterface/ItemTab/Item.svelte +++ b/packages/builder/src/components/userInterface/ItemTab/Item.svelte @@ -3,7 +3,9 @@
-
+
+ +
{item.name}
diff --git a/packages/builder/src/pages/[application]/_reset.svelte b/packages/builder/src/pages/[application]/_reset.svelte index b7199d27fe..f757259ecb 100644 --- a/packages/builder/src/pages/[application]/_reset.svelte +++ b/packages/builder/src/pages/[application]/_reset.svelte @@ -80,9 +80,9 @@ {#await promise}
- {:then results} + {:then [object Object]} - {:catch error} + {:catch [object Object]}

Something went wrong: {error.message}

{/await}
diff --git a/packages/builder/src/pages/[application]/backend/table/[selectedTable]/index.svelte b/packages/builder/src/pages/[application]/backend/table/[selectedTable]/index.svelte index b7ee09a4f3..555d304586 100644 --- a/packages/builder/src/pages/[application]/backend/table/[selectedTable]/index.svelte +++ b/packages/builder/src/pages/[application]/backend/table/[selectedTable]/index.svelte @@ -7,7 +7,9 @@ {#if $backendUiStore.selectedDatabase._id && selectedTable.name} -{:else}Create your first table to start building{/if} +{:else} + Create your first table to start building +{/if} --> + diff --git a/packages/standard-components/src/DataGrid/Component.svelte b/packages/standard-components/src/DataGrid/Component.svelte index 471d02cc68..c92908732f 100644 --- a/packages/standard-components/src/DataGrid/Component.svelte +++ b/packages/standard-components/src/DataGrid/Component.svelte @@ -19,7 +19,7 @@ export let editable export let theme = "alpine" export let height = 500 - export let pagination + export let pagination = true // These can never change at runtime so don't need to be reactive let canEdit = editable && datasource && datasource.type !== "view" @@ -135,9 +135,7 @@ {#if selectedRows.length > 0} - Delete - {selectedRows.length} - row(s) + Delete {selectedRows.length} row(s) {/if}
diff --git a/packages/standard-components/src/Login.svelte b/packages/standard-components/src/Login.svelte index 42db74c02e..9152979cc7 100644 --- a/packages/standard-components/src/Login.svelte +++ b/packages/standard-components/src/Login.svelte @@ -42,7 +42,9 @@
{#if logo} -
logo
+
+ logo +
{/if} {#if title} diff --git a/packages/standard-components/src/Navigation.svelte b/packages/standard-components/src/Navigation.svelte index bb0863fe2c..abbb020d16 100644 --- a/packages/standard-components/src/Navigation.svelte +++ b/packages/standard-components/src/Navigation.svelte @@ -30,7 +30,9 @@ {#if logoUrl} {/if} - {#if title}{title}{/if} + {#if title} + {title} + {/if} diff --git a/packages/builder/src/components/settings/tabs/Users.svelte b/packages/builder/src/components/settings/tabs/Users.svelte index adaede6e23..3d4a44fc73 100644 --- a/packages/builder/src/components/settings/tabs/Users.svelte +++ b/packages/builder/src/components/settings/tabs/Users.svelte @@ -74,7 +74,7 @@ {#await fetchUsersPromise} Loading... - {:then [object Object]} + {:then users}
    {#each users as user}
  • @@ -84,7 +84,7 @@
  • No Users found
  • {/each}
- {:catch [object Object]} + {:catch err} Something went wrong when trying to fetch users. Please refresh (CMD + R / CTRL + R) the page and try again. {/await} diff --git a/packages/builder/src/components/start/AppList.svelte b/packages/builder/src/components/start/AppList.svelte index b172d9a2f3..aeed85655e 100644 --- a/packages/builder/src/components/start/AppList.svelte +++ b/packages/builder/src/components/start/AppList.svelte @@ -24,7 +24,7 @@
- {:then [object Object]} + {:then apps}
@@ -36,7 +36,7 @@
- {:catch [object Object]} + {:catch err}

{err}

{/await}
diff --git a/packages/builder/src/components/start/TemplateList.svelte b/packages/builder/src/components/start/TemplateList.svelte index 8be25c1981..64e0671c83 100644 --- a/packages/builder/src/components/start/TemplateList.svelte +++ b/packages/builder/src/components/start/TemplateList.svelte @@ -20,7 +20,7 @@
- {:then [object Object]} + {:then templates}
{#each templates as template}
@@ -39,7 +39,7 @@
{/each}
- {:catch [object Object]} + {:catch err}

{err}

{/await}
diff --git a/packages/builder/src/pages/[application]/_reset.svelte b/packages/builder/src/pages/[application]/_reset.svelte index f757259ecb..b6d6149da3 100644 --- a/packages/builder/src/pages/[application]/_reset.svelte +++ b/packages/builder/src/pages/[application]/_reset.svelte @@ -80,9 +80,9 @@ {#await promise}
- {:then [object Object]} + {:then _} - {:catch [object Object]} + {:catch error}

Something went wrong: {error.message}

{/await}
diff --git a/packages/server/src/api/controllers/row.js b/packages/server/src/api/controllers/row.js index a9ce510457..3f5d56e507 100644 --- a/packages/server/src/api/controllers/row.js +++ b/packages/server/src/api/controllers/row.js @@ -11,6 +11,12 @@ const { cloneDeep } = require("lodash") const TABLE_VIEW_BEGINS_WITH = `all${SEPARATOR}${DocumentTypes.TABLE}${SEPARATOR}` +const CALCULATION_TYPES = { + SUM: "sum", + COUNT: "count", + STATS: "stats" +} + validateJs.extend(validateJs.validators.datetime, { parse: function(value) { return new Date(value).getTime() @@ -152,13 +158,12 @@ exports.fetchView = async function(ctx) { group, }) - // TODO: create constants for calculation types if (!calculation) { response.rows = response.rows.map(row => row.doc) ctx.body = await linkRows.attachLinkInfo(instanceId, response.rows) } - if (calculation === "stats") { + if (calculation === CALCULATION_TYPES.STATS) { response.rows = response.rows.map(row => ({ group: row.key, field, @@ -168,13 +173,15 @@ exports.fetchView = async function(ctx) { ctx.body = response.rows } - if (calculation === "count" || calculation === "sum") { - ctx.body = field - ? response.rows.map(row => ({ - field, - value: row.value, - })) - : [{ field: "All Rows", value: response.total_rows }] + if ( + calculation === CALCULATION_TYPES.COUNT || + calculation === CALCULATION_TYPES.SUM + ) { + ctx.body = response.rows.map(row => ({ + group: row.key, + field, + value: row.value, + })) } } diff --git a/packages/server/src/api/controllers/view/viewBuilder.js b/packages/server/src/api/controllers/view/viewBuilder.js index 082db8bebf..550480d52c 100644 --- a/packages/server/src/api/controllers/view/viewBuilder.js +++ b/packages/server/src/api/controllers/view/viewBuilder.js @@ -89,8 +89,7 @@ function parseFilterExpression(filters) { * @param {String?} groupBy - field to group calculation results on, if any */ function parseEmitExpression(field, groupBy) { - if (field) return `emit(doc["${groupBy || "_id"}"], doc["${field}"]);` - return `emit(doc._id, 1);` + return `emit(doc["${groupBy || "_id"}"], doc["${field}"]);` } /** diff --git a/packages/standard-components/src/Test/TestApp.svelte b/packages/standard-components/src/Test/TestApp.svelte index 1ad2cc484e..0c6da55601 100644 --- a/packages/standard-components/src/Test/TestApp.svelte +++ b/packages/standard-components/src/Test/TestApp.svelte @@ -35,7 +35,7 @@ {#await _appPromise} loading -{:then [object Object]} +{:then _}
{/await} From 8a936e09271e8c7d15e0389417daf588ca50cadf Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 15 Oct 2020 14:26:33 +0100 Subject: [PATCH 06/22] more auth bugfixes --- packages/client/src/render/getAppId.js | 2 ++ packages/server/src/middleware/authenticated.js | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/client/src/render/getAppId.js b/packages/client/src/render/getAppId.js index e6216e7be5..5525c67358 100644 --- a/packages/client/src/render/getAppId.js +++ b/packages/client/src/render/getAppId.js @@ -3,6 +3,8 @@ export const parseAppIdFromCookie = docCookie => { docCookie.split(";").find(c => c.trim().startsWith("budibase:token")) || docCookie.split(";").find(c => c.trim().startsWith("builder:token")) + if (!cookie) return location.pathname.replace("/") + const base64Token = cookie.substring(lengthOfKey) const user = JSON.parse(atob(base64Token.split(".")[1])) diff --git a/packages/server/src/middleware/authenticated.js b/packages/server/src/middleware/authenticated.js index 8a046f4327..1a2eba3fd8 100644 --- a/packages/server/src/middleware/authenticated.js +++ b/packages/server/src/middleware/authenticated.js @@ -34,12 +34,14 @@ module.exports = async (ctx, next) => { let appId = process.env.CLOUD ? ctx.subdomains[1] : ctx.params.appId - if (!appId) { - appId = ctx.referer && ctx.referer.split("/").pop() + // if appId can't be determined from path param or subdomain + if (!appId && ctx.request.headers.referer) { + const url = new URL(ctx.request.headers.referer) + // remove leading and trailing slashes from appId + appId = url.pathname.replace(/\//g, "") } ctx.user = { - // if appId can't be determined from path param or subdomain appId, } await next() From 1238f85890735cc23ce16358f76c266b9fd730d3 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 15 Oct 2020 14:46:24 +0100 Subject: [PATCH 07/22] replacing pathname --- packages/client/src/render/getAppId.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/render/getAppId.js b/packages/client/src/render/getAppId.js index 5525c67358..4cbb6692b5 100644 --- a/packages/client/src/render/getAppId.js +++ b/packages/client/src/render/getAppId.js @@ -3,7 +3,7 @@ export const parseAppIdFromCookie = docCookie => { docCookie.split(";").find(c => c.trim().startsWith("budibase:token")) || docCookie.split(";").find(c => c.trim().startsWith("builder:token")) - if (!cookie) return location.pathname.replace("/") + if (!cookie) return location.pathname.replace(/\//g, "") const base64Token = cookie.substring(lengthOfKey) From ac0413eefdceafee43da7d0dbaacfdb5a3b609b6 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 15 Oct 2020 15:02:22 +0100 Subject: [PATCH 08/22] allow users to remove a calculation --- .../src/components/backend/DataTable/ViewDataTable.svelte | 5 ++++- .../backend/DataTable/buttons/CalculateButton.svelte | 6 +++++- .../backend/DataTable/popovers/CalculatePopover.svelte | 1 - packages/server/src/api/controllers/view/viewBuilder.js | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte index 593030985d..5b56e3d125 100644 --- a/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/ViewDataTable.svelte @@ -9,12 +9,14 @@ export let view = {} let data = [] + let loading = false $: name = view.name // Fetch rows for specified view $: { if (!name.startsWith("all_")) { + loading = true fetchViewData(name, view.field, view.groupBy, view.calculation) } } @@ -31,10 +33,11 @@ const QUERY_VIEW_URL = `/api/views/${name}?${params}` const response = await api.get(QUERY_VIEW_URL) data = await response.json() + loading = false } - +
{#if view.calculation} diff --git a/packages/builder/src/components/backend/DataTable/buttons/CalculateButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/CalculateButton.svelte index efe3dcd79d..0452491247 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/CalculateButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/CalculateButton.svelte @@ -9,7 +9,11 @@
- + Calculate diff --git a/packages/builder/src/components/backend/DataTable/popovers/CalculatePopover.svelte b/packages/builder/src/components/backend/DataTable/popovers/CalculatePopover.svelte index 1a14e64475..23965a63e0 100644 --- a/packages/builder/src/components/backend/DataTable/popovers/CalculatePopover.svelte +++ b/packages/builder/src/components/backend/DataTable/popovers/CalculatePopover.svelte @@ -34,7 +34,6 @@ ) function saveView() { - if (!view.calculation) view.calculation = "stats" backendUiStore.actions.views.save(view) notifier.success(`View ${view.name} saved.`) onClosed() diff --git a/packages/server/src/api/controllers/view/viewBuilder.js b/packages/server/src/api/controllers/view/viewBuilder.js index 550480d52c..e9fa29856d 100644 --- a/packages/server/src/api/controllers/view/viewBuilder.js +++ b/packages/server/src/api/controllers/view/viewBuilder.js @@ -109,7 +109,7 @@ function viewTemplate({ field, tableId, groupBy, filters = [], calculation }) { const emitExpression = parseEmitExpression(field, groupBy) - const reduction = field ? { reduce: `_${calculation}` } : {} + const reduction = field && calculation ? { reduce: `_${calculation}` } : {} let schema = null From 2308814e85f8983e5a6c209e63867182893d8e19 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 15 Oct 2020 16:59:57 +0100 Subject: [PATCH 09/22] fix cloudfront invalidations --- packages/server/src/api/controllers/deploy/aws.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/deploy/aws.js b/packages/server/src/api/controllers/deploy/aws.js index 1337f23d1c..28bedb8893 100644 --- a/packages/server/src/api/controllers/deploy/aws.js +++ b/packages/server/src/api/controllers/deploy/aws.js @@ -2,6 +2,7 @@ const fs = require("fs") const { join } = require("../../../utilities/centralPath") const AWS = require("aws-sdk") const fetch = require("node-fetch") +const uuid = require("uuid") const { budibaseAppsDir } = require("../../../utilities/budibaseDir") const PouchDB = require("../../../db") const environment = require("../../../environment") @@ -13,7 +14,7 @@ async function invalidateCDN(cfDistribution, appId) { .createInvalidation({ DistributionId: cfDistribution, InvalidationBatch: { - CallerReference: appId, + CallerReference: `${appId}-${uuid.v4()}`, Paths: { Quantity: 1, Items: [`/assets/${appId}/*`], From e300134186cfe43c8bf6ec4d9a13a14279865553 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 15 Oct 2020 17:05:09 +0100 Subject: [PATCH 10/22] lint :sparkles: --- .../BlockList/AutomationBlock.svelte | 4 +--- .../automation/SetupPanel/SetupPanel.svelte | 5 +---- .../components/backend/DataTable/Table.svelte | 3 ++- .../backend/DataTable/TablePagination.svelte | 17 +++++++++-------- .../Notification/NotificationDisplay.svelte | 4 +--- .../src/components/settings/Integration.svelte | 4 +--- .../src/components/start/AppCard.svelte | 4 +++- .../src/components/start/TemplateList.svelte | 7 +++---- .../userInterface/ComponentDropdownMenu.svelte | 4 +--- .../EventsEditor/StateBindingCascader.svelte | 4 +--- .../userInterface/IconSelect/IconSelect.svelte | 4 +--- .../userInterface/ItemTab/Item.svelte | 4 +--- .../backend/table/[selectedTable]/index.svelte | 4 +--- .../[application]/backend/table/index.svelte | 4 +--- .../backend/view/[selectedView]/index.svelte | 4 +--- packages/server/src/api/controllers/row.js | 2 +- packages/standard-components/src/Card.svelte | 4 +--- .../src/CardHorizontal.svelte | 4 +--- .../src/DataGrid/AttachmentCell/Button.svelte | 2 +- .../src/DataGrid/Component.svelte | 18 ++++++++++++++---- packages/standard-components/src/Login.svelte | 4 +--- .../standard-components/src/Navigation.svelte | 4 +--- packages/standard-components/src/Text.svelte | 4 +--- .../src/attachments/AttachmentList.svelte | 4 +--- 24 files changed, 50 insertions(+), 72 deletions(-) diff --git a/packages/builder/src/components/automation/AutomationPanel/BlockList/AutomationBlock.svelte b/packages/builder/src/components/automation/AutomationPanel/BlockList/AutomationBlock.svelte index b8ac6638ae..2419999475 100644 --- a/packages/builder/src/components/automation/AutomationPanel/BlockList/AutomationBlock.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/BlockList/AutomationBlock.svelte @@ -23,9 +23,7 @@ class="automation-block hoverable" on:click={addBlockToAutomation} data-cy={stepId}> -
- -
+

{blockDefinition.name}

{blockDefinition.description}

diff --git a/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte b/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte index f2b7a8b711..37ca1f2252 100644 --- a/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte +++ b/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte @@ -62,10 +62,7 @@ {#if $automationStore.selectedBlock} {:else if $automationStore.selectedAutomation} -
- Automation - {automation.name} -
+
Automation {automation.name}
{/if}
diff --git a/packages/builder/src/components/backend/DataTable/Table.svelte b/packages/builder/src/components/backend/DataTable/Table.svelte index dde114a76c..4c0dc06d39 100644 --- a/packages/builder/src/components/backend/DataTable/Table.svelte +++ b/packages/builder/src/components/backend/DataTable/Table.svelte @@ -108,7 +108,8 @@
selectRelationship(row, header)}> - {row[header] ? row[header].length : 0} related row(s) + {row[header] ? row[header].length : 0} + related row(s)
{:else if schema[header].type === 'attachment'} diff --git a/packages/builder/src/components/backend/DataTable/TablePagination.svelte b/packages/builder/src/components/backend/DataTable/TablePagination.svelte index ccb7d0fc4c..ca5a58700d 100644 --- a/packages/builder/src/components/backend/DataTable/TablePagination.svelte +++ b/packages/builder/src/components/backend/DataTable/TablePagination.svelte @@ -49,9 +49,7 @@ - {#if currentPage > 3} - - {/if} + {#if currentPage > 3}{/if} {#each pagesAroundCurrent as idx} - {/if} + {#if currentPage < numPages - 4}{/if}
diff --git a/packages/builder/src/components/common/Notification/NotificationDisplay.svelte b/packages/builder/src/components/common/Notification/NotificationDisplay.svelte index ad32f228cb..55adef2fbf 100644 --- a/packages/builder/src/components/common/Notification/NotificationDisplay.svelte +++ b/packages/builder/src/components/common/Notification/NotificationDisplay.svelte @@ -31,9 +31,7 @@ style="background: {themes[notification.type]};" transition:fly={{ y: -30 }}>
{notification.message}
- {#if notification.icon} - - {/if} + {#if notification.icon}{/if} {/each} diff --git a/packages/builder/src/components/settings/Integration.svelte b/packages/builder/src/components/settings/Integration.svelte index 69cfe6241f..f588649c9d 100644 --- a/packages/builder/src/components/settings/Integration.svelte +++ b/packages/builder/src/components/settings/Integration.svelte @@ -5,9 +5,7 @@
-
- zoom -
+
zoom
Zoom
diff --git a/packages/builder/src/components/start/AppCard.svelte b/packages/builder/src/components/start/AppCard.svelte index 34a3faa966..d6ee4b9591 100644 --- a/packages/builder/src/components/start/AppCard.svelte +++ b/packages/builder/src/components/start/AppCard.svelte @@ -10,7 +10,9 @@
diff --git a/packages/builder/src/components/start/TemplateList.svelte b/packages/builder/src/components/start/TemplateList.svelte index 64e0671c83..14551adf1d 100644 --- a/packages/builder/src/components/start/TemplateList.svelte +++ b/packages/builder/src/components/start/TemplateList.svelte @@ -28,12 +28,11 @@ {template.category} {template.description} -
- -
+
diff --git a/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte b/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte index 60f6d9175d..59a8e4e1ed 100644 --- a/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte +++ b/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte @@ -99,9 +99,7 @@
{}}> -
- -
+
- {#if parameter.name === 'automation'} - {parameter.name} - {/if} + {#if parameter.name === 'automation'}{parameter.name}{/if} {#if parameter.name === 'automation'}