Check error limit conditions explicitly
This commit is contained in:
parent
005c61d18b
commit
8c71b1fc19
|
@ -62,6 +62,7 @@
|
||||||
"@budibase/frontend-core": "0.0.1",
|
"@budibase/frontend-core": "0.0.1",
|
||||||
"@budibase/shared-core": "0.0.1",
|
"@budibase/shared-core": "0.0.1",
|
||||||
"@budibase/string-templates": "0.0.1",
|
"@budibase/string-templates": "0.0.1",
|
||||||
|
"@budibase/types": "0.0.1",
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.2.1",
|
"@fortawesome/fontawesome-svg-core": "^6.2.1",
|
||||||
"@fortawesome/free-brands-svg-icons": "^6.2.1",
|
"@fortawesome/free-brands-svg-icons": "^6.2.1",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { auth, admin } from "stores/portal"
|
||||||
import { Constants } from "@budibase/frontend-core"
|
import { Constants } from "@budibase/frontend-core"
|
||||||
import { StripeStatus } from "components/portal/licensing/constants"
|
import { StripeStatus } from "components/portal/licensing/constants"
|
||||||
import { TENANT_FEATURE_FLAGS, isEnabled } from "helpers/featureFlags"
|
import { TENANT_FEATURE_FLAGS, isEnabled } from "helpers/featureFlags"
|
||||||
import dayjs from "dayjs"
|
import { Hosting, PlanModel } from "@budibase/types"
|
||||||
|
|
||||||
const UNLIMITED = -1
|
const UNLIMITED = -1
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ export const createLicensingStore = () => {
|
||||||
// user limits
|
// user limits
|
||||||
userCount: undefined,
|
userCount: undefined,
|
||||||
userLimit: undefined,
|
userLimit: undefined,
|
||||||
userLimitDays: undefined,
|
|
||||||
userLimitReached: false,
|
userLimitReached: false,
|
||||||
errUserLimit: false,
|
errUserLimit: false,
|
||||||
}
|
}
|
||||||
|
@ -205,9 +204,10 @@ export const createLicensingStore = () => {
|
||||||
const userCount = usage.usageQuota.users
|
const userCount = usage.usageQuota.users
|
||||||
const userLimitReached = usersLimitReached(userCount, userLimit)
|
const userLimitReached = usersLimitReached(userCount, userLimit)
|
||||||
const userLimitExceeded = usersLimitExceeded(userCount, userLimit)
|
const userLimitExceeded = usersLimitExceeded(userCount, userLimit)
|
||||||
const days = dayjs(userQuota?.startDate).diff(dayjs(), "day")
|
const errUserLimit = license.account.hosting === Hosting.CLOUD &&
|
||||||
const userLimitDays = days > 1 ? `${days} days` : "1 day"
|
license.plan.model === PlanModel.PER_USER &&
|
||||||
const errUserLimit = userQuota?.startDate && userLimitExceeded
|
userQuota.usage.static.users.value !== UNLIMITED &&
|
||||||
|
userLimitExceeded
|
||||||
|
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
return {
|
return {
|
||||||
|
@ -222,7 +222,6 @@ export const createLicensingStore = () => {
|
||||||
// user limits
|
// user limits
|
||||||
userCount,
|
userCount,
|
||||||
userLimit,
|
userLimit,
|
||||||
userLimitDays,
|
|
||||||
userLimitReached,
|
userLimitReached,
|
||||||
errUserLimit,
|
errUserLimit,
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@budibase/types": ["../types/src"],
|
|
||||||
"@budibase/backend-core": ["../backend-core/src"],
|
"@budibase/backend-core": ["../backend-core/src"],
|
||||||
"@budibase/backend-core/*": ["../backend-core/*.js"]
|
"@budibase/backend-core/*": ["../backend-core/*.js"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue