Merge pull request #7945 from Budibase/fix/licensing-overlay-flags
Fix to ensure licensing flags display correctly
This commit is contained in:
commit
2e5c670f75
|
@ -8,7 +8,6 @@
|
||||||
import { ExpiringKeys } from "./constants"
|
import { ExpiringKeys } from "./constants"
|
||||||
import { getBanners } from "./licensingBanners"
|
import { getBanners } from "./licensingBanners"
|
||||||
import { banner } from "@budibase/bbui"
|
import { banner } from "@budibase/bbui"
|
||||||
import { FEATURE_FLAGS, isEnabled } from "../../../helpers/featureFlags"
|
|
||||||
|
|
||||||
const oneDayInSeconds = 86400
|
const oneDayInSeconds = 86400
|
||||||
|
|
||||||
|
@ -18,8 +17,8 @@
|
||||||
let paymentFailedModal
|
let paymentFailedModal
|
||||||
let accountDowngradeModal
|
let accountDowngradeModal
|
||||||
let userLoaded = false
|
let userLoaded = false
|
||||||
let loaded = false
|
|
||||||
let licensingLoaded = false
|
let licensingLoaded = false
|
||||||
|
let domLoaded = false
|
||||||
let currentModalCfg = null
|
let currentModalCfg = null
|
||||||
|
|
||||||
const processModals = () => {
|
const processModals = () => {
|
||||||
|
@ -82,12 +81,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: if (!userLoaded && $auth.user) {
|
||||||
|
userLoaded = true
|
||||||
|
}
|
||||||
|
|
||||||
$: if (
|
$: if (
|
||||||
userLoaded &&
|
userLoaded &&
|
||||||
licensingLoaded &&
|
$licensing.usageMetrics &&
|
||||||
loaded &&
|
domLoaded &&
|
||||||
isEnabled(FEATURE_FLAGS.LICENSING)
|
!licensingLoaded
|
||||||
) {
|
) {
|
||||||
|
licensingLoaded = true
|
||||||
queuedModals = processModals()
|
queuedModals = processModals()
|
||||||
queuedBanners = getBanners()
|
queuedBanners = getBanners()
|
||||||
showNextModal()
|
showNextModal()
|
||||||
|
@ -95,18 +99,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
auth.subscribe(state => {
|
domLoaded = true
|
||||||
if (state.user && !userLoaded) {
|
|
||||||
userLoaded = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
licensing.subscribe(state => {
|
|
||||||
if (state.usageMetrics && !licensingLoaded) {
|
|
||||||
licensingLoaded = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
loaded = true
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
const initiateAppCreation = () => {
|
const initiateAppCreation = () => {
|
||||||
if ($licensing.usageMetrics.apps >= 100) {
|
if ($licensing?.usageMetrics?.apps >= 100) {
|
||||||
appLimitModal.show()
|
appLimitModal.show()
|
||||||
} else {
|
} else {
|
||||||
template = null
|
template = null
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const initiateAppImport = () => {
|
const initiateAppImport = () => {
|
||||||
if ($licensing.usageMetrics.apps >= 100) {
|
if ($licensing?.usageMetrics?.apps >= 100) {
|
||||||
appLimitModal.show()
|
appLimitModal.show()
|
||||||
} else {
|
} else {
|
||||||
template = { fromFile: true }
|
template = { fromFile: true }
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const initiateAppCreation = async () => {
|
const initiateAppCreation = async () => {
|
||||||
if ($licensing.usageMetrics.apps >= 100) {
|
if ($licensing?.usageMetrics?.apps >= 100) {
|
||||||
appLimitModal.show()
|
appLimitModal.show()
|
||||||
} else if ($apps?.length) {
|
} else if ($apps?.length) {
|
||||||
$goto("/builder/portal/apps/create")
|
$goto("/builder/portal/apps/create")
|
||||||
|
|
|
@ -17,7 +17,7 @@ export const createLicensingStore = () => {
|
||||||
// the currently used quotas from the db
|
// the currently used quotas from the db
|
||||||
quotaUsage: undefined,
|
quotaUsage: undefined,
|
||||||
// derived quota metrics for percentages used
|
// derived quota metrics for percentages used
|
||||||
usageMetrics: {},
|
usageMetrics: undefined,
|
||||||
// quota reset
|
// quota reset
|
||||||
quotaResetDaysRemaining: undefined,
|
quotaResetDaysRemaining: undefined,
|
||||||
quotaResetDate: undefined,
|
quotaResetDate: undefined,
|
||||||
|
|
Loading…
Reference in New Issue