Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: update plan limit (#10927)

ecmadao586a3e314b0c
diff --git a/frontend/src/store/modules/v1/subscription.ts b/frontend/src/store/modules/v1/subscription.ts
index cd264bf8f8..44fb670640 100644
--- a/frontend/src/store/modules/v1/subscription.ts
+++ b/frontend/src/store/modules/v1/subscription.ts
@@ -4,10 +4,9 @@ import { computed, Ref } from "vue";
import { useI18n } from "vue-i18n";
import { subscriptionServiceClient } from "@/grpcweb";
import {
+ PLANS,
FeatureType,
planTypeToString,
- instanceCountLimit,
- userCountLimit,
instanceLimitFeature,
} from "@/types";
import { Instance } from "@/types/proto/v1/instance_service";
@@ -33,18 +32,16 @@ export const useSubscriptionV1Store = defineStore("subscription_v1", {
}),
getters: {
instanceCountLimit(state): number {
- let plan = this.currentPlan;
- if (this.isTrialing) {
- plan = PlanType.FREE;
- }
- return instanceCountLimit.get(plan) ?? 0;
+ return (
+ PLANS.find((plan) => plan.type === this.currentPlan)
+ ?.maximumInstanceCount ?? 0
+ );
},
userCountLimit(state): number {
- let plan = this.currentPlan;
- if (this.isTrialing) {
- plan = PlanType.FREE;
- }
- return userCountLimit.get(plan) ?? 0;
+ return (
+ PLANS.find((plan) => plan.type === this.currentPlan)
+ ?.maximumSeatCount ?? 0
+ );
},
instanceLicenseCount(state): number {
const count = state.subscription?.instanceCount ?? 0;
diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.ts
index 264cc80d99..bc489ffdf2 100644
--- a/frontend/src/types/plan.ts
+++ b/frontend/src/types/plan.ts
@@ -119,6 +119,8 @@ export interface Plan {
unitPrice: number;
pricePerSeatPerMonth: number;
pricePerInstancePerMonth: number;
+ maximumSeatCount: number;
+ maximumInstanceCount: number;
// Plan desc and feature
title: string;
featureList: PlanFeature[];
@@ -132,19 +134,6 @@ export const PLANS: Plan[] = planData.planList.map((raw: Plan) => ({
type: planTypeFromJSON(raw.type + 1),
}));
-// TODO: it's better to get the count limit from the backend.
-export const userCountLimit = new Map<PlanType, number>([
- [PlanType.FREE, 20],
- [PlanType.TEAM, Number.MAX_VALUE],
- [PlanType.ENTERPRISE, Number.MAX_VALUE],
-]);
-
-export const instanceCountLimit = new Map<PlanType, number>([
- [PlanType.FREE, 10],
- [PlanType.TEAM, 20],
- [PlanType.ENTERPRISE, Number.MAX_VALUE],
-]);
-
export const getFeatureLocalization = (feature: PlanFeature): PlanFeature => {
const { t } = useI18n();
for (const section of FEATURE_SECTIONS) {