Skip to content

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

Add “bytebase.data-source” feature flag to gate the data source related feature

天舟c25ecdf6f37f
diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vue
index 6d55300a31..ab3665fa65 100644
--- a/frontend/src/components/QuickActionPanel.vue
+++ b/frontend/src/components/QuickActionPanel.vue
@@ -370,7 +370,7 @@ export default {
});
const effectiveQuickActionList = computed((): QuickActionType[] => {
- if (store.getters["plan/feature"]("bytebase.dbaworkflow")) {
+ if (store.getters["plan/feature"]("bytebase.dba-workflow")) {
return props.quickActionList;
}
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index ab5485d0ce..d42e63bdae 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -599,7 +599,7 @@ router.beforeEach((to, from, next) => {
if (to.name === "workspace.database.create") {
if (
- !store.getters["plan/feature"]("bytebase.dbaworkflow") ||
+ !store.getters["plan/feature"]("bytebase.dba-workflow") ||
isDBAOrOwner(loginUser.role)
) {
next();
@@ -628,7 +628,10 @@ router.beforeEach((to, from, next) => {
}
if (to.name?.toString().startsWith("workspace.database.datasource")) {
- if (!isDBAOrOwner(loginUser.role)) {
+ if (
+ !store.getters["plan/feature"]("bytebase.data-source") ||
+ !isDBAOrOwner(loginUser.role)
+ ) {
next({
name: "error.403",
replace: false,
diff --git a/frontend/src/store/modules/plan.ts b/frontend/src/store/modules/plan.ts
index fd3d933623..9f5fe9e6c5 100644
--- a/frontend/src/store/modules/plan.ts
+++ b/frontend/src/store/modules/plan.ts
@@ -3,7 +3,8 @@ import { FeatureType, PlanState, PlanType } from "../../types";
// A map from the a particular feature to the respective enablement of a particular plan
const FEATURE_MATRIX: Map<FeatureType, boolean[]> = new Map([
["bytebase.admin", [false, true, true]],
- ["bytebase.dbaworkflow", [false, false, true]],
+ ["bytebase.dba-workflow", [false, false, true]],
+ ["bytebase.data-source", [false, false, false]],
]);
const state: () => PlanState = () => ({
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.ts
index 0a60c7a996..fedb8691bd 100644
--- a/frontend/src/types/bytebase.ts
+++ b/frontend/src/types/bytebase.ts
@@ -423,7 +423,7 @@ type TaskTypeDatabase =
| "bytebase.database.grant"
| "bytebase.database.schema.update";
-type TaskTypeDataSource = "bytebase.datasource.request";
+type TaskTypeDataSource = "bytebase.data-source.request";
export type TaskType = TaskTypeGeneral | TaskTypeDatabase | TaskTypeDataSource;
@@ -890,7 +890,9 @@ export type FeatureType =
// Support DBA workflow, including
// 1. Developers can't create database directly, they need to do this via a request db task.
// 2. Allow developers to submit troubleshooting ticket.
- | "bytebase.dbaworkflow";
+ | "bytebase.dba-workflow"
+ // Support defining extra data source for a database and exposing the related data source UI.
+ | "bytebase.data-source";
export enum PlanType {
FREE = 0,
diff --git a/frontend/src/views/DataSourceDetail.vue b/frontend/src/views/DataSourceDetail.vue
index cc1e5a44ac..558c75911c 100644
--- a/frontend/src/views/DataSourceDetail.vue
+++ b/frontend/src/views/DataSourceDetail.vue
@@ -135,11 +135,10 @@
:dataSource="state.editing ? state.editingDataSource : dataSource"
/>
- <!-- Hide member table for now as we currently don't support fine granualar access -->
<!-- Guard against dataSource.id != '-1', this could happen when we delete the data source -->
<DataSourceMemberTable
class="pt-6"
- v-if="false && dataSource.id != '-1'"
+ v-if="dataSource.id != '-1'"
:allowEdit="allowEdit"
:dataSource="dataSource"
/>
diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vue
index bd32338920..259da33c41 100644
--- a/frontend/src/views/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail.vue
@@ -113,13 +113,15 @@
:key="index"
>
<div v-if="item.list.length" class="pt-6">
- <div class="text-lg leading-6 font-medium text-main mb-4">
+ <div
+ v-if="hasDataSourceFeature"
+ class="text-lg leading-6 font-medium text-main mb-4"
+ >
<span v-data-source-type>{{ item.type }}</span>
</div>
<div class="space-y-4">
<div v-for="(ds, index) of item.list" :key="index">
- <!-- Hide the data source detail link for now -->
- <div v-if="false" class="relative mb-2">
+ <div v-if="hasDataSourceFeature" class="relative mb-2">
<div
class="absolute inset-0 flex items-center"
aria-hidden="true"
@@ -245,6 +247,10 @@ export default {
const currentUser = computed(() => store.getters["auth/currentUser"]());
+ const hasDataSourceFeature = computed(() =>
+ store.getters["plan/feature"]("bytebase.data-source")
+ );
+
const database = computed(() => {
return store.getters["database/databaseById"](
idFromSlug(props.databaseSlug)
@@ -357,6 +363,7 @@ export default {
return {
state,
database,
+ hasDataSourceFeature,
isCurrentUserDBAOrOwner,
allowChangeProject,
allowViewDataSource,