Branding feature flag changes, config trimming and some fixes
This commit is contained in:
parent
1b6a2bebf9
commit
8131d9dc6f
|
@ -8,7 +8,7 @@
|
|||
$: platformTitleText = $organisation.platformTitle
|
||||
$: platformTitleText,
|
||||
(platformTitle =
|
||||
!$admin.isCloud && !$auth.user ? platformTitleText : "Budibase")
|
||||
!$auth.user && platformTitleText ? platformTitleText : "Budibase")
|
||||
|
||||
$: faviconUrl = $organisation.faviconUrl || "https://i.imgur.com/Xhdt1YP.png"
|
||||
|
||||
|
|
|
@ -47,12 +47,8 @@
|
|||
$: onConfigUpdate(config, mounted)
|
||||
$: init = Object.keys(config).length > 0
|
||||
|
||||
$: cloudPremium = !$licensing.isFreePlan
|
||||
$: selfhostPremium = $licensing.isEnterprisePlan || $licensing.isBusinessPlan
|
||||
$: isCloud = $admin.cloud
|
||||
|
||||
$: isLicenseLocked =
|
||||
(isCloud && !cloudPremium) || (!isCloud && !selfhostPremium)
|
||||
$: brandingEnabled = $licensing.brandingEnabled
|
||||
|
||||
const onConfigUpdate = () => {
|
||||
if (!mounted || updated || !init) {
|
||||
|
@ -152,6 +148,27 @@
|
|||
faviconPreview = null
|
||||
}
|
||||
}
|
||||
|
||||
// Trim
|
||||
const userStrings = [
|
||||
"metaTitle",
|
||||
"platformTitle",
|
||||
"loginButton",
|
||||
"loginHeading",
|
||||
"metaDescription",
|
||||
"metaImageUrl",
|
||||
]
|
||||
|
||||
const trimmed = userStrings.reduce((acc, fieldName) => {
|
||||
acc[fieldName] = config[fieldName] ? config[fieldName].trim() : undefined
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
config = {
|
||||
...config,
|
||||
...trimmed,
|
||||
}
|
||||
|
||||
try {
|
||||
// Update settings
|
||||
await organisation.save(config)
|
||||
|
@ -190,12 +207,12 @@
|
|||
<Layout gap="XS" noPadding>
|
||||
<div class="title">
|
||||
<Heading size="M">Branding</Heading>
|
||||
{#if !isCloud && !selfhostPremium}
|
||||
{#if !isCloud && !brandingEnabled}
|
||||
<Tags>
|
||||
<Tag icon="LockClosed">Business</Tag>
|
||||
</Tags>
|
||||
{/if}
|
||||
{#if isCloud && !cloudPremium}
|
||||
{#if isCloud && !brandingEnabled}
|
||||
<Tags>
|
||||
<Tag icon="LockClosed">Pro</Tag>
|
||||
</Tags>
|
||||
|
@ -226,7 +243,7 @@
|
|||
config = clone
|
||||
}}
|
||||
value={logoFile || logo}
|
||||
disabled={isLicenseLocked || saving}
|
||||
disabled={!brandingEnabled || saving}
|
||||
allowClear={true}
|
||||
/>
|
||||
</div>
|
||||
|
@ -251,7 +268,7 @@
|
|||
config = clone
|
||||
}}
|
||||
value={faviconFile || favicon}
|
||||
disabled={isLicenseLocked || saving}
|
||||
disabled={!brandingEnabled || saving}
|
||||
allowClear={true}
|
||||
/>
|
||||
</div>
|
||||
|
@ -265,7 +282,7 @@
|
|||
config = clone
|
||||
}}
|
||||
value={config.platformTitle || ""}
|
||||
disabled={!selfhostPremium || saving}
|
||||
disabled={!brandingEnabled || saving}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
@ -278,7 +295,7 @@
|
|||
config = clone
|
||||
}}
|
||||
value={!config.emailBrandingEnabled}
|
||||
disabled={isLicenseLocked || saving}
|
||||
disabled={!brandingEnabled || saving}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -300,7 +317,7 @@
|
|||
config = clone
|
||||
}}
|
||||
value={config.loginHeading || ""}
|
||||
disabled={!selfhostPremium || saving}
|
||||
disabled={!brandingEnabled || saving}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -313,7 +330,7 @@
|
|||
config = clone
|
||||
}}
|
||||
value={config.loginButton || ""}
|
||||
disabled={!selfhostPremium || saving}
|
||||
disabled={!brandingEnabled || saving}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -325,7 +342,7 @@
|
|||
config = clone
|
||||
}}
|
||||
value={!config.testimonialsEnabled}
|
||||
disabled={!selfhostPremium || saving}
|
||||
disabled={!brandingEnabled || saving}
|
||||
/>
|
||||
<Toggle
|
||||
text={"Remove license agreement"}
|
||||
|
@ -335,7 +352,7 @@
|
|||
config = clone
|
||||
}}
|
||||
value={!config.licenseAgreementEnabled}
|
||||
disabled={!selfhostPremium || saving}
|
||||
disabled={!brandingEnabled || saving}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -357,7 +374,7 @@
|
|||
config = clone
|
||||
}}
|
||||
value={config.metaImageUrl}
|
||||
disabled={isLicenseLocked || saving}
|
||||
disabled={!brandingEnabled || saving}
|
||||
/>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -369,7 +386,7 @@
|
|||
config = clone
|
||||
}}
|
||||
value={config.metaTitle}
|
||||
disabled={isLicenseLocked || saving}
|
||||
disabled={!brandingEnabled || saving}
|
||||
/>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -381,13 +398,13 @@
|
|||
config = clone
|
||||
}}
|
||||
value={config.metaDescription}
|
||||
disabled={isLicenseLocked || saving}
|
||||
disabled={!brandingEnabled || saving}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
{#if isLicenseLocked}
|
||||
{#if !brandingEnabled}
|
||||
<Button
|
||||
on:click={() => {
|
||||
if (isCloud && $auth?.user?.accountPortalAccess) {
|
||||
|
|
|
@ -17,6 +17,7 @@ export const createLicensingStore = () => {
|
|||
// features
|
||||
groupsEnabled: false,
|
||||
backupsEnabled: false,
|
||||
brandingEnabled: false,
|
||||
// the currently used quotas from the db
|
||||
quotaUsage: undefined,
|
||||
// derived quota metrics for percentages used
|
||||
|
@ -71,7 +72,9 @@ export const createLicensingStore = () => {
|
|||
const enforceableSSO = license.features.includes(
|
||||
Constants.Features.ENFORCEABLE_SSO
|
||||
)
|
||||
|
||||
const brandingEnabled = license.features.includes(
|
||||
Constants.Features.BRANDING
|
||||
)
|
||||
const auditLogsEnabled = license.features.includes(
|
||||
Constants.Features.AUDIT_LOGS
|
||||
)
|
||||
|
@ -84,6 +87,7 @@ export const createLicensingStore = () => {
|
|||
isBusinessPlan,
|
||||
groupsEnabled,
|
||||
backupsEnabled,
|
||||
brandingEnabled,
|
||||
environmentVariablesEnabled,
|
||||
auditLogsEnabled,
|
||||
enforceableSSO,
|
||||
|
|
|
@ -68,6 +68,7 @@ export const Features = {
|
|||
ENVIRONMENT_VARIABLES: "environmentVariables",
|
||||
AUDIT_LOGS: "auditLogs",
|
||||
ENFORCEABLE_SSO: "enforceableSSO",
|
||||
BRANDING: "branding",
|
||||
}
|
||||
|
||||
// Role IDs
|
||||
|
|
|
@ -4,4 +4,5 @@ export enum Feature {
|
|||
ENVIRONMENT_VARIABLES = "environmentVariables",
|
||||
AUDIT_LOGS = "auditLogs",
|
||||
ENFORCEABLE_SSO = "enforceableSSO",
|
||||
BRANDING = "branding",
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue