Skip to content

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

chore: fix policy name extractor (#13409)

boojack9165871a82ef
diff --git a/frontend/src/store/modules/v1/common.ts b/frontend/src/store/modules/v1/common.ts
index 81d1e11d2a..c7ed42b1e3 100644
--- a/frontend/src/store/modules/v1/common.ts
+++ b/frontend/src/store/modules/v1/common.ts
@@ -207,11 +207,12 @@ export const getReviewConfigId = (name: string) => {
// Instance resource name: instances/instance-id.
// Database resource name: instances/instance-id/databases/database-name.
export const getPolicyResourceNameAndType = (name: string): string[] => {
- const tokens = getNameParentTokens(name, [policyNamePrefix]);
- if (tokens.length !== 2) {
+ const regex = new RegExp(`^(.*)/${policyNamePrefix}(.*)$`);
+ const match = name.match(regex);
+ if (!match || match.length !== 3) {
return ["", ""];
}
- return tokens;
+ return [match[1], match[2]];
};
export const getInstanceIdPolicyId = (name: string) :string[] => {