Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: id type in database store map (#6200)
boojack9e2317718660
diff --git a/frontend/src/components/Issue/layout/GrantRequestDetail.vue b/frontend/src/components/Issue/layout/GrantRequestDetail.vueindex d29ebb823e..89eb97ab5e 100644--- a/frontend/src/components/Issue/layout/GrantRequestDetail.vue+++ b/frontend/src/components/Issue/layout/GrantRequestDetail.vue@@ -48,7 +48,7 @@</template><script lang="ts" setup>-import { computed, onMounted, PropType, ref, watchEffect } from "vue";+import { computed, onMounted, PropType, ref, watchEffect, watch } from "vue";import { useDialog } from "naive-ui";import IssueBanner from "../IssueBanner.vue";@@ -63,7 +63,7 @@ import {UNKNOWN_ID,} from "@/types";import { defaultTemplate, templateForType } from "@/plugins";-import { useProjectV1Store } from "@/store";+import { useProjectIamPolicyStore, useProjectV1Store } from "@/store";import {provideIssueLogic,IssueLogic,@@ -73,6 +73,7 @@ import { useGrantRequestIssueLogic } from "../logic/grantRequest";import GrantRequestIssueSidebar from "../GrantRequestIssueSidebar.vue";import GrantRequestExporterForm from "../form/GrantRequestExporterForm.vue";import GrantRequestQuerierForm from "../form/GrantRequestQuerierForm.vue";+import { useIssueReviewContext } from "@/plugins/issue/logic/review/context";const props = defineProps({create: {@@ -95,9 +96,8 @@ const create = computed(() => props.create);const issue = computed(() => props.issue);const dialog = useDialog();-const { project, createIssue } = useGrantRequestIssueLogic({ issue, create });-+const reviewContext = useIssueReviewContext();const issueLogic = ref<IssueLogic>();watchEffect(() => {@@ -142,6 +142,19 @@ onMounted(() => {const onStatusChanged = (eager: boolean) => emit("status-changed", eager);+watch(+ () => reviewContext.done.value,+ () => {+ // After the grant request issue's review is done, we need to fetch the latest project IAM policy.+ if (reviewContext.done.value) {+ useProjectIamPolicyStore().fetchProjectIamPolicy(+ project.value.name,+ true /* Skip cache */+ );+ }+ }+);+provideIssueLogic({create,diff --git a/frontend/src/store/modules/database.ts b/frontend/src/store/modules/database.tsindex 424b90c9b6..5398888258 100644--- a/frontend/src/store/modules/database.ts+++ b/frontend/src/store/modules/database.ts@@ -160,16 +160,18 @@ export const useDatabaseStore = defineStore("database", {return list;},getDatabaseListByInstanceId(instanceId: InstanceId): Database[] {- return this.databaseListByInstanceId.get(instanceId) || [];+ return this.databaseListByInstanceId.get(String(instanceId)) || [];},async getOrFetchDatabaseListByInstanceId(instanceId: InstanceId): Promise<Database[]> {- const databaseList = this.databaseListByInstanceId.get(instanceId);+ const databaseList = this.databaseListByInstanceId.get(+ String(instanceId)+ );if (isUndefined(databaseList)) {- await this.fetchDatabaseListByInstanceId(instanceId);+ await this.fetchDatabaseListByInstanceId(String(instanceId));}- return this.databaseListByInstanceId.get(instanceId) || [];+ return this.databaseListByInstanceId.get(String(instanceId)) || [];},getDatabaseListByUser(user: User): Database[] {const canManageDatabase = hasWorkspacePermissionV1(@@ -204,7 +206,7 @@ export const useDatabaseStore = defineStore("database", {return list;},getDatabaseListByProjectId(projectId: string): Database[] {- return this.databaseListByProjectId.get(parseInt(projectId, 10)) || [];+ return this.databaseListByProjectId.get(projectId) || [];},getDatabaseById(databaseId: DatabaseId, instanceId?: InstanceId): Database {if (databaseId == EMPTY_ID) {@@ -212,7 +214,8 @@ export const useDatabaseStore = defineStore("database", {}if (instanceId) {- const list = this.databaseListByInstanceId.get(instanceId) || [];+ const list =+ this.databaseListByInstanceId.get(String(instanceId)) || [];return (list.find((item) => item.id == databaseId) ||(unknown("DATABASE") as Database)@@ -240,7 +243,7 @@ export const useDatabaseStore = defineStore("database", {removeDatabaseListFromProject(databaseList: Database[]) {for (const database of databaseList) {const listByProject = this.databaseListByProjectId.get(- database.project.id+ String(database.project.id));if (listByProject) {const i = listByProject.findIndex(@@ -260,11 +263,11 @@ export const useDatabaseStore = defineStore("database", {instanceId?: InstanceId;}) {if (instanceId) {- this.databaseListByInstanceId.set(instanceId, databaseList);+ this.databaseListByInstanceId.set(String(instanceId), databaseList);} else {for (const database of databaseList) {const listByInstance = this.databaseListByInstanceId.get(- database.instance.id+ String(database.instance.id));if (listByInstance) {const i = listByInstance.findIndex(@@ -276,11 +279,13 @@ export const useDatabaseStore = defineStore("database", {listByInstance.push(database);}} else {- this.databaseListByInstanceId.set(database.instance.id, [database]);+ this.databaseListByInstanceId.set(String(database.instance.id), [+ database,+ ]);}const listByProject = this.databaseListByProjectId.get(- database.project.id+ String(database.project.id));if (listByProject) {const i = listByProject.findIndex(@@ -292,7 +297,9 @@ export const useDatabaseStore = defineStore("database", {listByProject.push(database);}} else {- this.databaseListByProjectId.set(database.project.id, [database]);+ this.databaseListByProjectId.set(String(database.project.id), [+ database,+ ]);}}}@@ -328,7 +335,7 @@ export const useDatabaseStore = defineStore("database", {const databaseList = await this.fetchDatabaseList({instanceId,});- this.databaseListByInstanceId.set(instanceId, databaseList);+ this.databaseListByInstanceId.set(String(instanceId), databaseList);return databaseList;},async fetchDatabaseByInstanceIdAndName({diff --git a/frontend/src/store/modules/v1/projectIamPolicy.ts b/frontend/src/store/modules/v1/projectIamPolicy.tsindex 389ef3965b..acf9dd2bc3 100644--- a/frontend/src/store/modules/v1/projectIamPolicy.ts+++ b/frontend/src/store/modules/v1/projectIamPolicy.ts@@ -22,11 +22,17 @@ export const useProjectIamPolicyStore = defineStore(const policyMap = ref(new Map<string, IamPolicy>());const requestCache = new Map<string, Promise<IamPolicy>>();- const fetchProjectIamPolicy = async (project: string) => {- const cache = requestCache.get(project);- if (cache) {- return cache;+ const fetchProjectIamPolicy = async (+ project: string,+ skipCache = false+ ) => {+ if (!skipCache) {+ const cache = requestCache.get(project);+ if (cache) {+ return cache;+ }}+const request = projectServiceClient.getIamPolicy({project,diff --git a/frontend/src/types/store.ts b/frontend/src/types/store.tsindex 195043b11e..3cf57c6485 100644--- a/frontend/src/types/store.ts+++ b/frontend/src/types/store.ts@@ -105,10 +105,10 @@ export interface DatabaseState {// In those cases, we will iterate through this map and compute the list on the fly.// We save it by instance because database belongs to instance and saving this way// follows that hierarchy.- databaseListByInstanceId: Map<InstanceId, Database[]>;+ databaseListByInstanceId: Map<string, Database[]>;// Used exclusively for project panel, we do this to avoid interference from databaseListByInstanceId// where updating databaseListByInstanceId will cause reloading project related UI due to reactivity- databaseListByProjectId: Map<ProjectId, Database[]>;+ databaseListByProjectId: Map<string, Database[]>;}export interface DBSchemaState {