Hide upgrade button on enterprise plan

This commit is contained in:
Rory Powell 2023-03-02 08:58:54 +00:00
parent c49eb26377
commit a80d963c88
2 changed files with 7 additions and 3 deletions

View File

@ -1,11 +1,11 @@
<script> <script>
import { Button } from "@budibase/bbui" import { Button } from "@budibase/bbui"
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import { auth, admin } from "stores/portal" import { auth, admin, licensing } from "stores/portal"
import { isEnabled, TENANT_FEATURE_FLAGS } from "helpers/featureFlags" import { isEnabled, TENANT_FEATURE_FLAGS } from "helpers/featureFlags"
</script> </script>
{#if isEnabled(TENANT_FEATURE_FLAGS.LICENSING)} {#if isEnabled(TENANT_FEATURE_FLAGS.LICENSING) && !$licensing.isEnterprisePlan}
{#if $admin.cloud && $auth?.user?.accountPortalAccess} {#if $admin.cloud && $auth?.user?.accountPortalAccess}
<Button <Button
cta cta

View File

@ -12,6 +12,7 @@ export const createLicensingStore = () => {
// the top level license // the top level license
license: undefined, license: undefined,
isFreePlan: true, isFreePlan: true,
isEnterprisePlan: true,
// features // features
groupsEnabled: false, groupsEnabled: false,
backupsEnabled: false, backupsEnabled: false,
@ -53,7 +54,9 @@ export const createLicensingStore = () => {
}, },
setLicense: () => { setLicense: () => {
const license = get(auth).user.license const license = get(auth).user.license
const isFreePlan = license?.plan.type === Constants.PlanType.FREE const planType = license?.plan.type
const isEnterprisePlan = planType === Constants.PlanType.ENTERPRISE
const isFreePlan = planType === Constants.PlanType.FREE
const groupsEnabled = license.features.includes( const groupsEnabled = license.features.includes(
Constants.Features.USER_GROUPS Constants.Features.USER_GROUPS
) )
@ -74,6 +77,7 @@ export const createLicensingStore = () => {
return { return {
...state, ...state,
license, license,
isEnterprisePlan,
isFreePlan, isFreePlan,
groupsEnabled, groupsEnabled,
backupsEnabled, backupsEnabled,