Break components

This commit is contained in:
adrinr 2023-03-21 16:06:34 +00:00
parent 53020e2d2d
commit 675d3c5c65
2 changed files with 64 additions and 38 deletions

View File

@ -27,11 +27,11 @@
import { onMount } from "svelte"
import { API } from "api"
import { organisation, admin, licensing } from "stores/portal"
import Scim from "./scim.svelte"
const ConfigTypes = {
Google: "google",
OIDC: "oidc",
SCIM: "scim",
}
const HasSpacesRegex = /[\\"\s]/
@ -161,8 +161,6 @@
providers.oidc?.config?.configs[0].clientSecret
)
$: scimEnabled = true
const onFileSelected = e => {
let fileName = e.target.files[0].name
image = e.target.files[0]
@ -256,19 +254,6 @@
originalGoogleDoc = cloneDeep(providers.google)
}
async function saveSCIM() {
try {
const res = await saveConfig({
type: "scim",
enabled: scimEnabled,
})
notifications.success(`Settings saved`)
} catch (e) {
notifications.error(e.message)
return
}
}
let defaultScopes = ["profile", "email", "offline_access"]
const refreshScopes = idx => {
@ -359,14 +344,6 @@
originalOidcDoc = cloneDeep(oidcDoc)
providers.oidc = oidcDoc
}
try {
const scimConfig = await API.getConfig(ConfigTypes.SCIM)
scimEnabled = scimConfig?.enabled
} catch (error) {
console.error(error)
notifications.error("Error fetching SCIM config")
}
})
</script>
@ -638,20 +615,7 @@
</div>
<Divider />
<Layout gap="XS" noPadding>
<div class="provider-title">
<Heading size="S">SCIM</Heading>
</div>
<Body size="S">Sync users with your identity provider.</Body>
<div class="form-row">
<Label size="L">Activated</Label>
<Toggle text="" bind:value={scimEnabled} />
</div>
</Layout>
<div>
<Button cta on:click={saveSCIM}>Save</Button>
</div>
<Scim />
{/if}
</Layout>

View File

@ -0,0 +1,62 @@
<script>
import {
Button,
Heading,
Label,
notifications,
Layout,
Body,
Toggle,
} from "@budibase/bbui"
import { onMount } from "svelte"
import { API } from "api"
const configType = "scim"
$: scimEnabled = true
async function saveConfig(config) {
// Delete unsupported fields
delete config.createdAt
delete config.updatedAt
return API.saveConfig(config)
}
async function saveSCIM() {
try {
await saveConfig({
type: configType,
enabled: scimEnabled,
})
notifications.success(`Settings saved`)
} catch (e) {
notifications.error(e.message)
return
}
}
onMount(async () => {
try {
const scimConfig = await API.getConfig(configType)
scimEnabled = scimConfig?.enabled
} catch (error) {
console.error(error)
notifications.error("Error fetching SCIM config")
}
})
</script>
<Layout gap="XS" noPadding>
<div class="provider-title">
<Heading size="S">SCIM</Heading>
</div>
<Body size="S">Sync users with your identity provider.</Body>
<div class="form-row">
<Label size="L">Activated</Label>
<Toggle text="" bind:value={scimEnabled} />
</div>
</Layout>
<div>
<Button cta on:click={saveSCIM}>Save</Button>
</div>