Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: support upload license in ux (#494)
ecmadao3700b01c2bf5
diff --git a/frontend/src/locales/en.yml b/frontend/src/locales/en.ymlindex 9cbf5d5ed1..83ecd8c9d6 100644--- a/frontend/src/locales/en.yml+++ b/frontend/src/locales/en.yml@@ -1129,3 +1129,9 @@ label:select-values: Select values...oauth:unknown-event: Unexpeted event type, OAuth failed.+subscription:+ description: You can upload your bytebase license to unlock team/enterprise features.+ description-highlight: Purchase a license+ sensitive-placeholder: Paste your license here - write only+ upload-license: Upload license+ plan-compare: Compare features between different plansdiff --git a/frontend/src/locales/zh-CN.yml b/frontend/src/locales/zh-CN.ymlindex bf0a0561c8..59216467f3 100644--- a/frontend/src/locales/zh-CN.yml+++ b/frontend/src/locales/zh-CN.yml@@ -998,3 +998,9 @@ label:select-values: 选择值…oauth:unknown-event: 未知的事件类型,认证失败+subscription:+ description: 您可以在这里上传您购买的 bytebase 证书来解锁团队版/企业版功能。+ description-highlight: 购买证书+ sensitive-placeholder: 粘贴您的证书 - 仅写入+ upload-license: 上传证书+ plan-compare: 比较不同版本的功能,寻找适合您的方案diff --git a/frontend/src/views/SettingWorkspaceSubscription.vue b/frontend/src/views/SettingWorkspaceSubscription.vueindex 876baec061..6f6ba525bd 100644--- a/frontend/src/views/SettingWorkspaceSubscription.vue+++ b/frontend/src/views/SettingWorkspaceSubscription.vue@@ -1,21 +1,85 @@<template>- <div class="bg-white">- <div class="mx-auto">- <div class="sm:flex sm:flex-col sm:align-center">- <!-- TODO: implement license upload -->- <PricingTable />+ <div class="mx-auto">+ <div class="textinfolabel">+ {{ $t("subscription.description") }}+ <span class="text-accent">{{+ $t("subscription.description-highlight")+ }}</span>+ </div>+ <div class="w-full mt-5 flex flex-col">+ <textarea+ id="license"+ v-model="state.license"+ type="text"+ name="license"+ :placeholder="$t('subscription.sensitive-placeholder')"+ class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md"+ />+ <button+ type="button"+ :class="[+ disabled ? 'cursor-not-allowed' : '',+ 'btn-primary inline-flex justify-center ml-auto mt-3',+ ]"+ target="_blank"+ href="https://hub.bytebase.com"+ @click="uploadLicense"+ >+ {{ $t("subscription.upload-license") }}+ </button>+ </div>+ <div class="sm:flex sm:flex-col sm:align-center pt-5 mt-5 border-t">+ <div class="textinfolabel">+ {{ $t("subscription.plan-compare") }}</div>+ <PricingTable /></div></div></template><script lang="ts">+import { computed, ref, reactive } from "vue";+import { useStore } from "vuex";import PricingTable from "../components/PricingTable.vue";+interface LocalState {+ loading: boolean;+ license: string;+}+export default {- name: "SettingWorkspacePlan",+ name: "SettingWorkspaceSubscription",components: {PricingTable,},+ setup() {+ const store = useStore();++ const state = reactive<LocalState>({+ loading: false,+ license: "",+ });++ const disabled = computed((): boolean => {+ return state.loading || !state.license;+ });++ const uploadLicense = async () => {+ if (disabled.value) return;+ state.loading = true;++ try {+ await store.dispatch("subscription/patchSubscription", state.license);+ } finally {+ state.loading = false;+ }+ };++ return {+ state,+ disabled,+ uploadLicense,+ };+ },};</script>