Skip to content

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

chore: use review config id as slug (#12718)

ecmadao3dd176144524
diff --git a/frontend/src/components/SQLReview/components/SQLReviewPolicyDataTable.vue b/frontend/src/components/SQLReview/components/SQLReviewPolicyDataTable.vue
index afda4e915c..0d154be1ba 100644
--- a/frontend/src/components/SQLReview/components/SQLReviewPolicyDataTable.vue
+++ b/frontend/src/components/SQLReview/components/SQLReviewPolicyDataTable.vue
@@ -10,6 +10,7 @@
</template>
<script setup lang="tsx">
+import { CheckIcon, XIcon } from "lucide-vue-next";
import { NCheckbox, NDataTable, NButton } from "naive-ui";
import type { DataTableColumn } from "naive-ui";
import { computed } from "vue";
@@ -102,12 +103,16 @@ const columns = computed(
key: "enabled",
width: "7rem",
render: (review: SQLReviewPolicy) => {
- return (
+ return props.allowEdit ? (
<NCheckbox
disabled={!hasUpdatePolicyPermission.value || !props.allowEdit}
checked={review.enforce}
onUpdate:checked={(on) => toggleReviewEnabled(review, on)}
/>
+ ) : review.enforce ? (
+ <CheckIcon class="w-4 h-4 textinfolabel" />
+ ) : (
+ <XIcon class="w-4 h-4 textinfolabel" />
);
},
},
diff --git a/frontend/src/components/SQLReview/components/SQLReviewPolicySelectPanel.vue b/frontend/src/components/SQLReview/components/SQLReviewPolicySelectPanel.vue
index 98aad80bd5..5eac3e28e7 100644
--- a/frontend/src/components/SQLReview/components/SQLReviewPolicySelectPanel.vue
+++ b/frontend/src/components/SQLReview/components/SQLReviewPolicySelectPanel.vue
@@ -9,7 +9,7 @@
<i18n-t
keypath="sql-review.select-review-label"
tag="p"
- class="textinfo"
+ class="textinfolabel"
>
<template #create>
<NButton
diff --git a/frontend/src/utils/slug.ts b/frontend/src/utils/slug.ts
index 69d8a4cd4b..9e6ebad666 100644
--- a/frontend/src/utils/slug.ts
+++ b/frontend/src/utils/slug.ts
@@ -4,6 +4,8 @@ import {
getWorksheetId,
worksheetNamePrefix,
projectNamePrefix,
+ getReviewConfigId,
+ reviewConfigNamePrefix,
} from "@/store/modules/v1/common";
import type { Worksheet } from "@/types/proto/v1/worksheet_service";
import type { IssueId, SQLReviewPolicy } from "../types";
@@ -61,7 +63,11 @@ export function taskSlug(name: string, id: IdType): string {
}
export function sqlReviewPolicySlug(reviewPolicy: SQLReviewPolicy): string {
- return reviewPolicy.id;
+ return getReviewConfigId(reviewPolicy.id);
+}
+
+export function sqlReviewNameFromSlug(slug: string): string {
+ return `${reviewConfigNamePrefix}${slug}`;
}
export function worksheetSlugV1(sheet: Worksheet): string {
diff --git a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
index 678e299f79..2e18beafdb 100644
--- a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
+++ b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue
@@ -145,7 +145,14 @@
<script lang="tsx" setup>
import { useTitle } from "@vueuse/core";
-import { computed, reactive, watch, watchEffect } from "vue";
+import {
+ computed,
+ reactive,
+ watch,
+ watchEffect,
+ onMounted,
+ nextTick,
+} from "vue";
import { useI18n } from "vue-i18n";
import { useRouter, useRoute } from "vue-router";
import { BBTextField } from "@/bbkit";
@@ -166,7 +173,7 @@ import {
convertRuleMapToPolicyRuleList,
} from "@/types";
import type { Engine } from "@/types/proto/v1/common";
-import { hasWorkspacePermissionV2 } from "@/utils";
+import { hasWorkspacePermissionV2, sqlReviewNameFromSlug } from "@/utils";
const props = defineProps<{
sqlReviewPolicySlug: string;
@@ -206,17 +213,25 @@ const hasPermission = computed(() => {
return hasWorkspacePermissionV2(currentUserV1.value, "bb.policies.update");
});
+const sqlReviewName = computed(() =>
+ sqlReviewNameFromSlug(props.sqlReviewPolicySlug)
+);
+
watchEffect(async () => {
- await store.getOrFetchReviewPolicyByName(props.sqlReviewPolicySlug);
+ await store.getOrFetchReviewPolicyByName(sqlReviewName.value);
+});
+
+onMounted(() => {
if (route.query.attachResourcePanel && hasPermission.value) {
- state.showResourcePanel = true;
+ nextTick(() => {
+ state.showResourcePanel = true;
+ });
}
});
const reviewPolicy = computed(() => {
return (
- store.getReviewPolicyByName(props.sqlReviewPolicySlug) ??
- unknown("SQL_REVIEW")
+ store.getReviewPolicyByName(sqlReviewName.value) ?? unknown("SQL_REVIEW")
);
});