Merge pull request #10181 from Budibase/fix/same-tab-googlesheets-onboarding

Minor googlesheets onboarding improvement
This commit is contained in:
Michael Drury 2023-04-03 12:22:09 +01:00 committed by GitHub
commit 9e68e9cf2f
5 changed files with 29 additions and 14 deletions

View File

@ -6,6 +6,7 @@
export let preAuthStep
export let datasource
export let disabled
export let samePage
$: tenantId = $auth.tenantId
</script>
@ -25,10 +26,12 @@
ds = resp
}
}
window.open(
`/api/global/auth/${tenantId}/datasource/google?datasourceId=${ds._id}&appId=${appId}`,
"_blank"
)
const url = `/api/global/auth/${tenantId}/datasource/google?datasourceId=${ds._id}&appId=${appId}`
if (samePage) {
window.location = url
} else {
window.open(url, "_blank")
}
}}
>
<img src={GoogleLogo} alt="google icon" />

View File

@ -3,6 +3,7 @@
import GoogleLogo from "assets/google-logo.png"
import { auth, organisation } from "stores/portal"
export let samePage
let show
$: tenantId = $auth.tenantId
@ -12,8 +13,14 @@
{#if show}
<FancyButton
icon={GoogleLogo}
on:click={() =>
window.open(`/api/global/auth/${tenantId}/google`, "_blank")}
on:click={() => {
const url = `/api/global/auth/${tenantId}/google`
if (samePage) {
window.location = url
} else {
window.open(url, "_blank")
}
}}
>
Log in with Google
</FancyButton>

View File

@ -9,6 +9,8 @@
import { oidc, organisation, auth } from "stores/portal"
import { onMount } from "svelte"
export let samePage
$: show = $organisation.oidc
let preDefinedIcons = {
@ -35,11 +37,14 @@
{#if show}
<FancyButton
icon={src}
on:click={() =>
window.open(
`/api/global/auth/${$auth.tenantId}/oidc/configs/${$oidc.uuid}`,
"_blank"
)}
on:click={() => {
const url = `/api/global/auth/${$auth.tenantId}/oidc/configs/${$oidc.uuid}`
if (samePage) {
window.location = url
} else {
window.open(url, "_blank")
}
}}
>
{`Log in with ${$oidc.name || "OIDC"}`}
</FancyButton>

View File

@ -78,8 +78,8 @@
<Layout gap="S" noPadding>
{#if loaded && ($organisation.google || $organisation.oidc)}
<FancyForm>
<OIDCButton oidcIcon={$oidc.logo} oidcName={$oidc.name} />
<GoogleButton />
<OIDCButton oidcIcon={$oidc.logo} oidcName={$oidc.name} samePage />
<GoogleButton samePage />
</FancyForm>
{/if}
{#if !$organisation.isSSOEnforced}

View File

@ -107,7 +107,7 @@
</FancyForm>
</div>
{#if isGoogle}
<GoogleButton disabled={!isValid} preAuthStep={handleNext} />
<GoogleButton disabled={!isValid} preAuthStep={handleNext} samePage />
{:else}
<Button cta disabled={!isValid} on:click={handleNext}>Connect</Button>
{/if}