Skip to content

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

chore: feature guard update for schema system (#1434)

ecmadao2db17efae6e7
diff --git a/frontend/src/components/DatabaseSchemaReview/SchemaReviewCreation.vue b/frontend/src/components/DatabaseSchemaReview/SchemaReviewCreation.vue
index 244d9eb4ef..2aab4bff49 100644
--- a/frontend/src/components/DatabaseSchemaReview/SchemaReviewCreation.vue
+++ b/frontend/src/components/DatabaseSchemaReview/SchemaReviewCreation.vue
@@ -65,6 +65,11 @@
@cancel="state.showAlertModal = false"
>
</BBAlert>
+ <FeatureModal
+ v-if="state.showFeatureModal"
+ feature="bb.feature.schema-review-policy"
+ @cancel="state.showFeatureModal = false"
+ />
</div>
</template>
@@ -83,6 +88,7 @@ import {
convertRuleTemplateToPolicyRule,
} from "@/types";
import {
+ featureToRef,
useCurrentUser,
pushNotification,
useEnvironmentList,
@@ -97,6 +103,7 @@ interface LocalState {
selectedRuleList: RuleTemplate[];
ruleUpdated: boolean;
showAlertModal: boolean;
+ showFeatureModal: boolean;
templateIndex: number;
pendingApplyTemplateIndex: number;
}
@@ -127,6 +134,10 @@ const hasPermission = computed(() => {
return isOwner(currentUser.value.role) || isDBA(currentUser.value.role);
});
+const hasSchemaReviewPolicyFeature = featureToRef(
+ "bb.feature.schema-review-policy"
+);
+
const getRuleListWithLevel = (
typeList: RuleType[],
level: RuleLevel
@@ -231,6 +242,7 @@ const state = reactive<LocalState>({
: [...TEMPLATE_LIST[DEFAULT_TEMPLATE_INDEX].ruleList],
ruleUpdated: false,
showAlertModal: false,
+ showFeatureModal: false,
templateIndex: props.policyId ? -1 : DEFAULT_TEMPLATE_INDEX,
pendingApplyTemplateIndex: -1,
});
@@ -282,6 +294,10 @@ const tryChangeStep = (
};
const tryFinishSetup = (allowChangeCallback: () => void) => {
+ if (!hasSchemaReviewPolicyFeature.value) {
+ state.showFeatureModal = true;
+ return;
+ }
if (!hasPermission.value) {
pushNotification({
module: "bytebase",
diff --git a/frontend/src/components/DatabaseSchemaReview/SchemaReviewPreview.vue b/frontend/src/components/DatabaseSchemaReview/SchemaReviewPreview.vue
index c953a4dc6f..099333216f 100644
--- a/frontend/src/components/DatabaseSchemaReview/SchemaReviewPreview.vue
+++ b/frontend/src/components/DatabaseSchemaReview/SchemaReviewPreview.vue
@@ -81,7 +81,9 @@
:key="i"
class="leading-8"
>
- {{ component.title }}:
+ {{
+ $t(`schema-review-policy.payload-config.${component.title}`)
+ }}:
<span
v-if="
component.payload.type === 'STRING' ||
diff --git a/frontend/src/components/EnvironmentForm.vue b/frontend/src/components/EnvironmentForm.vue
index 5ed9dec7fa..3e6cb207fd 100644
--- a/frontend/src/components/EnvironmentForm.vue
+++ b/frontend/src/components/EnvironmentForm.vue
@@ -128,7 +128,7 @@
</div>
</div>
</div>
- <div class="col-span-1" v-if="!create && isDev()">
+ <div class="col-span-1" v-if="!create">
<label class="textlabel">
{{ $t("schema-review-policy.title") }}
</label>
diff --git a/frontend/src/views/SettingSidebar.vue b/frontend/src/views/SettingSidebar.vue
index fe96f7b6eb..3390863f6c 100644
--- a/frontend/src/views/SettingSidebar.vue
+++ b/frontend/src/views/SettingSidebar.vue
@@ -74,7 +74,6 @@
>{{ $t("settings.sidebar.version-control") }}</router-link
>
<router-link
- v-if="isDev()"
to="/setting/schema-review-policy"
class="outline-item group w-full flex items-center pl-11 pr-2 py-2"
>{{ $t("schema-review-policy.title") }}</router-link
diff --git a/frontend/src/views/SettingWorkspaceSchemaReview.vue b/frontend/src/views/SettingWorkspaceSchemaReview.vue
index bdcfc882e1..f91880269e 100644
--- a/frontend/src/views/SettingWorkspaceSchemaReview.vue
+++ b/frontend/src/views/SettingWorkspaceSchemaReview.vue
@@ -1,5 +1,13 @@
<template>
<div class="mx-auto">
+ <FeatureAttention
+ v-if="!hasSchemaReviewPolicyFeature"
+ custom-class="mt-5"
+ feature="bb.feature.schema-review-policy"
+ :description="
+ $t('subscription.features.bb-feature-schema-review-policy.desc')
+ "
+ />
<div v-if="store.reviewPolicyList.length > 0" class="space-y-6 my-5">
<div class="flex justify-start mt-4" v-if="hasPermission">
<div class="flex flex-col items-center w-28">
@@ -32,6 +40,7 @@ import {
pushNotification,
useSchemaSystemStore,
useCurrentUser,
+ featureToRef,
} from "@/store";
import { DatabaseSchemaReviewPolicy } from "@/types/schemaSystem";
import { schemaReviewPolicySlug, isDBAOrOwner } from "@/utils";
@@ -50,6 +59,10 @@ const hasPermission = computed(() => {
return isDBAOrOwner(currentUser.value.role);
});
+const hasSchemaReviewPolicyFeature = featureToRef(
+ "bb.feature.schema-review-policy"
+);
+
const goToCreationView = () => {
if (hasPermission.value) {
router.push({
diff --git a/frontend/src/views/SettingWorkspaceSchemaReviewCreate.vue b/frontend/src/views/SettingWorkspaceSchemaReviewCreate.vue
index 1cf02ea426..73a5d6c24a 100644
--- a/frontend/src/views/SettingWorkspaceSchemaReviewCreate.vue
+++ b/frontend/src/views/SettingWorkspaceSchemaReviewCreate.vue
@@ -1,5 +1,13 @@
<template>
<div class="my-4 space-y-4 divide-y divide-block-border">
+ <FeatureAttention
+ v-if="!hasSchemaReviewPolicyFeature"
+ custom-class="mb-5"
+ feature="bb.feature.schema-review-policy"
+ :description="
+ $t('subscription.features.bb-feature-schema-review-policy.desc')
+ "
+ />
<SchemaReviewCreation
:selected-rule-list="[]"
:selected-environment="environment"
@@ -9,13 +17,17 @@
<script lang="ts" setup>
import { computed } from "vue";
-import { useEnvironmentStore } from "@/store";
+import { useEnvironmentStore, featureToRef } from "@/store";
import { EMPTY_ID } from "@/types";
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const environmentId = params.get("environmentId") ?? "";
+const hasSchemaReviewPolicyFeature = featureToRef(
+ "bb.feature.schema-review-policy"
+);
+
const environment = computed(() => {
if (!environmentId || Number.isNaN(environmentId)) {
return;
diff --git a/frontend/src/views/SettingWorkspaceSchemaReviewDetail.vue b/frontend/src/views/SettingWorkspaceSchemaReviewDetail.vue
index 10b8a3f3a0..2309b82a9d 100644
--- a/frontend/src/views/SettingWorkspaceSchemaReviewDetail.vue
+++ b/frontend/src/views/SettingWorkspaceSchemaReviewDetail.vue
@@ -1,4 +1,12 @@
<template>
+ <FeatureAttention
+ v-if="!hasSchemaReviewPolicyFeature"
+ custom-class="my-5"
+ feature="bb.feature.schema-review-policy"
+ :description="
+ $t('subscription.features.bb-feature-schema-review-policy.desc')
+ "
+ />
<transition appear name="slide-from-bottom" mode="out-in">
<SchemaReviewCreation
v-if="state.editMode"
@@ -176,6 +184,7 @@ import {
convertPolicyRuleToRuleTemplate,
} from "@/types";
import {
+ featureToRef,
useCurrentUser,
pushNotification,
useSchemaSystemStore,
@@ -213,6 +222,10 @@ const state = reactive<LocalState>({
checkedLevel: new Set<RuleLevel>(),
});
+const hasSchemaReviewPolicyFeature = featureToRef(
+ "bb.feature.schema-review-policy"
+);
+
const hasPermission = computed(() => {
return isDBAOrOwner(currentUser.value.role);
});