Skip to content

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

fix: slow query table display (#13410)

p0nya3e60cd806e3
diff --git a/frontend/src/components/SlowQuery/Settings/SlowQuerySettings.vue b/frontend/src/components/SlowQuery/Settings/SlowQuerySettings.vue
index e0b98d6574..6eca8fe86d 100644
--- a/frontend/src/components/SlowQuery/Settings/SlowQuerySettings.vue
+++ b/frontend/src/components/SlowQuery/Settings/SlowQuerySettings.vue
@@ -44,7 +44,7 @@ import {
useSlowQueryStore,
} from "@/store";
import { useGracefulRequest } from "@/store/modules/utils";
-import { getPolicyResourceNameAndType } from "@/store/modules/v1/common";
+import { getInstanceId, getInstanceIdPolicyId } from "@/store/modules/v1/common";
import type { ComposedSlowQueryPolicy } from "@/types";
import { isValidEnvironmentName } from "@/types";
import type { Environment } from "@/types/proto/v1/environment_service";
@@ -86,7 +86,7 @@ const instanceList = computed(() => {
const composedSlowQueryPolicyList = computed(() => {
const list = instanceList.value.map<ComposedSlowQueryPolicy>((instance) => {
const policy = policyList.value.find(
- (p) => head(getPolicyResourceNameAndType(p.name)) == instance.name
+ (p) => head(getInstanceIdPolicyId(p.name)) === head(getInstanceId(instance.name))
);
return {
instance,
diff --git a/frontend/src/store/modules/v1/common.ts b/frontend/src/store/modules/v1/common.ts
index 0decd5e306..81d1e11d2a 100644
--- a/frontend/src/store/modules/v1/common.ts
+++ b/frontend/src/store/modules/v1/common.ts
@@ -112,6 +112,14 @@ export const getProjectAndBranchId = (name: string): string[] => {
return [matches[1], matches[2]];
};
+export const getInstanceId = (name: string): string[] => {
+ const tokens = getNameParentTokens(name, [instanceNamePrefix]);
+ if (tokens.length !== 1) {
+ return [""];
+ }
+ return tokens;
+}
+
export const getInstanceAndDatabaseId = (name: string): string[] => {
const tokens = getNameParentTokens(name, [
instanceNamePrefix,
@@ -206,6 +214,14 @@ export const getPolicyResourceNameAndType = (name: string): string[] => {
return tokens;
};
+export const getInstanceIdPolicyId = (name: string) :string[] => {
+ const tokens = getNameParentTokens(name, [instanceNamePrefix, policyNamePrefix]);
+ if (tokens.length !== 2) {
+ return ["", ""];
+ }
+ return tokens;
+}
+
export const isDatabaseName = (name: string): boolean => {
const regex = /^instances\/([^/]+)\/databases\/(.+)$/;
return regex.test(name);