Add opt-in / opt-out to org settings

This commit is contained in:
Rory Powell 2022-05-23 08:55:33 +01:00
parent 63dd69f5b3
commit 7744a688f0
1 changed files with 16 additions and 0 deletions

View File

@ -9,6 +9,7 @@
Input, Input,
Dropzone, Dropzone,
notifications, notifications,
Toggle,
} from "@budibase/bbui" } from "@budibase/bbui"
import { auth, organisation, admin } from "stores/portal" import { auth, organisation, admin } from "stores/portal"
import { API } from "api" import { API } from "api"
@ -25,6 +26,7 @@
const values = writable({ const values = writable({
company: $organisation.company, company: $organisation.company,
platformUrl: $organisation.platformUrl, platformUrl: $organisation.platformUrl,
analyticsEnabled: $organisation.analyticsEnabled,
logo: $organisation.logoUrl logo: $organisation.logoUrl
? { url: $organisation.logoUrl, type: "image", name: "Logo" } ? { url: $organisation.logoUrl, type: "image", name: "Logo" }
: null, : null,
@ -54,6 +56,7 @@
const config = { const config = {
company: $values.company ?? "", company: $values.company ?? "",
platformUrl: $values.platformUrl ?? "", platformUrl: $values.platformUrl ?? "",
analyticsEnabled: $values.analyticsEnabled,
} }
// Remove logo if required // Remove logo if required
@ -123,6 +126,19 @@
</div> </div>
</div> </div>
{/if} {/if}
{#if !$admin.cloud}
<Divider size="S" />
<Layout gap="XS" noPadding>
<Heading size="S">Analytics</Heading>
<Body size="S">Choose whether to opt-in or opt-out of analtics</Body>
</Layout>
<div class="fields">
<div class="field">
<Label size="L">Analytics</Label>
<Toggle text="" bind:value={$values.analyticsEnabled} />
</div>
</div>
{/if}
<div> <div>
<Button disabled={loading} on:click={saveConfig} cta>Save</Button> <Button disabled={loading} on:click={saveConfig} cta>Save</Button>
</div> </div>