Skip to content

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

chore: license expires banner (#15068)

boojack3b4d1d39f162
diff --git a/frontend/src/components/BannersWrapper.vue b/frontend/src/components/BannersWrapper.vue
index b11091fce4..1a326d0996 100644
--- a/frontend/src/components/BannersWrapper.vue
+++ b/frontend/src/components/BannersWrapper.vue
@@ -26,6 +26,7 @@
import { storeToRefs } from "pinia";
import { computed } from "vue";
import {
+ LICENSE_EXPIRATION_THRESHOLD,
useActuatorV1Store,
useAppFeature,
useSubscriptionV1Store,
@@ -44,8 +45,13 @@ const subscriptionStore = useSubscriptionV1Store();
const hideBanner = useAppFeature("bb.feature.hide-banner");
const { isDemo, isReadonly, needConfigureExternalUrl } =
storeToRefs(actuatorStore);
-const { isExpired, isTrialing, currentPlan, existTrialLicense } =
- storeToRefs(subscriptionStore);
+const {
+ isExpired,
+ isTrialing,
+ currentPlan,
+ existTrialLicense,
+ daysBeforeExpire,
+} = storeToRefs(subscriptionStore);
const shouldShowDemoBanner = computed(() => {
if (!actuatorStore.serverInfo) return false;
@@ -56,6 +62,8 @@ const shouldShowSubscriptionBanner = computed(() => {
return (
isExpired.value ||
isTrialing.value ||
+ (currentPlan.value !== PlanType.FREE &&
+ daysBeforeExpire.value <= LICENSE_EXPIRATION_THRESHOLD) ||
(currentPlan.value === PlanType.FREE && existTrialLicense.value)
);
});
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 76388b86d6..9d58b57f36 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -321,7 +321,8 @@
}
},
"banner": {
- "license-expires": "Your license for {plan} has expired on {expireAt}.",
+ "license-expired": "Your license for {plan} has expired on {expireAt}.",
+ "license-expires": "Your license for {plan} will expires in {days} days on {expireAt}.",
"trial-expires": "Your free trial for {plan} will expire in {days} days on {expireAt}.",
"trial-expired": "Your free trial for {plan} has expired.",
"deploy": "Self Host",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index a2ebdbda5e..cc39dff243 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -321,6 +321,7 @@
}
},
"banner": {
+ "license-expired": "Su licencia para {plan} ha expirado el {expireAt}.",
"license-expires": "Su licencia para {plan} ha caducado el {expireAt}.",
"trial-expires": "Su prueba gratuita para {plan} caducará en {days} días el {expireAt}.",
"trial-expired": "Su prueba gratuita de {plan} ha caducado.",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index feacee751d..b3d5654cc3 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -321,6 +321,7 @@
}
},
"banner": {
+ "license-expired": "{plan} のライセンスは {expireAt} に期限切れになりました。",
"license-expires": "{plan} ライセンスは {expireAt} に期限切れになりました",
"trial-expires": "{plan} トライアルは {days} 日後に期限切れになります",
"trial-expired": "{plan} のトライアル期間が終了しました",
diff --git a/frontend/src/locales/subscription/en-US.json b/frontend/src/locales/subscription/en-US.json
index 8bd433cc6c..26221e3247 100644
--- a/frontend/src/locales/subscription/en-US.json
+++ b/frontend/src/locales/subscription/en-US.json
@@ -7,6 +7,7 @@
"start-free-trial": "Start free trial",
"free-trial": "You can start a free trial for 14 days - no credit card required",
"purchase-license": "Purchase a License",
+ "update-license": "Update license",
"sensitive-placeholder": "Paste your license here - write only",
"plan-compare": "Compare features between different plans",
"disabled-feature": "This is a premium feature in subscription plan",
diff --git a/frontend/src/locales/subscription/es-ES.json b/frontend/src/locales/subscription/es-ES.json
index 1cf8ef0a40..53481fb09e 100644
--- a/frontend/src/locales/subscription/es-ES.json
+++ b/frontend/src/locales/subscription/es-ES.json
@@ -7,6 +7,7 @@
"start-free-trial": "Comience la prueba gratuita",
"free-trial": "Puede comenzar una prueba gratuita durante 14 días - no se requiere tarjeta de crédito",
"purchase-license": "Comprar una Licencia",
+ "update-license": "Actualizar licencia",
"sensitive-placeholder": "Pegue su licencia aquí - solo escritura",
"plan-compare": "Compara características entre los diferentes planes",
"disabled-feature": "Esta es una función premium en el plan de suscripción",
diff --git a/frontend/src/locales/subscription/ja-JP.json b/frontend/src/locales/subscription/ja-JP.json
index 34ebfc9da7..2e0d7c4057 100644
--- a/frontend/src/locales/subscription/ja-JP.json
+++ b/frontend/src/locales/subscription/ja-JP.json
@@ -7,6 +7,7 @@
"start-free-trial": "無料トライアルを開始する",
"free-trial": "14日間の無料トライアルを開始できます - クレジットカードは必要ありません",
"purchase-license": "ライセンスを購入する",
+ "update-license": "ライセンスの更新",
"sensitive-placeholder": "ここにライセンスを貼り付けてください - 書き込みのみ",
"plan-compare": "異なるプラン間の機能を比較する",
"disabled-feature": "これはサブスクリプションプランのプレミアム機能です",
diff --git a/frontend/src/locales/subscription/zh-CN.json b/frontend/src/locales/subscription/zh-CN.json
index 5ccb272d2c..ccfab4c16d 100644
--- a/frontend/src/locales/subscription/zh-CN.json
+++ b/frontend/src/locales/subscription/zh-CN.json
@@ -7,6 +7,7 @@
"start-free-trial": "开始免费试用",
"free-trial": "您可以免费试用 14 天 - 无需信用卡或预付费",
"purchase-license": "购买证书",
+ "update-license": "更新证书",
"sensitive-placeholder": "粘贴您的证书 - 仅写入",
"plan-compare": "比较不同版本的功能,寻找适合您的方案",
"disabled-feature": "这是一个订阅版高级功能",
@@ -196,4 +197,4 @@
"2fa": "双重认证 (2FA)",
"custom-approval": "自定义审批"
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index b0f6cd1b4b..a459ee12c5 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -321,7 +321,8 @@
}
},
"banner": {
- "license-expires": "您的{plan}证书已在 {expireAt} 过期",
+ "license-expired": "您的{plan}证书已在 {expireAt} 过期",
+ "license-expires": "您的{plan}证书将在 {days} 天后过期",
"trial-expires": "您的{plan}试用将在 {days} 天后过期",
"trial-expired": "您的{plan}试用已过期",
"deploy": "本地部署",
@@ -2752,4 +2753,4 @@
"last-visit": "上次访问",
"changelog-for-version": "{version} 的更新日志"
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/store/modules/v1/subscription.ts b/frontend/src/store/modules/v1/subscription.ts
index d7c0292421..054245d7c6 100644
--- a/frontend/src/store/modules/v1/subscription.ts
+++ b/frontend/src/store/modules/v1/subscription.ts
@@ -17,6 +17,10 @@ import {
} from "@/types/proto/v1/subscription_service";
import { useSettingV1Store } from "./setting";
+// The threshold of days before the license expiration date to show the warning.
+// Default is 7 days.
+export const LICENSE_EXPIRATION_THRESHOLD = 7;
+
interface SubscriptionState {
subscription: Subscription | undefined;
trialingDays: number;
diff --git a/frontend/src/views/BannerSubscription.vue b/frontend/src/views/BannerSubscription.vue
index f73bfac0d3..3dcf5a84a2 100644
--- a/frontend/src/views/BannerSubscription.vue
+++ b/frontend/src/views/BannerSubscription.vue
@@ -3,30 +3,7 @@
<div class="mx-auto py-1 px-3">
<div class="flex items-center justify-center flex-wrap space-x-2">
<p class="ml-3 text-base font-medium text-white truncate">
- <span v-if="isExpired">
- {{
- $t("banner.license-expires", {
- plan: currentPlanText,
- expireAt: expireAt,
- })
- }}
- </span>
- <span v-else-if="currentPlan === PlanType.FREE && existTrialLicense">
- {{
- $t("banner.trial-expired", {
- plan: $t("subscription.plan.enterprise.title"),
- })
- }}
- </span>
- <span v-else-if="isTrialing">
- {{
- $t("banner.trial-expires", {
- plan: currentPlanText,
- days: daysBeforeExpire,
- expireAt: expireAt,
- })
- }}
- </span>
+ {{ content }}
</p>
<router-link
:to="{ name: SETTING_ROUTE_WORKSPACE_SUBSCRIPTION }"
@@ -37,7 +14,7 @@
$t(
isTrialing
? "subscription.purchase-license"
- : "banner.update-license"
+ : "subscription.update-license"
)
}}
<heroicons-outline:shopping-cart class="ml-1 h-6 w-6 text-white" />
@@ -52,11 +29,11 @@ import { storeToRefs } from "pinia";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { SETTING_ROUTE_WORKSPACE_SUBSCRIPTION } from "@/router/dashboard/workspaceSetting";
-import { useSubscriptionV1Store } from "@/store";
+import { LICENSE_EXPIRATION_THRESHOLD, useSubscriptionV1Store } from "@/store";
import { PlanType } from "@/types/proto/v1/subscription_service";
-const subscriptionStore = useSubscriptionV1Store();
const { t } = useI18n();
+const subscriptionStore = useSubscriptionV1Store();
const currentPlanText = computed((): string => {
const plan = subscriptionStore.currentPlan;
@@ -70,6 +47,37 @@ const currentPlanText = computed((): string => {
}
});
+const content = computed(() => {
+ if (currentPlan.value !== PlanType.FREE) {
+ if (isTrialing.value) {
+ return t("banner.trial-expires", {
+ plan: currentPlanText.value,
+ days: daysBeforeExpire.value,
+ expireAt: expireAt.value,
+ });
+ }
+ if (isExpired.value) {
+ return t("banner.license-expired", {
+ plan: currentPlanText.value,
+ expireAt: expireAt.value,
+ });
+ } else if (daysBeforeExpire.value <= LICENSE_EXPIRATION_THRESHOLD) {
+ return t("banner.license-expires", {
+ plan: currentPlanText.value,
+ days: daysBeforeExpire.value,
+ expireAt: expireAt.value,
+ });
+ }
+ } else {
+ if (existTrialLicense.value) {
+ return t("banner.trial-expired", {
+ plan: t("subscription.plan.enterprise.title"),
+ });
+ }
+ }
+ return "";
+});
+
const {
expireAt,
isExpired,