Skip to content

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

No need to fetch all databaseList initially, since we always include the full database object in the corresponding object

天舟b7b8741beb1f
diff --git a/frontend/src/components/ProvideContext.vue b/frontend/src/components/ProvideContext.vue
index f9b3926398..797fcca00e 100644
--- a/frontend/src/components/ProvideContext.vue
+++ b/frontend/src/components/ProvideContext.vue
@@ -22,19 +22,6 @@ export default {
// The default project hosts databases not explicitly assigned to other users project.
store.dispatch("project/fetchProjectById", DEFAULT_PROJECT_ID),
store.dispatch("instance/fetchInstanceList"),
- // [TODO] Fetches all databases. This may cause performance issue if the entire fleet
- // has a lot of databases.
- // The purpose it serves is our issue list in the home view displays the database name column.
- // User with the Developer role may subscribe to the issue, while she is not granted to that issue's
- // related database. In such case, user won't fetch that issue by her user id, so we need to do
- // a separate fetch somewhere. Another way to do it is to do on-demand fetch for each issue whose
- // database hasn't been fetched yet, that solution is more complex and might not bring better
- // performance because it requires to do more round-trips because of the N+1 nature. Thus,
- // we choose to do a full fetch when initializing the context here.
- // [NOTE] This only fetches the database info itself, won't fetch the instance and especially
- // the data source info which contains connection credentials might not be granted to the current
- // user.
- store.dispatch("database/fetchDatabaseList"),
store.dispatch("uistate/restoreState"),
]);
diff --git a/frontend/src/store/modules/database.ts b/frontend/src/store/modules/database.ts
index 80e90909fb..9257bf890e 100644
--- a/frontend/src/store/modules/database.ts
+++ b/frontend/src/store/modules/database.ts
@@ -186,27 +186,6 @@ const getters = {
};
const actions = {
- async fetchDatabaseList({ commit, rootGetters }: any) {
- // Unlike other list fetch, we don't fetch the data source here.
- // As the sole purpose for the fetch here is to prepare the database info
- // itself (in particular the environment name, database name and project name)
- // to be displayed in the issue list on the home page.
- // The data source contains sensitive connection credentials so we shouldn't
- // return it unconditionally.
- const data = (
- await axios.get(
- `/api/database?include=instance,project,project.projectMember`
- )
- ).data;
- const databaseList = data.data.map((database: ResourceObject) => {
- return convert(database, data.included, rootGetters);
- });
-
- commit("upsertDatabaseList", { databaseList });
-
- return databaseList;
- },
-
async fetchDatabaseListByInstanceId(
{ commit, rootGetters }: any,
instanceId: InstanceId