Don't allow creation of google sheets datasource until google auth configured correctly.
This commit is contained in:
parent
ca33fe7439
commit
741d732795
1 changed files with 25 additions and 8 deletions
|
@ -1,15 +1,23 @@
|
|||
<script>
|
||||
import { ModalContent, Body, Layout } from "@budibase/bbui"
|
||||
import { ModalContent, Body, Layout, Link } from "@budibase/bbui"
|
||||
import { IntegrationNames } from "constants/backend"
|
||||
import cloneDeep from "lodash/cloneDeepWith"
|
||||
import GoogleButton from "../_components/GoogleButton.svelte"
|
||||
import { saveDatasource as save } from "builderStore/datasource"
|
||||
import { API } from "api"
|
||||
import { onMount } from "svelte"
|
||||
|
||||
export let integration
|
||||
export let modal
|
||||
|
||||
// kill the reference so the input isn't saved
|
||||
let datasource = cloneDeep(integration)
|
||||
let isGoogleConfigured
|
||||
|
||||
onMount(async () => {
|
||||
const config = await API.getTenantConfig()
|
||||
isGoogleConfigured = !!config?.config.google
|
||||
})
|
||||
</script>
|
||||
|
||||
<ModalContent
|
||||
|
@ -18,12 +26,21 @@
|
|||
cancelText="Back"
|
||||
size="L"
|
||||
>
|
||||
<!-- check true and false directly, don't render until flag is set -->
|
||||
{#if isGoogleConfigured === true}
|
||||
<Layout noPadding>
|
||||
<Body size="XS"
|
||||
<Body size="S"
|
||||
>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
|
||||
>
|
||||
<Link href="/builder/portal/settings/auth">Configure Google SSO</Link>
|
||||
{/if}
|
||||
</ModalContent>
|
||||
|
|
Loading…
Reference in a new issue