Skip to content

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

fix: sql review check for database (#12746)

ecmadaob4e9823cc252
diff --git a/frontend/src/components/SQLCheck/SQLCheckButton.vue b/frontend/src/components/SQLCheck/SQLCheckButton.vue
index c30e6602ea..237da3ca56 100644
--- a/frontend/src/components/SQLCheck/SQLCheckButton.vue
+++ b/frontend/src/components/SQLCheck/SQLCheckButton.vue
@@ -74,7 +74,6 @@
</template>
<script lang="ts" setup>
-import { computedAsync } from "@vueuse/core";
import type { ButtonProps } from "naive-ui";
import { NButton, NPopover } from "naive-ui";
import { computed, onUnmounted, ref, watch } from "vue";
@@ -82,7 +81,7 @@ import { onMounted } from "vue";
import { useI18n } from "vue-i18n";
import { sqlServiceClient } from "@/grpcweb";
import { WORKSPACE_ROUTE_SQL_REVIEW } from "@/router/dashboard/workspaceRoutes";
-import { useCurrentUserV1, useSQLReviewStore } from "@/store";
+import { useCurrentUserV1, useReviewPolicyForDatabase } from "@/store";
import type { ComposedDatabase } from "@/types";
import type { DatabaseMetadata } from "@/types/proto/v1/database_service";
import type { CheckRequest_ChangeType } from "@/types/proto/v1/sql_service";
@@ -127,11 +126,11 @@ const advices = ref<Advice[]>();
const context = useSQLCheckContext();
const confirmDialog = ref<Defer<boolean>>();
-const reviewPolicy = computedAsync(async () => {
- return await useSQLReviewStore().getOrFetchReviewPolicyByResource(
- props.database.effectiveEnvironment
- );
-}, undefined);
+const reviewPolicy = useReviewPolicyForDatabase(
+ computed(() => {
+ return props.database;
+ })
+);
const hasManageSQLReviewPolicyPermission = computed(() => {
return hasWorkspacePermissionV2(currentUser.value, "bb.policies.update");