Skip to content

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

fix: db group methods (#12926)

boojack2105345a6282
diff --git a/frontend/src/grpcweb/index.ts b/frontend/src/grpcweb/index.ts
index 2066983e26..a3c3109bae 100644
--- a/frontend/src/grpcweb/index.ts
+++ b/frontend/src/grpcweb/index.ts
@@ -12,6 +12,7 @@ import { AuthServiceDefinition } from "@/types/proto/v1/auth_service";
import { BranchServiceDefinition } from "@/types/proto/v1/branch_service";
import { CelServiceDefinition } from "@/types/proto/v1/cel_service";
import { ChangelistServiceDefinition } from "@/types/proto/v1/changelist_service";
+import { DatabaseGroupServiceDefinition } from "@/types/proto/v1/database_group_service";
import { DatabaseServiceDefinition } from "@/types/proto/v1/database_service";
import { EnvironmentServiceDefinition } from "@/types/proto/v1/environment_service";
import { IdentityProviderServiceDefinition } from "@/types/proto/v1/idp_service";
@@ -111,6 +112,11 @@ export const databaseServiceClient = clientFactory.create(
channel
);
+export const databaseGroupServiceClient = clientFactory.create(
+ DatabaseGroupServiceDefinition,
+ channel
+);
+
export const identityProviderClient = clientFactory.create(
IdentityProviderServiceDefinition,
channel
diff --git a/frontend/src/store/modules/dbGroup.ts b/frontend/src/store/modules/dbGroup.ts
index dc0b072a98..bfab30f55f 100644
--- a/frontend/src/store/modules/dbGroup.ts
+++ b/frontend/src/store/modules/dbGroup.ts
@@ -3,7 +3,7 @@ import { isEqual } from "lodash-es";
import { defineStore } from "pinia";
import type { MaybeRef } from "vue";
import { computed, ref, unref } from "vue";
-import { projectServiceClient } from "@/grpcweb";
+import { databaseGroupServiceClient } from "@/grpcweb";
import type { ConditionGroupExpr } from "@/plugins/cel";
import {
buildCELExpr,
@@ -82,9 +82,10 @@ export const useDBGroupStore = defineStore("db-group", () => {
const cachedProjectNameSet = ref<Set<string>>(new Set());
const fetchAllDatabaseGroupList = async () => {
- const { databaseGroups } = await projectServiceClient.listDatabaseGroups({
- parent: `${projectNamePrefix}-`,
- });
+ const { databaseGroups } =
+ await databaseGroupServiceClient.listDatabaseGroups({
+ parent: `${projectNamePrefix}-`,
+ });
const composedList = [];
const composeDatabaseGroups =
await batchComposeDatabaseGroup(databaseGroups);
@@ -120,7 +121,7 @@ export const useDBGroupStore = defineStore("db-group", () => {
if (cached) return cached;
}
- const databaseGroup = await projectServiceClient.getDatabaseGroup(
+ const databaseGroup = await databaseGroupServiceClient.getDatabaseGroup(
{
name,
view,
@@ -141,9 +142,10 @@ export const useDBGroupStore = defineStore("db-group", () => {
);
}
- const { databaseGroups } = await projectServiceClient.listDatabaseGroups({
- parent: projectName,
- });
+ const { databaseGroups } =
+ await databaseGroupServiceClient.listDatabaseGroups({
+ parent: projectName,
+ });
const composedList = [];
const composeDatabaseGroups =
await batchComposeDatabaseGroup(databaseGroups);
@@ -181,14 +183,13 @@ export const useDBGroupStore = defineStore("db-group", () => {
databaseGroupId: string;
validateOnly?: boolean;
}) => {
- const createdDatabaseGroup = await projectServiceClient.createDatabaseGroup(
- {
+ const createdDatabaseGroup =
+ await databaseGroupServiceClient.createDatabaseGroup({
parent: projectName,
databaseGroup,
databaseGroupId,
validateOnly,
- }
- );
+ });
if (!validateOnly) {
const composedData = await batchComposeDatabaseGroup([
@@ -277,12 +278,11 @@ export const useDBGroupStore = defineStore("db-group", () => {
if (!isEqual(rawDatabaseGroup.multitenancy, databaseGroup.multitenancy)) {
updateMask.push("multitenancy");
}
- const updatedDatabaseGroup = await projectServiceClient.updateDatabaseGroup(
- {
+ const updatedDatabaseGroup =
+ await databaseGroupServiceClient.updateDatabaseGroup({
databaseGroup,
updateMask,
- }
- );
+ });
const composedData = await batchComposeDatabaseGroup([
updatedDatabaseGroup,
]);
@@ -291,7 +291,7 @@ export const useDBGroupStore = defineStore("db-group", () => {
};
const deleteDatabaseGroup = async (name: string) => {
- await projectServiceClient.deleteDatabaseGroup({
+ await databaseGroupServiceClient.deleteDatabaseGroup({
name: name,
});
dbGroupMapByName.value.delete(name);
@@ -319,12 +319,12 @@ export const useDatabaseInGroupFilter = (
const databaseGroups = computedAsync(
async () => {
- const response = await projectServiceClient.listDatabaseGroups({
+ const response = await databaseGroupServiceClient.listDatabaseGroups({
parent: unref(project).name,
});
return Promise.all(
response.databaseGroups.map((group) => {
- return projectServiceClient.getDatabaseGroup({
+ return databaseGroupServiceClient.getDatabaseGroup({
name: group.name,
view: DatabaseGroupView.DATABASE_GROUP_VIEW_FULL,
});