From 431a22aaf04b7501ade31dc5d887b71d0358c558 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Thu, 9 Dec 2021 11:39:44 +0000 Subject: [PATCH] Modal integration --- .../RestAuthenticationBuilder.svelte | 29 ----- .../{ => rest}/RestExtraConfigForm.svelte | 5 +- .../rest/auth/AuthTypeRenderer.svelte | 13 +++ .../auth/RestAuthenticationBuilder.svelte | 108 ++++++++++++++++++ .../rest/auth/authTypes.js | 15 +++ .../[selectedDatasource]/index.svelte | 2 +- 6 files changed, 138 insertions(+), 34 deletions(-) delete mode 100644 packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/RestAuthenticationBuilder.svelte rename packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/{ => rest}/RestExtraConfigForm.svelte (89%) create mode 100644 packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/AuthTypeRenderer.svelte create mode 100644 packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/RestAuthenticationBuilder.svelte create mode 100644 packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/authTypes.js diff --git a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/RestAuthenticationBuilder.svelte b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/RestAuthenticationBuilder.svelte deleted file mode 100644 index 129acad852..0000000000 --- a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/RestAuthenticationBuilder.svelte +++ /dev/null @@ -1,29 +0,0 @@ - - -
- {#if authConfigs && authConfigs.length > 0} -
- - - {/if} - - - diff --git a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/RestExtraConfigForm.svelte b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/RestExtraConfigForm.svelte similarity index 89% rename from packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/RestExtraConfigForm.svelte rename to packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/RestExtraConfigForm.svelte index c63872a1ef..c77f2900b0 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/RestExtraConfigForm.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/RestExtraConfigForm.svelte @@ -1,7 +1,7 @@ + +{renderAuthType()} diff --git a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/RestAuthenticationBuilder.svelte b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/RestAuthenticationBuilder.svelte new file mode 100644 index 0000000000..4d932869e7 --- /dev/null +++ b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/RestAuthenticationBuilder.svelte @@ -0,0 +1,108 @@ + + + + + + + The authorization header will be automatically generated when you + sendthe request. + + + + {/if} + {#if currentConfig.type === AUTH_TYPES.BEARER} + + {/if} + + + + + + {#if authConfigs && authConfigs.length > 0} +
openConfigModal(detail)} + {schema} + data={authConfigs} + allowEditColumns={false} + allowEditRows={false} + allowSelectRows={false} + customRenderers={[{ column: "type", component: AuthTypeRenderer }]} + /> + {/if} +
+ openConfigModal()} con="Add" + >Add authentication +
+ + + diff --git a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/authTypes.js b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/authTypes.js new file mode 100644 index 0000000000..854391d6ce --- /dev/null +++ b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/authTypes.js @@ -0,0 +1,15 @@ +export const AUTH_TYPES = { + BEARER: "bearer", + BASIC: "basic", +} + +export const AUTH_TYPE_LABELS = [ + { + label: "Bearer Token", + value: AUTH_TYPES.BEARER, + }, + { + label: "Basic Auth", + value: AUTH_TYPES.BASIC, + }, +] diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte index 0e046e26f7..87ff9691f8 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte @@ -12,7 +12,7 @@ } from "@budibase/bbui" import { datasources, integrations, queries, tables } from "stores/backend" import IntegrationConfigForm from "components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte" - import RestExtraConfigForm from "components/backend/DatasourceNavigator/TableIntegrationMenu/RestExtraConfigForm.svelte" + import RestExtraConfigForm from "components/backend/DatasourceNavigator/TableIntegrationMenu/rest/RestExtraConfigForm.svelte" import PlusConfigForm from "components/backend/DatasourceNavigator/TableIntegrationMenu/PlusConfigForm.svelte" import ICONS from "components/backend/DatasourceNavigator/icons" import CapitaliseRenderer from "components/common/renderers/CapitaliseRenderer.svelte"