Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: enable auto trialing (#4695)
ecmadao58c17d541724
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 29bb89c834..a560c8798d 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1577,6 +1577,12 @@"unknown-event": "Unexpected event type, OAuth failed."},"subscription": {+ "trial-start-modal": {+ "title": "Start your {plan} trial",+ "content": "Your {plan} trial has started! You can access {plan} features before {date}.",+ "subscription-page": "subscription page",+ "subscription": "Go to the {page} to learn these features and our plans."+ },"description": "You can upload your Bytebase license to unlock team/enterprise features.","upload-license": "Upload license","upgrade-trial-button": "Upgrade trial",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex cca7b279ce..80ab12f702 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1576,6 +1576,12 @@"unknown-event": "未知的事件类型,认证失败"},"subscription": {+ "trial-start-modal": {+ "title": "已开启{plan}试用",+ "content": "您的{plan}试用已开启!在 {date} 之前所有{plan}功能将不受限制。",+ "subscription-page": "订阅页面",+ "subscription": "可以在{page}查看我们的订阅方案及付费功能。"+ },"description": "您可以在这里上传您购买的 Bytebase 证书来解锁团队版/企业版功能。","upload-license": "上传证书","upgrade-trial-button": "升级试用",diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vueindex dce34ecd61..4fba772231 100644--- a/frontend/src/views/Home.vue+++ b/frontend/src/views/Home.vue@@ -103,6 +103,59 @@{{ $t("project.overview.view-all-closed") }}</router-link></div>++ <BBModal+ v-if="state.showTrialStartModal && subscriptionStore.subscription"+ :title="+ $t('subscription.trial-start-modal.title', {+ plan: $t(+ `subscription.plan.${planTypeToString(+ subscriptionStore.subscription.plan+ ).toLowerCase()}.title`+ ),+ })+ "+ @close="onTrialingModalClose"+ >+ <div class="min-w-0 md:min-w-400 max-w-2xl">+ <div class="flex justify-center items-center">+ <img :src="planImage" class="w-56 p-4" />+ <div class="text-lg space-y-2">+ <p>+ <i18n-t keypath="subscription.trial-start-modal.content">+ <template #plan>+ <strong>+ {{+ $t(+ `subscription.plan.${planTypeToString(+ subscriptionStore.subscription.plan+ ).toLowerCase()}.title`+ )+ }}+ </strong>+ </template>+ <template #date>+ <strong>{{ subscriptionStore.expireAt }}</strong>+ </template>+ </i18n-t>+ </p>+ <p>+ <i18n-t keypath="subscription.trial-start-modal.subscription">+ <template #page>+ <router-link+ to="/setting/subscription"+ class="normal-link"+ exact-active-class=""+ >+ {{ $t("subscription.trial-start-modal.subscription-page") }}+ </router-link>+ </template>+ </i18n-t>+ </p>+ </div>+ </div>+ </div>+ </BBModal></template><script lang="ts" setup>@@ -111,12 +164,18 @@ import { useRoute, useRouter } from "vue-router";import EnvironmentTabFilter from "../components/EnvironmentTabFilter.vue";import { IssueTable } from "../components/Issue";import { activeEnvironment } from "../utils";-import { Environment, Issue } from "../types";-import { useCurrentUser, useEnvironmentStore } from "@/store";+import { Environment, Issue, planTypeToString, PlanType } from "../types";+import {+ useCurrentUser,+ useEnvironmentStore,+ useSubscriptionStore,+ useOnboardingStateStore,+} from "@/store";import PagedIssueTable from "@/components/Issue/PagedIssueTable.vue";interface LocalState {searchText: string;+ showTrialStartModal: boolean;}const OPEN_ISSUE_LIST_PAGE_SIZE = 10;@@ -125,15 +184,34 @@ const MAX_CLOSED_ISSUE = 5;const searchField = ref();const environmentStore = useEnvironmentStore();+const subscriptionStore = useSubscriptionStore();+const onboardingStateStore = useOnboardingStateStore();const router = useRouter();const route = useRoute();const state = reactive<LocalState>({searchText: "",+ showTrialStartModal: onboardingStateStore.getStateByKey(+ "show-trialing-modal"+ ),});const currentUser = useCurrentUser();+const onTrialingModalClose = () => {+ state.showTrialStartModal = false;+ onboardingStateStore.consume("show-trialing-modal");+};++const planImage = computed(() => {+ return new URL(+ `../assets/plan-${planTypeToString(+ subscriptionStore.subscription?.plan ?? PlanType.FREE+ ).toLowerCase()}.png`,+ import.meta.url+ ).href;+});+const selectedEnvironment = computed(() => {const { environment } = route.query;return environmentdiff --git a/frontend/src/views/auth/Signin.vue b/frontend/src/views/auth/Signin.vueindex b10ba40e7e..fcd3dc94d1 100644--- a/frontend/src/views/auth/Signin.vue+++ b/frontend/src/views/auth/Signin.vue@@ -249,7 +249,7 @@ onMounted(async () => {// Navigate to signup if needs admin setup.// Unable to achieve it in router.beforeEach because actuator/info is fetched async and returns// after router has already made the decision on first page load.- if (actuatorStore.needAdminSetup && !disallowSignup) {+ if (actuatorStore.needAdminSetup && !disallowSignup.value) {router.push({ name: "auth.signup", replace: true });}diff --git a/frontend/src/views/auth/Signup.vue b/frontend/src/views/auth/Signup.vueindex 84b433a28b..235d0c3300 100644--- a/frontend/src/views/auth/Signup.vue+++ b/frontend/src/views/auth/Signup.vue@@ -231,8 +231,9 @@ import {useActuatorStore,useAuthStore,useOnboardingStateStore,+ useSubscriptionStore,} from "@/store";-import { SignupInfo, TEXT_VALIDATION_DELAY } from "@/types";+import { SignupInfo, PlanType, TEXT_VALIDATION_DELAY } from "@/types";import { isValidEmail } from "@/utils";import AuthFooter from "./AuthFooter.vue";@@ -253,6 +254,7 @@ export default defineComponent({components: { AuthFooter },setup() {const actuatorStore = useActuatorStore();+ const subscriptionStore = useSubscriptionStore();const router = useRouter();const state = reactive<LocalState>({@@ -359,7 +361,14 @@ export default defineComponent({};await useAuthStore().signup(signupInfo);if (needAdminSetup.value) {- await actuatorStore.fetchServerInfo();+ await Promise.all([+ actuatorStore.fetchServerInfo(),+ (async function () {+ if (subscriptionStore.canTrial) {+ await subscriptionStore.trialSubscription(PlanType.ENTERPRISE);+ }+ })(),+ ]);// When the first time we created an end user, the server-side will// generate onboarding data.// We write a flag here to indicate that the workspace is just created