Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: subscription page ui (#15343)
ecmadaoe2fa6bd6750a
diff --git a/frontend/src/components/WorkspaceInstanceLicenseStats.vue b/frontend/src/components/WorkspaceInstanceLicenseStats.vueindex 124609e3ec..701b84500b 100644--- a/frontend/src/components/WorkspaceInstanceLicenseStats.vue+++ b/frontend/src/components/WorkspaceInstanceLicenseStats.vue@@ -1,5 +1,5 @@<template>- <div class="my-3">+ <div v-bind="$attrs"><dt class="text-main">{{subscriptionStore.currentPlan === PlanType.FREEdiff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 5730cb4df0..f70302de57 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -2079,6 +2079,7 @@"n-license-remain": "remain {n}","manage-license": "Manage Instance License","used-and-total-license": "Assigned / Total Instance License",+ "used-and-total-user": "Active / Total User Limit","success-notification": "Successfully update license assignment","missing-license-for-feature": "Missing instance license to enable {feature}. Click to assign now."},diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 8b73be4cca..f5066f307b 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -2079,6 +2079,7 @@"n-license-remain": "permanecer {n}","manage-license": "Administrar licencia","used-and-total-license": "Licencia asignada / total",+ "used-and-total-user": "Límite de usuarios activos/totales","success-notification": "Actualizar correctamente la asignación de licencia","missing-license-for-feature": "Falta la licencia de instancia para habilitar {feature}. Haga clic para asignar ahora."},@@ -2719,4 +2720,4 @@"last-visit": "Última visita","changelog-for-version": "Registro de cambios para {version}"}-}+}\ No newline at end of filediff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 02e1bf8a88..014710b19c 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -2079,6 +2079,7 @@"n-license-remain": "残り {n}","manage-license": "ライセンスの管理","used-and-total-license": "割り当てられた/合計インスタンスライセンス",+ "used-and-total-user": "アクティブ/合計ユーザー制限","success-notification": "ライセンスの割り当てが正常に更新されました","missing-license-for-feature": "{feature} を有効にするためのインスタンスライセンスがありません。クリックしてライセンスを割り当てます。"},@@ -2719,4 +2720,4 @@"last-visit": "最終訪問","changelog-for-version": "{version} の変更履歴"}-}+}\ No newline at end of filediff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex b8b997e9a8..60cd62c686 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -2079,6 +2079,7 @@"n-license-remain": "còn lại {n}","manage-license": "Quản lý giấy phép phiên bản","used-and-total-license": "Giấy phép phiên bản đã gán / Tổng số",+ "used-and-total-user": "Giới hạn người dùng đang hoạt động / Tổng số","success-notification": "Đã cập nhật thành công gán giấy phép","missing-license-for-feature": "Thiếu giấy phép phiên bản để bật {feature}. Nhấp để gán ngay."},@@ -2719,4 +2720,4 @@"last-visit": "Lần truy cập cuối","changelog-for-version": "Nhật ký thay đổi cho phiên bản {version}"}-}+}\ No newline at end of filediff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex bd561553b3..4bf58a931b 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -2079,6 +2079,7 @@"n-license-remain": "剩余 {n}","manage-license": "管理证书","used-and-total-license": "已分配 / 总实例证书",+ "used-and-total-user": "活跃/总用户限制","success-notification": "证书分配更新成功","missing-license-for-feature": "缺少实例证书以启用{feature}。点击去分配证书。"},@@ -2719,4 +2720,4 @@"last-visit": "上次访问","changelog-for-version": "{version} 的更新日志"}-}+}\ No newline at end of filediff --git a/frontend/src/store/modules/v1/subscription.ts b/frontend/src/store/modules/v1/subscription.tsindex 2d4b655a33..8b9341f9e8 100644--- a/frontend/src/store/modules/v1/subscription.ts+++ b/frontend/src/store/modules/v1/subscription.ts@@ -93,7 +93,7 @@ export const useSubscriptionV1Store = defineStore("subscription_v1", {return dayjs(getDateForPbTimestamp(state.subscription.expiresTime)- ).format("YYYY-MM-DD HH:mm:ss");+ ).format("YYYY/MM/DD HH:mm:ss");},isTrialing(state): boolean {return !!state.subscription?.trialing;diff --git a/frontend/src/views/SettingWorkspaceSubscription.vue b/frontend/src/views/SettingWorkspaceSubscription.vueindex e9f83405b1..7269860db0 100644--- a/frontend/src/views/SettingWorkspaceSubscription.vue+++ b/frontend/src/views/SettingWorkspaceSubscription.vue@@ -1,8 +1,10 @@<template><div class="w-full mx-auto">- <div class="w-full grid grid-cols-2 gap-x-6 lg:grid-cols-3 my-4">- <dl class="flex flex-col text-left">- <dt class="flex text-main">+ <div+ class="w-full grid grid-cols-2 gap-6 lg:grid-cols-3 3xl:grid-cols-4 my-4"+ >+ <div class="flex flex-col text-left">+ <div class="flex text-main">{{ $t("subscription.current") }}<spanv-if="isExpired"@@ -16,22 +18,25 @@>{{ $t("subscription.trialing") }}</span>- </dt>- <dd class="text-indigo-600 mt-1 text-3xl lg:text-4xl">+ </div>+ <div class="text-indigo-600 mt-1 text-3xl lg:text-4xl">{{ currentPlan }}- </dd>- </dl>- <dl v-if="!subscriptionStore.isFreePlan" class="my-3">- <dt class="text-main">+ </div>+ </div>+ <div v-if="!subscriptionStore.isFreePlan" class="flex flex-col text-left">+ <div class="text-main">{{ $t("subscription.expires-at") }}- </dt>+ </div><dd class="mt-1 text-3xl lg:text-4xl">{{ expireAt || "N/A" }}</dd>- </dl>- <dl v-if="subscriptionStore.canTrial && allowEdit" class="my-3">- <dt class="text-main">+ </div>+ <div+ v-if="subscriptionStore.canTrial && allowEdit"+ class="flex flex-col text-left"+ >+ <div class="text-main">{{ $t("subscription.try-for-free") }}- </dt>- <dd class="mt-1">+ </div>+ <div class="mt-1"><NButtontype="primary"size="large"@@ -43,27 +48,35 @@})}}</NButton>- </dd>- </dl>- <dl+ </div>+ </div>+ <divv-if="subscriptionStore.isTrialing &&subscriptionStore.currentPlan == PlanType.ENTERPRISE"- class="my-3"+ class="flex flex-col text-left">- <dt class="text-main">+ <div class="text-main">{{ $t("subscription.inquire-enterprise-plan") }}- </dt>- <dd class="mt-1 ml-auto">+ </div>+ <div class="mt-1 ml-auto"><NButton type="primary" size="large" @click="inquireEnterprise">{{ $t("subscription.contact-us") }}</NButton>- </dd>- </dl>- </div>- <div class="text-left grid grid-cols-2 gap-x-6 my-4 xl:grid-cols-3">+ </div>+ </div><WorkspaceInstanceLicenseStats v-if="allowManageInstanceLicenses" />+ <div class="flex flex-col text-left">+ <div class="text-main">+ {{ $t("subscription.instance-assignment.used-and-total-user") }}+ </div>+ <div class="mt-1 text-4xl flex items-center gap-2">+ {{ userCount }}+ <span class="font-mono text-gray-500">/</span>+ {{ userLimit }}+ </div>+ </div></div><NDivider /><div>@@ -92,20 +105,26 @@</NButton></div></div>- <div v-if="subscriptionStore.isSelfHostLicense" class="textinfolabel mb-4">- {{ $t("subscription.description") }}- {{ $t("subscription.plan-compare") }}- <LearnMoreLink url="https://www.bytebase.com/pricing?source=console" />- <span v-if="subscriptionStore.canTrial" class="ml-1">- <span class="text-accent cursor-pointer" @click="openTrialModal">- {{ $t("subscription.plan.try") }}- </span>- </span>- </div><divv-if="allowEdit && subscriptionStore.isSelfHostLicense"class="w-full mt-4 flex flex-col">+ <label class="flex items-center gap-x-2">+ <span class="text-main">+ {{ $t("subscription.upload-license") }}+ </span>+ </label>+ <div class="mb-3 text-sm text-gray-400">+ {{ $t("subscription.description") }}+ {{ $t("subscription.plan-compare") }}+ <LearnMoreLink url="https://www.bytebase.com/pricing?source=console" />+ <span v-if="subscriptionStore.canTrial" class="ml-1">+ <span class="text-accent cursor-pointer" @click="openTrialModal">+ {{ $t("subscription.plan.try") }}+ </span>+ </span>+ </div>+<NInputv-model:value="state.license"type="textarea"@@ -150,9 +169,11 @@ import {pushNotification,useSubscriptionV1Store,useSettingV1Store,+ useUserStore,} from "@/store";import { ENTERPRISE_INQUIRE_LINK } from "@/types";import { PlanType } from "@/types/proto/v1/subscription_service";+import { UserType } from "@/types/proto/v1/user_service";import { hasWorkspacePermissionV2 } from "@/utils";interface LocalState {@@ -170,6 +191,7 @@ const { t } = useI18n();const { locale } = useLanguage();const subscriptionStore = useSubscriptionV1Store();const settingV1Store = useSettingV1Store();+const userStore = useUserStore();const state = reactive<LocalState>({loading: false,@@ -182,6 +204,21 @@ const disabled = computed((): boolean => {return state.loading || !state.license;});+const userCount = computed(() => {+ return userStore.activeUserList.filter(+ (user) =>+ user.userType === UserType.USER ||+ user.userType === UserType.SERVICE_ACCOUNT+ ).length;+});++const userLimit = computed((): string => {+ if (subscriptionStore.userCountLimit === Number.MAX_VALUE) {+ return t("subscription.unlimited");+ }+ return `${subscriptionStore.userCountLimit}`;+});+const workspaceIdField = ref<HTMLInputElement | null>(null);const workspaceId = computed(() => {