From fa835e65ef7a161bfeac78d890a58a766ea66e84 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 14 Jun 2023 16:57:36 +0100 Subject: [PATCH 1/4] Add loading when saving datasource --- .../data/datasource/[datasourceId]/index.svelte | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte index a853fcea0c..166b4363df 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte @@ -33,6 +33,7 @@ let isValid = true let integration, baseDatasource, datasource let queryList + let loading = false $: baseDatasource = $datasources.selected $: queryList = $queries.list.filter( @@ -65,9 +66,11 @@ } const saveDatasource = async () => { + loading = true if (integration.features[DatasourceFeature.CONNECTION_CHECKING]) { const valid = await validateConfig() if (!valid) { + loading = false return false } } @@ -82,6 +85,8 @@ baseDatasource = cloneDeep(datasource) } catch (err) { notifications.error(`Error saving datasource: ${err}`) + } finally { + loading = false } } @@ -119,7 +124,11 @@
Configuration -
From bfc6bb6a6e0069504e0f3064990bc7045f246755 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 14 Jun 2023 17:07:47 +0100 Subject: [PATCH 2/4] Add spinner while saving datasources --- .../data/datasource/[datasourceId]/index.svelte | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte index 166b4363df..949fff4edc 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/index.svelte @@ -22,6 +22,7 @@ import ImportRestQueriesModal from "components/backend/DatasourceNavigator/modals/ImportRestQueriesModal.svelte" import { API } from "api" import { DatasourceFeature } from "@budibase/types" + import Spinner from "components/common/Spinner.svelte" const querySchema = { name: {}, @@ -129,7 +130,12 @@ cta on:click={saveDatasource} > - Save +
+ {#if loading} + Save + {/if} + Save +
From e6ad3a4719aeb92668ed8e55864d16f63fa330ac Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 14 Jun 2023 17:17:29 +0100 Subject: [PATCH 3/4] Type pg --- packages/server/src/integrations/postgres.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts index 33ecf45982..9b2f94db8f 100644 --- a/packages/server/src/integrations/postgres.ts +++ b/packages/server/src/integrations/postgres.ts @@ -20,7 +20,7 @@ import Sql from "./base/sql" import { PostgresColumn } from "./base/types" import { escapeDangerousCharacters } from "../utilities" -import { Client, types } from "pg" +import { Client, ClientConfig, types } from "pg" // Return "date" and "timestamp" types as plain strings. // This lets us reference the original stored timezone. @@ -144,7 +144,7 @@ class PostgresIntegration extends Sql implements DatasourcePlus { super(SqlClient.POSTGRES) this.config = config - let newConfig = { + let newConfig: ClientConfig = { ...this.config, ssl: this.config.ssl ? { From 4d3ab040bfe8d1146f5ef159d2f5826fec385e97 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 15 Jun 2023 11:06:01 +0100 Subject: [PATCH 4/4] Support postgres client certificates --- packages/server/src/integrations/postgres.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts index 9b2f94db8f..b1f20f97ec 100644 --- a/packages/server/src/integrations/postgres.ts +++ b/packages/server/src/integrations/postgres.ts @@ -42,6 +42,8 @@ interface PostgresConfig { schema: string ssl?: boolean ca?: string + clientKey?: string + clientCert?: string rejectUnauthorized?: boolean } @@ -98,6 +100,19 @@ const SCHEMA: Integration = { required: false, }, ca: { + display: "Server CA", + type: DatasourceFieldType.LONGFORM, + default: false, + required: false, + }, + clientKey: { + display: "Client key", + type: DatasourceFieldType.LONGFORM, + default: false, + required: false, + }, + clientCert: { + display: "Client cert", type: DatasourceFieldType.LONGFORM, default: false, required: false, @@ -150,6 +165,8 @@ class PostgresIntegration extends Sql implements DatasourcePlus { ? { rejectUnauthorized: this.config.rejectUnauthorized, ca: this.config.ca, + key: this.config.clientKey, + cert: this.config.clientCert, } : undefined, }