Skip to content

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

chore: initial project and database list in global (#6014)

boojackaf61a9e1b3c3
diff --git a/frontend/src/main.ts b/frontend/src/main.ts
index 6421646039..13b8d7a569 100644
--- a/frontend/src/main.ts
+++ b/frontend/src/main.ts
@@ -18,7 +18,10 @@ import {
pushNotification,
useActuatorStore,
useAuthStore,
+ useDatabaseStore,
useIdentityProviderStore,
+ useProjectStore,
+ useProjectV1Store,
useSubscriptionStore,
} from "./store";
import {
@@ -170,6 +173,15 @@ const initIdentityProvider = () => {
const idpStore = useIdentityProviderStore();
return idpStore.fetchIdentityProviderList();
};
+const initProjectList = () => {
+ const store = useProjectStore();
+ const storeV1 = useProjectV1Store();
+ return Promise.all([store.fetchProjectList(), storeV1.fetchProjectList()]);
+};
+const initDatabaseList = () => {
+ const store = useDatabaseStore();
+ return store.fetchDatabaseList();
+};
const restoreUser = () => {
const authStore = useAuthStore();
return authStore.restoreUser();
@@ -179,6 +191,9 @@ Promise.all([
initFeatureMatrix(),
initSubscription(),
initIdentityProvider(),
+ // Initial project list and database list in global.
+ initProjectList(),
+ initDatabaseList(),
restoreUser(),
]).finally(() => {
// Install router after the necessary data fetching is complete.
diff --git a/frontend/src/store/modules/project.ts b/frontend/src/store/modules/project.ts
index b157acf487..19d7812a32 100644
--- a/frontend/src/store/modules/project.ts
+++ b/frontend/src/store/modules/project.ts
@@ -141,6 +141,17 @@ export const useProjectStore = defineStore("project", {
return projectList;
},
+ async fetchProjectList() {
+ const data = (await axios.get(`/api/project`)).data;
+ const projectList: Project[] = data.data.map(
+ (project: ResourceObject) => {
+ return convert(project, data.included);
+ }
+ );
+ this.upsertProjectList(projectList);
+ return projectList;
+ },
+
async fetchProjectListByUser({
userId,
rowStatusList = [],