Break components
This commit is contained in:
parent
53020e2d2d
commit
675d3c5c65
|
@ -27,11 +27,11 @@
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
import { organisation, admin, licensing } from "stores/portal"
|
import { organisation, admin, licensing } from "stores/portal"
|
||||||
|
import Scim from "./scim.svelte"
|
||||||
|
|
||||||
const ConfigTypes = {
|
const ConfigTypes = {
|
||||||
Google: "google",
|
Google: "google",
|
||||||
OIDC: "oidc",
|
OIDC: "oidc",
|
||||||
SCIM: "scim",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const HasSpacesRegex = /[\\"\s]/
|
const HasSpacesRegex = /[\\"\s]/
|
||||||
|
@ -161,8 +161,6 @@
|
||||||
providers.oidc?.config?.configs[0].clientSecret
|
providers.oidc?.config?.configs[0].clientSecret
|
||||||
)
|
)
|
||||||
|
|
||||||
$: scimEnabled = true
|
|
||||||
|
|
||||||
const onFileSelected = e => {
|
const onFileSelected = e => {
|
||||||
let fileName = e.target.files[0].name
|
let fileName = e.target.files[0].name
|
||||||
image = e.target.files[0]
|
image = e.target.files[0]
|
||||||
|
@ -256,19 +254,6 @@
|
||||||
originalGoogleDoc = cloneDeep(providers.google)
|
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"]
|
let defaultScopes = ["profile", "email", "offline_access"]
|
||||||
|
|
||||||
const refreshScopes = idx => {
|
const refreshScopes = idx => {
|
||||||
|
@ -359,14 +344,6 @@
|
||||||
originalOidcDoc = cloneDeep(oidcDoc)
|
originalOidcDoc = cloneDeep(oidcDoc)
|
||||||
providers.oidc = 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>
|
</script>
|
||||||
|
|
||||||
|
@ -638,20 +615,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
<Layout gap="XS" noPadding>
|
<Scim />
|
||||||
<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>
|
|
||||||
{/if}
|
{/if}
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue