From 987b66fd59a62547cbb18b2b607c3d4ef92a28f2 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 18 Jun 2021 13:14:45 +0100 Subject: [PATCH] Formatting and fixing an issue with mysql not being able to return a row that it has created, updated or deleted. --- packages/builder/src/builderStore/api.js | 30 +++--- .../builderStore/store/automation/index.js | 7 +- .../common/bindings/BindingPanel.svelte | 8 +- .../common/bindings/ServerBindingPanel.svelte | 4 +- .../PropertyControls/DataSourceSelect.svelte | 5 +- .../EventsEditor/actions/ExecuteQuery.svelte | 5 +- .../data/datasource/bb_internal/index.svelte | 18 ++-- .../[application]/data/table/_layout.svelte | 3 +- .../stores/backend/tests/fixtures/queries.js | 6 +- .../server/src/api/controllers/automation.js | 2 +- .../src/api/controllers/row/external.js | 51 ++++++---- .../src/api/controllers/row/internal.js | 2 +- packages/server/src/integrations/base/sql.js | 57 +++++++++--- .../server/src/integrations/elasticsearch.js | 3 +- packages/server/src/integrations/mysql.js | 57 ++++++++---- packages/server/src/middleware/authorized.js | 92 ++++++++++--------- packages/server/src/middleware/currentapp.js | 8 +- .../src/forms/validation.js | 16 ++-- .../worker/src/api/controllers/admin/email.js | 11 +-- .../src/api/controllers/admin/groups.js | 7 +- .../worker/src/api/controllers/admin/users.js | 7 +- 21 files changed, 223 insertions(+), 176 deletions(-) diff --git a/packages/builder/src/builderStore/api.js b/packages/builder/src/builderStore/api.js index 2e683238bc..ae81df10f6 100644 --- a/packages/builder/src/builderStore/api.js +++ b/packages/builder/src/builderStore/api.js @@ -2,23 +2,21 @@ import { store } from "./index" import { get as svelteGet } from "svelte/store" import { removeCookie, Cookies } from "./cookies" -const apiCall = method => async ( - url, - body, - headers = { "Content-Type": "application/json" } -) => { - headers["x-budibase-app-id"] = svelteGet(store).appId - const json = headers["Content-Type"] === "application/json" - const resp = await fetch(url, { - method: method, - body: json ? JSON.stringify(body) : body, - headers, - }) - if (resp.status === 403) { - removeCookie(Cookies.Auth) +const apiCall = + method => + async (url, body, headers = { "Content-Type": "application/json" }) => { + headers["x-budibase-app-id"] = svelteGet(store).appId + const json = headers["Content-Type"] === "application/json" + const resp = await fetch(url, { + method: method, + body: json ? JSON.stringify(body) : body, + headers, + }) + if (resp.status === 403) { + removeCookie(Cookies.Auth) + } + return resp } - return resp -} export const post = apiCall("POST") export const get = apiCall("GET") diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index 7a01bccfab..c372f27bb7 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -100,9 +100,10 @@ const automationActions = store => ({ }, deleteAutomationBlock: block => { store.update(state => { - const idx = state.selectedAutomation.automation.definition.steps.findIndex( - x => x.id === block.id - ) + const idx = + state.selectedAutomation.automation.definition.steps.findIndex( + x => x.id === block.id + ) state.selectedAutomation.deleteBlock(block.id) // Select next closest step diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index 37e7f520f3..01e0c5918b 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -59,9 +59,7 @@
Columns