Branding fixes

This commit is contained in:
Dean 2023-06-05 15:20:04 +01:00
parent 42e3ca1872
commit f20653d4ca
3 changed files with 21 additions and 20 deletions

View File

@ -44,7 +44,7 @@
let config = {} let config = {}
let updated = false let updated = false
$: onConfigUpdate(config, mounted) $: onConfigUpdate(config)
$: initialised = Object.keys(config).length > 0 $: initialised = Object.keys(config).length > 0
$: isCloud = $admin.cloud $: isCloud = $admin.cloud
@ -130,8 +130,6 @@
logoPreview = null logoPreview = null
} }
config.logoUrl = undefined config.logoUrl = undefined
} else {
config.logoUrl = ""
} }
if (faviconFile) { if (faviconFile) {
@ -141,8 +139,6 @@
faviconPreview = null faviconPreview = null
} }
config.faviconUrl = undefined config.faviconUrl = undefined
} else {
config.faviconUrl = ""
} }
} }
@ -190,7 +186,6 @@
if (!$organisation.loaded) { if (!$organisation.loaded) {
await organisation.init() await organisation.init()
} }
config = { config = {
faviconUrl: $organisation.faviconUrl, faviconUrl: $organisation.faviconUrl,
logoUrl: $organisation.logoUrl, logoUrl: $organisation.logoUrl,
@ -272,6 +267,7 @@
faviconFile = e.detail faviconFile = e.detail
faviconPreview = null faviconPreview = null
} else { } else {
faviconFile = null
clone.faviconUrl = "" clone.faviconUrl = ""
} }
config = clone config = clone
@ -418,7 +414,11 @@
Upgrade Upgrade
</Button> </Button>
{/if} {/if}
<Button on:click={saveConfig} cta disabled={saving || !updated || !init}> <Button
on:click={saveConfig}
cta
disabled={saving || !updated || !$organisation.loaded}
>
Save Save
</Button> </Button>
</div> </div>

View File

@ -23,7 +23,7 @@ const DEFAULT_CONFIG = {
oidcCallbackUrl: "", oidcCallbackUrl: "",
googleCallbackUrl: "", googleCallbackUrl: "",
isSSOEnforced: false, isSSOEnforced: false,
loaded: false loaded: false,
} }
export function createOrganisationStore() { export function createOrganisationStore() {
@ -33,7 +33,7 @@ export function createOrganisationStore() {
async function init() { async function init() {
const tenantId = get(auth).tenantId const tenantId = get(auth).tenantId
const settingsConfigDoc = await API.getTenantConfig(tenantId) const settingsConfigDoc = await API.getTenantConfig(tenantId)
set({ ...DEFAULT_CONFIG, ...settingsConfigDoc.config }) set({ ...DEFAULT_CONFIG, ...settingsConfigDoc.config, loaded: true })
} }
async function save(config) { async function save(config) {
@ -59,7 +59,7 @@ export function createOrganisationStore() {
subscribe, subscribe,
set, set,
save, save,
init init,
} }
} }

View File

@ -22,7 +22,8 @@ import {
isOIDCConfig, isOIDCConfig,
isSettingsConfig, isSettingsConfig,
isSMTPConfig, isSMTPConfig,
OIDCConfigs, SettingsBrandingConfig, OIDCConfigs,
SettingsBrandingConfig,
SettingsInnerConfig, SettingsInnerConfig,
SSOConfig, SSOConfig,
SSOConfigType, SSOConfigType,
@ -336,15 +337,6 @@ export async function publicSettings(
) )
} }
if (branding.faviconUrl && branding.faviconUrl !== "") {
// @ts-ignore
config.faviconUrl = objectStore.getGlobalFileUrl(
"settings",
"faviconUrl",
branding.faviconUrlEtag
)
}
// google // google
const googleConfig = await configs.getGoogleConfig() const googleConfig = await configs.getGoogleConfig()
const googleDatasourceConfigured = const googleDatasourceConfigured =
@ -368,6 +360,15 @@ export async function publicSettings(
config: { config: {
...config, ...config,
...branding, ...branding,
...(branding.faviconUrl && branding.faviconUrl !== ""
? {
faviconUrl: objectStore.getGlobalFileUrl(
"settings",
"faviconUrl",
branding.faviconUrlEtag
),
}
: { faviconUrl: undefined }),
google, google,
googleDatasourceConfigured, googleDatasourceConfigured,
oidc, oidc,