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

View File

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

View File

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

View File

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

View File

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