Fix default oidc icons

This commit is contained in:
Rory Powell 2023-02-28 16:21:54 +00:00
parent db28c5006c
commit c6a22282f7
4 changed files with 26 additions and 8 deletions

View File

@ -24,6 +24,7 @@
export let getOptionLabel = option => option export let getOptionLabel = option => option
export let getOptionValue = option => option export let getOptionValue = option => option
export let getOptionIcon = () => null export let getOptionIcon = () => null
export let useOptionIconImage = false
export let getOptionColour = () => null export let getOptionColour = () => null
export let open = false export let open = false
export let readonly = false export let readonly = false
@ -186,7 +187,16 @@
> >
{#if getOptionIcon(option, idx)} {#if getOptionIcon(option, idx)}
<span class="option-extra icon"> <span class="option-extra icon">
<Icon size="S" name={getOptionIcon(option, idx)} /> {#if useOptionIconImage}
<img
src={getOptionIcon(option, idx)}
alt="icon"
width="15"
height="15"
/>
{:else}
<Icon size="S" name={getOptionIcon(option, idx)} />
{/if}
</span> </span>
{/if} {/if}
{#if getOptionColour(option, idx)} {#if getOptionColour(option, idx)}

View File

@ -11,6 +11,7 @@
export let getOptionLabel = option => option export let getOptionLabel = option => option
export let getOptionValue = option => option export let getOptionValue = option => option
export let getOptionIcon = () => null export let getOptionIcon = () => null
export let useOptionIconImage = false
export let getOptionColour = () => null export let getOptionColour = () => null
export let isOptionEnabled export let isOptionEnabled
export let readonly = false export let readonly = false
@ -69,6 +70,7 @@
{getOptionLabel} {getOptionLabel}
{getOptionValue} {getOptionValue}
{getOptionIcon} {getOptionIcon}
{useOptionIconImage}
{getOptionColour} {getOptionColour}
{isOptionEnabled} {isOptionEnabled}
{autocomplete} {autocomplete}

View File

@ -14,6 +14,7 @@
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 => option?.icon export let getOptionIcon = option => option?.icon
export let useOptionIconImage = false
export let getOptionColour = option => option?.colour export let getOptionColour = option => option?.colour
export let isOptionEnabled export let isOptionEnabled
export let quiet = false export let quiet = false
@ -52,6 +53,7 @@
{getOptionValue} {getOptionValue}
{getOptionIcon} {getOptionIcon}
{getOptionColour} {getOptionColour}
{useOptionIconImage}
{isOptionEnabled} {isOptionEnabled}
{autocomplete} {autocomplete}
{customPopoverHeight} {customPopoverHeight}

View File

@ -305,14 +305,17 @@
} }
if (oidcLogos?.config) { if (oidcLogos?.config) {
const logoKeys = Object.keys(oidcLogos.config) const logoKeys = Object.keys(oidcLogos.config)
logoKeys.map(logoKey => { logoKeys
const logoUrl = oidcLogos.config[logoKey] // don't include the etag entry in the logo config
iconDropdownOptions.unshift({ .filter(key => !key.toLowerCase().includes("etag"))
label: logoKey, .map(logoKey => {
value: logoKey, const logoUrl = oidcLogos.config[logoKey]
icon: logoUrl, iconDropdownOptions.unshift({
label: logoKey,
value: logoKey,
icon: logoUrl,
})
}) })
})
} }
// Fetch OIDC config // Fetch OIDC config
@ -484,6 +487,7 @@
<Select <Select
label="" label=""
bind:value={providers.oidc.config.configs[0].logo} bind:value={providers.oidc.config.configs[0].logo}
useOptionIconImage
options={iconDropdownOptions} options={iconDropdownOptions}
on:change={e => e.detail === "Upload" && fileinput.click()} on:change={e => e.detail === "Upload" && fileinput.click()}
/> />