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: change plan to subscription and show subscription sidebar (#338)
tianzhou0ff7b090753b
diff --git a/frontend/src/assets/role_management_screenshot.png b/frontend/src/assets/role_management_screenshot.pngdeleted file mode 100644index 1e57db0510..0000000000Binary files a/frontend/src/assets/role_management_screenshot.png and /dev/null differdiff --git a/frontend/src/components/MemberTable.vue b/frontend/src/components/MemberTable.vueindex f533aec0f2..7fede6c02c 100644--- a/frontend/src/components/MemberTable.vue+++ b/frontend/src/components/MemberTable.vue@@ -14,37 +14,17 @@:title="$t(COLUMN_LIST[0].title)"/><BBTableHeaderCell class="w-8 table-cell" :title="$t(COLUMN_LIST[1].title)" />- <BBTableHeaderCell- class="w-72 table-cell"- :title="$t(COLUMN_LIST[2].title)"- />- <BBTableHeaderCell- class="w-auto table-cell"- :title="$t(COLUMN_LIST[3].title)"- />+ <BBTableHeaderCell class="w-72 table-cell" :title="$t(COLUMN_LIST[2].title)" />+ <BBTableHeaderCell class="w-auto table-cell" :title="$t(COLUMN_LIST[3].title)" /></template><template #body="{ rowData: member }"><BBTableCell :left-padding="4" class="table-cell"><div class="flex flex-row items-center space-x-2"><template v-if="'INVITED' == member.principal.status"><span- class="- inline-flex- items-center- px-2- py-0.5- rounded-lg- text-xs- font-semibold- bg-main- text-main-text- "- >- {{ $t("settings.members.invited") }}- </span>- <span class="textlabel">- {{ member.principal.email }}- </span>+ class="inline-flex items-center px-2 py-0.5 rounded-lg text-xs font-semibold bg-main text-main-text"+ >{{ $t("settings.members.invited") }}</span>+ <span class="textlabel">{{ member.principal.email }}</span></template><template v-else><PrincipalAvatar :principal="member.principal" />@@ -53,36 +33,19 @@<router-link:to="`/u/${member.principal.id}`"class="normal-link"- >{{ member.principal.name }}- </router-link>+ >{{ member.principal.name }}</router-link><spanv-if="currentUser.id == member.principal.id"- class="- inline-flex- items-center- px-2- py-0.5- rounded-lg- text-xs- font-semibold- bg-green-100- text-green-800- "- >- {{ $t("settings.members.yourself") }}- </span>+ class="inline-flex items-center px-2 py-0.5 rounded-lg text-xs font-semibold bg-green-100 text-green-800"+ >{{ $t("settings.members.yourself") }}</span></div>- <span class="textlabel">- {{ member.principal.email }}- </span>+ <span class="textlabel">{{ member.principal.email }}</span></div></template></div></BBTableCell><BBTableCell class="whitespace-nowrap tooltip-wrapper">- <span v-if="changeRoleTooltip(member)" class="tooltip">- {{ changeRoleTooltip(member) }}- </span>+ <span v-if="changeRoleTooltip(member)" class="tooltip">{{ changeRoleTooltip(member) }}</span><RoleSelect:selected-role="member.role":disabled="!allowChangeRole(member)"@@ -95,13 +58,9 @@</BBTableCell><BBTableCell class="table-cell"><div class="flex flex-row items-center space-x-1">- <span>- {{ humanizeTs(member.updatedTs) }}- </span>+ <span>{{ humanizeTs(member.updatedTs) }}</span><span>by</span>- <router-link :to="`/u/${member.updater.id}`" class="normal-link"- >{{ member.updater.name }}- </router-link>+ <router-link :to="`/u/${member.updater.id}`" class="normal-link">{{ member.updater.name }}</router-link></div></BBTableCell><BBTableCell>@@ -126,15 +85,6 @@</BBTableCell></template></BBTable>- <div v-if="showUpgradeInfo" class="mt-6 border-t pt-4 border-block-border">- <div class="flex flex-row items-center space-x-1">- <heroicons-solid:sparkles class="w-6 h-6 text-accent" />- <router-link to="/setting/plan" class="text-lg accent-link"- >{{ $t("settings.members.upgrade") }}</router-link- >- </div>- <img class="w-full" src="../assets/role_management_screenshot.png" />- </div></template><script lang="ts">@@ -163,7 +113,7 @@ const COLUMN_LIST: BBTableColumn[] = [];// eslint-disable-next-line @typescript-eslint/no-empty-interface-interface LocalState {}+interface LocalState { }export default {name: "MemberTable",@@ -264,11 +214,6 @@ export default {return allowEdit.value && member.rowStatus == "ARCHIVED";};- const showUpgradeInfo = computed(() => {- return false;- // return !hasAdminFeature.value && isOwner(currentUser.value.role);- });-const changeRole = (id: MemberId, role: RoleType) => {const memberPatch: MemberPatch = {role,@@ -294,7 +239,6 @@ export default {state,currentUser,hasAdminFeature,- showUpgradeInfo,dataSource,allowEdit,allowChangeRole,diff --git a/frontend/src/locales/en.yml b/frontend/src/locales/en.ymlindex 96eb12aa63..31b2e2b05c 100644--- a/frontend/src/locales/en.yml+++ b/frontend/src/locales/en.yml@@ -227,7 +227,7 @@ settings:general: Generalmembers: Membersversion-control: Version Control- plans: Plans+ subscription: Subscriptionlabels: Labelsprofile:email: Email@@ -236,7 +236,7 @@ settings:password-confirm: Confirmpassword-confirm-placeholder: Confirm new passwordpassword-mismatch: mismatch- plan: (Upgrade to Team plan to enable role management)+ subscription: (Upgrade to enable role management)members:active: Active membersinactive: Inactive members@@ -246,7 +246,7 @@ settings:invites: Send Invitesinvited: Invitedyourself: You- upgrade: Upgrade to unlock Owner and DBA roles+ upgrade: Upgrade to enable role managementselect-role: Select rolenot-assigned: Not assignedtable:@@ -261,7 +261,7 @@ settings:reactivate: Reactivatereactivate-confirm-title: Are you sure to reactivatetooltip:- upgrade: Upgrade to Team plan to enable role management+ upgrade: Upgrade to enable role managementnot-allow-edit: Only Owner can change the rolenot-allow-remove: Can not remove the last Owneractivity:diff --git a/frontend/src/locales/zh-CN.yml b/frontend/src/locales/zh-CN.ymlindex c36548d367..c04137854c 100644--- a/frontend/src/locales/zh-CN.yml+++ b/frontend/src/locales/zh-CN.yml@@ -221,7 +221,7 @@ settings:general: 通用members: 成员version-control: 版本控制- plans: 价格方案+ subscription: 订阅labels: 标签profile:email: 邮箱@@ -230,7 +230,7 @@ settings:password-confirm: 确认密码password-confirm-placeholder: 再次输入以确认password-mismatch: 密码输入不一致- plan: (升级到团队方案来开启角色管理)+ subscription: (升级到付费方案来解锁角色管理)members:active: 已激活inactive: 未激活@@ -240,7 +240,7 @@ settings:invites: 发送邀请invited: 已邀请yourself: 您自己- upgrade: 升级付费方案来解锁其他角色+ upgrade: 升级到付费方案来解锁角色管理select-role: 选择角色not-assigned: 未指派table:@@ -255,7 +255,7 @@ settings:reactivate: 启用reactivate-confirm-title: 确定启用tooltip:- upgrade: 升级到团队版来开启成员管理+ upgrade: 升级到付费方案来解锁角色管理not-allow-edit: 只有所有者才能改变角色not-allow-remove: 不能移除最后一个所有者activity:diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.tsindex 1a38a44d6e..8fec5770df 100644--- a/frontend/src/router/index.ts+++ b/frontend/src/router/index.ts@@ -319,10 +319,10 @@ const routes: Array<RouteRecordRaw> = [props: true,},{- path: "plan",- name: "setting.workspace.plan",- meta: { title: () => t("settings.sidebar.plans") },- component: () => import("../views/SettingWorkspacePlan.vue"),+ path: "subscription",+ name: "setting.workspace.subscription",+ meta: { title: () => t("settings.sidebar.subscription") },+ component: () => import("../views/SettingWorkspaceSubscription.vue"),props: true,},{diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vueindex ab5001e07d..c4dafc1d02 100644--- a/frontend/src/views/ProfileDashboard.vue+++ b/frontend/src/views/ProfileDashboard.vue@@ -1,8 +1,5 @@<template>- <main- class="flex-1 relative z-0 overflow-auto focus:outline-none xl:order-last"- tabindex="0"- >+ <main class="flex-1 relative z-0 overflow-auto focus:outline-none xl:order-last" tabindex="0"><article><!-- Profile header --><div>@@ -11,23 +8,12 @@<div class="-mt-20 sm:flex sm:items-end sm:space-x-5"><PrincipalAvatar :principal="principal" :size="'HUGE'" /><div- class="- mt-6- sm:flex-1- sm:min-w-0- sm:flex- sm:items-center- sm:justify-end- sm:space-x-6- sm:pb-1- "+ class="mt-6 sm:flex-1 sm:min-w-0 sm:flex sm:items-center sm:justify-end sm:space-x-6 sm:pb-1"><div class="mt-6 flex flex-row justify-stretch space-x-4"><button v-if="false" type="button" class="btn-normal"><!-- Heroicon name: solid/mail -->- <heroicons-solid:mail- class="-ml-1 mr-2 h-5 w-5 text-control-light"- />+ <heroicons-solid:mail class="-ml-1 mr-2 h-5 w-5 text-control-light" /><span>Message</span></button><template v-if="allowEdit">@@ -36,9 +22,7 @@type="button"class="btn-normal"@click.prevent="cancelEdit"- >- {{ $t("common.cancel") }}- </button>+ >{{ $t("common.cancel") }}</button><buttontype="button"class="btn-normal"@@ -46,22 +30,13 @@@click.prevent="saveEdit"><!-- Heroicon name: solid/save -->- <heroicons-solid:save- class="-ml-1 mr-2 h-5 w-5 text-control-light"- />+ <heroicons-solid:save class="-ml-1 mr-2 h-5 w-5 text-control-light" /><span>{{ $t("common.save") }}</span></button></template>- <button- v-else- type="button"- class="btn-normal"- @click.prevent="editUser"- >+ <button v-else type="button" class="btn-normal" @click.prevent="editUser"><!-- Heroicon name: solid/pencil -->- <heroicons-solid:pencil- class="-ml-1 mr-2 h-5 w-5 text-control-light"- />+ <heroicons-solid:pencil class="-ml-1 mr-2 h-5 w-5 text-control-light" /><span>{{ $t("common.edit") }}</span></button></template>@@ -82,9 +57,7 @@@input="updatePrincipal('name', $event.target.value)"/><!-- pb-1.5 is to avoid flicking when entering/existing the editing state -->- <h1 v-else class="pb-1.5 text-2xl font-bold text-main truncate">- {{ principal.name }}- </h1>+ <h1 v-else class="pb-1.5 text-2xl font-bold text-main truncate">{{ principal.name }}</h1></div></div></div>@@ -96,36 +69,29 @@><dl class="grid grid-cols-1 gap-x-4 gap-y-8 sm:grid-cols-2"><div class="sm:col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("settings.profile.role") }}- </dt>+ <dt class="text-sm font-medium text-control-light">{{ $t("settings.profile.role") }}</dt><dd class="mt-1 text-sm text-main"><router-link:to="'/setting/member'"class="normal-link capitalize"- >- {{ $t(`common.role.${principal.role.toLowerCase()}`) }}- </router-link>- <router-link :to="'/setting/plan'" class="normal-link">- {{ $t("settings.profile.plan") }}- </router-link>+ >{{ $t(`common.role.${principal.role.toLowerCase()}`) }}</router-link>+ <router-link+ :to="'/setting/subscription'"+ class="normal-link"+ >{{ $t("settings.profile.subscription") }}</router-link></dd></div><div class="sm:col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("settings.profile.email") }}- </dt>- <dd class="mt-1 text-sm text-main">- {{ principal.email }}- </dd>+ <dt class="text-sm font-medium text-control-light">{{ $t("settings.profile.email") }}</dt>+ <dd class="mt-1 text-sm text-main">{{ principal.email }}</dd></div><template v-if="state.editing"><div class="sm:col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("settings.profile.password") }}- </dt>+ <dt+ class="text-sm font-medium text-control-light"+ >{{ $t("settings.profile.password") }}</dt><dd class="mt-1 text-sm text-main"><inputid="password"@@ -143,9 +109,10 @@<div class="sm:col-span-1"><dt class="text-sm font-medium text-control-light">{{ $t("settings.profile.password-confirm") }}- <span v-if="passwordMismatch" class="text-error">- {{ $t("settings.profile.password-mismatch") }}- </span>+ <span+ v-if="passwordMismatch"+ class="text-error"+ >{{ $t("settings.profile.password-mismatch") }}</span></dt><dd class="mt-1 text-sm text-main"><inputdiff --git a/frontend/src/views/SettingSidebar.vue b/frontend/src/views/SettingSidebar.vueindex 87b23d9ea7..32b941ebe2 100644--- a/frontend/src/views/SettingSidebar.vue+++ b/frontend/src/views/SettingSidebar.vue@@ -23,9 +23,7 @@<router-linkto="/setting/profile"class="outline-item group w-full flex items-center pl-11 pr-2 py-2"- >- {{ $t("settings.sidebar.profile") }}- </router-link>+ >{{ $t("settings.sidebar.profile") }}</router-link></div></div><div class="mt-8">@@ -41,19 +39,17 @@class="outline-item group w-full flex items-center pl-11 pr-2 py-2">{{ $t("settings.sidebar.general") }}- </router-link> -->+ </router-link>--><!-- <router-linkto="/setting/agent"class="outline-item group w-full flex items-center pl-11 pr-2 py-2">Agents- </router-link> -->+ </router-link>--><router-linkto="/setting/member"class="outline-item group w-full flex items-center pl-11 pr-2 py-2"- >- {{ $t("settings.sidebar.members") }}- </router-link>+ >{{ $t("settings.sidebar.members") }}</router-link><!--Label Management is visible to allbut only editable to Owners and DBAs@@ -61,32 +57,26 @@<router-linkto="/setting/label"class="outline-item group w-full flex items-center pl-11 pr-2 py-2"- >- {{ $t("settings.sidebar.labels") }}- </router-link>+ >{{ $t("settings.sidebar.labels") }}</router-link><router-linkv-if="showOwnerItem"to="/setting/version-control"class="outline-item group w-full flex items-center pl-11 pr-2 py-2"- >- {{ $t("settings.sidebar.version-control") }}- </router-link>+ >{{ $t("settings.sidebar.version-control") }}</router-link><router-link- v-if="false"- to="/setting/plan"+ v-if="isDev"+ to="/setting/subscription"class="outline-item group w-full flex items-center pl-11 pr-2 py-2"- >- {{ $t("settings.sidebar.plans") }}- </router-link>+ >{{ $t("settings.sidebar.subscription") }}</router-link><!-- <router-linkto="/setting/billing"class="outline-item group w-full flex items-center pl-11 pr-2 py-2">Billing- </router-link> -->+ </router-link>--><!-- <div class="pl-9 mt-1"><BBOutline :title="'Integrations'" :itemList="integrationList" />- </div> -->+ </div>--></div></div></div>@@ -97,7 +87,7 @@import { computed, defineComponent, reactive } from "vue";import { useStore } from "vuex";import { useRouter } from "vue-router";-import { isOwner } from "../utils";+import { isOwner, isDev } from "../utils";interface LocalState {collapseState: boolean;@@ -142,6 +132,7 @@ export default defineComponent({return {state,+ isDev,integrationList,showOwnerItem,goBack,diff --git a/frontend/src/views/SettingWorkspaceMember.vue b/frontend/src/views/SettingWorkspaceMember.vueindex c52244e477..0426e785dd 100644--- a/frontend/src/views/SettingWorkspaceMember.vue+++ b/frontend/src/views/SettingWorkspaceMember.vue@@ -3,14 +3,21 @@<MemberAddOrInvite /></div><div>- <p class="text-lg font-medium leading-7 text-main">- {{ $t("settings.members.active") }}- </p>+ <div class="flex flex-row space-x-2">+ <p class="text-lg font-medium leading-7 text-main">{{ $t("settings.members.active") }}</p>+ <div v-if="showUpgradeInfo" class="flex flex-row items-center space-x-1">+ <heroicons-solid:sparkles class="w-6 h-6 text-accent" />+ <router-link+ to="/setting/subscription"+ class="text-lg accent-link"+ >{{ $t("settings.members.upgrade") }}</router-link>+ </div>+ </div><MemberTable :member-list="activeMemberList" /><div v-if="inactiveMemberList.length > 0" class="mt-8">- <p class="text-lg font-medium leading-7 text-control-light">- {{ $t("settings.members.inactive") }}- </p>+ <p+ class="text-lg font-medium leading-7 text-control-light"+ >{{ $t("settings.members.inactive") }}</p><MemberTable :member-list="inactiveMemberList" /></div></div>@@ -31,6 +38,10 @@ export default {const store = useStore();const currentUser = computed(() => store.getters["auth/currentUser"]());+ const hasAdminFeature = computed(() =>+ store.getters["plan/feature"]("bb.admin")+ );+const prepareMemberList = () => {store.dispatch("member/fetchMemberList");};@@ -57,10 +68,15 @@ export default {return isOwner(currentUser.value.role);});+ const showUpgradeInfo = computed(() => {+ return !hasAdminFeature.value && isOwner(currentUser.value.role);+ });+return {activeMemberList,inactiveMemberList,allowAddOrInvite,+ showUpgradeInfo,};},};diff --git a/frontend/src/views/SettingWorkspacePlan.vue b/frontend/src/views/SettingWorkspaceSubscription.vuesimilarity index 100%rename from frontend/src/views/SettingWorkspacePlan.vuerename to frontend/src/views/SettingWorkspaceSubscription.vue