1
0
Fork 0
mirror of synced 2024-07-08 07:46:10 +12:00

Merge branch 'feature/oidc-support' of github.com:Budibase/budibase into feature/oidc-support

This commit is contained in:
Rory Powell 2021-07-13 17:33:08 +01:00
commit 67fbf73bdd
6 changed files with 18 additions and 28 deletions

View file

@ -18,7 +18,7 @@
export let onSelectOption = () => {} export let onSelectOption = () => {}
export let getOptionLabel = option => option export let getOptionLabel = option => option
export let getOptionValue = option => option export let getOptionValue = option => option
export let getOptionIcon = option => option export let getOptionIcon = null
export let open = false export let open = false
export let readonly = false export let readonly = false
export let quiet = false export let quiet = false
@ -45,7 +45,7 @@
> >
{#if fieldIcon} {#if fieldIcon}
<span class="icon-Placeholder-Padding"> <span class="icon-Placeholder-Padding">
<img src={fieldIcon} alt="OpenID Icon" width="20" height="15" /> <img src={fieldIcon} alt="Picker Icon" width="20" height="15" />
</span> </span>
{/if} {/if}

View file

@ -8,10 +8,9 @@
export let disabled = false export let disabled = false
export let error = null export let error = null
export let options = [] export let options = []
export let callbackOptionValue = null
export let getOptionLabel = option => option export let getOptionLabel = option => option
export let getOptionValue = option => option export let getOptionValue = option => option
export let getOptionIcon = option => option export let getOptionIcon = null
export let readonly = false export let readonly = false
export let quiet = false export let quiet = false
export let autoWidth = false export let autoWidth = false
@ -47,7 +46,7 @@
const index = options.findIndex( const index = options.findIndex(
(option, idx) => getOptionValue(option, idx) === value (option, idx) => getOptionValue(option, idx) === value
) )
return index !== -1 ? getOptionIcon(options[index], index) : value return index !== -1 ? getOptionIcon(options[index], index) : null
} }
const selectOption = value => { const selectOption = value => {
@ -71,7 +70,6 @@
{getOptionValue} {getOptionValue}
{getOptionIcon} {getOptionIcon}
{fieldIcon} {fieldIcon}
{callbackOptionValue}
isPlaceholder={value == null || value === ""} isPlaceholder={value == null || value === ""}
placeholderOption={placeholder} placeholderOption={placeholder}
isOptionSelected={option => option === value} isOptionSelected={option => option === value}

View file

@ -13,7 +13,7 @@
export let options = [] export let options = []
export let getOptionLabel = option => extractProperty(option, "label") export let getOptionLabel = option => extractProperty(option, "label")
export let getOptionValue = option => extractProperty(option, "value") export let getOptionValue = option => extractProperty(option, "value")
export let getOptionIcon = option => extractObjectProperty(option, "icon") export let getOptionIcon = option => option?.icon
export let quiet = false export let quiet = false
export let autoWidth = false export let autoWidth = false
@ -23,12 +23,6 @@
dispatch("change", e.detail) dispatch("change", e.detail)
} }
const extractObjectProperty = (value, property) => {
if (value && typeof value === "object") {
return value[property]
}
}
const extractProperty = (value, property) => { const extractProperty = (value, property) => {
if (value && typeof value === "object") { if (value && typeof value === "object") {
return value[property] return value[property]

View file

@ -4,10 +4,9 @@
import Auth0Logo from "assets/auth0-logo.png" import Auth0Logo from "assets/auth0-logo.png"
import MicrosoftLogo from "assets/microsoft-logo.png" import MicrosoftLogo from "assets/microsoft-logo.png"
import { admin } from "stores/portal" import { admin, oidc } from "stores/portal"
import { onMount } from "svelte"
export let oidcIcon
export let oidcName
let show = false let show = false
let preDefinedIcons = { let preDefinedIcons = {
@ -15,21 +14,22 @@
Auth0: Auth0Logo, Auth0: Auth0Logo,
Microsoft: MicrosoftLogo, Microsoft: MicrosoftLogo,
} }
onMount(async () => {
await oidc.init()
})
$: show = $admin.checklist?.oidc $: show = $admin.checklist?.oidc
$: src = !$oidc.logo
? OidcLogo
: preDefinedIcons[$oidc.logo] || `/global/oidc_logos/${$oidc.logo}`
</script> </script>
{#if show} {#if show}
<ActionButton on:click={() => window.open("/api/admin/auth/oidc", "_blank")}> <ActionButton on:click={() => window.open("/api/admin/auth/oidc/", "_blank")}>
<div class="inner"> <div class="inner">
<img <img {src} alt="oidc icon" />
src={!oidcIcon <p>{`Sign in with ${$oidc.name || "OIDC"}`}</p>
? OidcLogo
: preDefinedIcons[oidcIcon]
? preDefinedIcons[oidcIcon]
: `/global/oidc_logos/${oidcIcon}`}
alt="oidc icon"
/>
<p>{`Sign in with ${oidcName || "OIDC"}`}</p>
</div> </div>
</ActionButton> </ActionButton>
{/if} {/if}

View file

@ -50,7 +50,6 @@
onMount(async () => { onMount(async () => {
await organisation.init() await organisation.init()
await oidc.init()
}) })
</script> </script>

View file

@ -239,7 +239,6 @@
/> />
</div> </div>
<input <input
style="display:none"
type="file" type="file"
accept=".jpg, .jpeg, .png" accept=".jpg, .jpeg, .png"
on:change={e => onFileSelected(e)} on:change={e => onFileSelected(e)}