Don't allow creation of google sheets datasource until google auth configured correctly.
This commit is contained in:
parent
ca33fe7439
commit
741d732795
|
@ -1,15 +1,23 @@
|
||||||
<script>
|
<script>
|
||||||
import { ModalContent, Body, Layout } from "@budibase/bbui"
|
import { ModalContent, Body, Layout, Link } from "@budibase/bbui"
|
||||||
import { IntegrationNames } from "constants/backend"
|
import { IntegrationNames } from "constants/backend"
|
||||||
import cloneDeep from "lodash/cloneDeepWith"
|
import cloneDeep from "lodash/cloneDeepWith"
|
||||||
import GoogleButton from "../_components/GoogleButton.svelte"
|
import GoogleButton from "../_components/GoogleButton.svelte"
|
||||||
import { saveDatasource as save } from "builderStore/datasource"
|
import { saveDatasource as save } from "builderStore/datasource"
|
||||||
|
import { API } from "api"
|
||||||
|
import { onMount } from "svelte"
|
||||||
|
|
||||||
export let integration
|
export let integration
|
||||||
export let modal
|
export let modal
|
||||||
|
|
||||||
// kill the reference so the input isn't saved
|
// kill the reference so the input isn't saved
|
||||||
let datasource = cloneDeep(integration)
|
let datasource = cloneDeep(integration)
|
||||||
|
let isGoogleConfigured
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
const config = await API.getTenantConfig()
|
||||||
|
isGoogleConfigured = !!config?.config.google
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
|
@ -18,12 +26,21 @@
|
||||||
cancelText="Back"
|
cancelText="Back"
|
||||||
size="L"
|
size="L"
|
||||||
>
|
>
|
||||||
<Layout noPadding>
|
<!-- check true and false directly, don't render until flag is set -->
|
||||||
<Body size="XS"
|
{#if isGoogleConfigured === true}
|
||||||
>Authenticate with your google account to use the {IntegrationNames[
|
<Layout noPadding>
|
||||||
datasource.type
|
<Body size="S"
|
||||||
]} integration.</Body
|
>Authenticate with your google account to use the {IntegrationNames[
|
||||||
|
datasource.type
|
||||||
|
]} integration.</Body
|
||||||
|
>
|
||||||
|
</Layout>
|
||||||
|
<GoogleButton preAuthStep={() => save(datasource, true)} />
|
||||||
|
{:else if isGoogleConfigured === false}
|
||||||
|
<Body size="S"
|
||||||
|
>Google authentication is not enabled, please complete Google SSO
|
||||||
|
configuration.</Body
|
||||||
>
|
>
|
||||||
</Layout>
|
<Link href="/builder/portal/settings/auth">Configure Google SSO</Link>
|
||||||
<GoogleButton preAuthStep={() => save(datasource, true)} />
|
{/if}
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
Loading…
Reference in New Issue