Skip to content

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

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.png
deleted file mode 100644
index 1e57db0510..0000000000
Binary files a/frontend/src/assets/role_management_screenshot.png and /dev/null differ
diff --git a/frontend/src/components/MemberTable.vue b/frontend/src/components/MemberTable.vue
index 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>
<span
v-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.yml
index 96eb12aa63..31b2e2b05c 100644
--- a/frontend/src/locales/en.yml
+++ b/frontend/src/locales/en.yml
@@ -227,7 +227,7 @@ settings:
general: General
members: Members
version-control: Version Control
- plans: Plans
+ subscription: Subscription
labels: Labels
profile:
email: Email
@@ -236,7 +236,7 @@ settings:
password-confirm: Confirm
password-confirm-placeholder: Confirm new password
password-mismatch: mismatch
- plan: (Upgrade to Team plan to enable role management)
+ subscription: (Upgrade to enable role management)
members:
active: Active members
inactive: Inactive members
@@ -246,7 +246,7 @@ settings:
invites: Send Invites
invited: Invited
yourself: You
- upgrade: Upgrade to unlock Owner and DBA roles
+ upgrade: Upgrade to enable role management
select-role: Select role
not-assigned: Not assigned
table:
@@ -261,7 +261,7 @@ settings:
reactivate: Reactivate
reactivate-confirm-title: Are you sure to reactivate
tooltip:
- upgrade: Upgrade to Team plan to enable role management
+ upgrade: Upgrade to enable role management
not-allow-edit: Only Owner can change the role
not-allow-remove: Can not remove the last Owner
activity:
diff --git a/frontend/src/locales/zh-CN.yml b/frontend/src/locales/zh-CN.yml
index 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.ts
index 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.vue
index 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>
<button
type="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">
<input
id="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">
<input
diff --git a/frontend/src/views/SettingSidebar.vue b/frontend/src/views/SettingSidebar.vue
index 87b23d9ea7..32b941ebe2 100644
--- a/frontend/src/views/SettingSidebar.vue
+++ b/frontend/src/views/SettingSidebar.vue
@@ -23,9 +23,7 @@
<router-link
to="/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-link
to="/setting/agent"
class="outline-item group w-full flex items-center pl-11 pr-2 py-2"
>
Agents
- </router-link> -->
+ </router-link>-->
<router-link
to="/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 all
but only editable to Owners and DBAs
@@ -61,32 +57,26 @@
<router-link
to="/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-link
v-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-link
to="/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.vue
index 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.vue
similarity index 100%
rename from frontend/src/views/SettingWorkspacePlan.vue
rename to frontend/src/views/SettingWorkspaceSubscription.vue