feat(mongo): add GridFS manager for MongoDB
* feat(mongo): browse GridFS buckets and files Refs #2342 * feat(mongo): add GridFS manager for MongoDB * chore(i18n): autofill new translations --------- Co-authored-by: dbx-i18n-bot <github-actions[bot]@users.noreply.github.com> Co-authored-by: t8y2 <1156263951@qq.com>
This commit is contained in:
35 files changed
+1959
-39
No files matched your search
@@ -1868,18 +1868,32 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
node.isLoading = true;
|
||||
try {
|
||||
const collections = await api.mongoListCollections(connectionId, database);
|
||||
const names = collections.map((c) => c.name);
|
||||
setChildren(
|
||||
node,
|
||||
sortSidebarNames(names).map((col) => ({
|
||||
id: `${nodeId}:${col}`,
|
||||
label: col,
|
||||
type: "mongo-collection" as const,
|
||||
const bucketNames = new Set(collections.filter((c) => c.kind === "bucket" && c.bucketName).map((c) => c.bucketName as string));
|
||||
const hiddenCollectionNames = new Set([...bucketNames].flatMap((bucketName) => [`${bucketName}.files`, `${bucketName}.chunks`]));
|
||||
const collectionNames = collections
|
||||
.filter((c) => c.kind !== "bucket")
|
||||
.map((c) => c.name)
|
||||
.filter((name) => !hiddenCollectionNames.has(name));
|
||||
const collectionChildren = sortSidebarNames(collectionNames).map((col) => ({
|
||||
id: `${nodeId}:${col}`,
|
||||
label: col,
|
||||
type: "mongo-collection" as const,
|
||||
connectionId,
|
||||
database,
|
||||
isExpanded: false,
|
||||
}));
|
||||
const children = [
|
||||
{
|
||||
id: `${nodeId}:__gridfs`,
|
||||
label: i18n.global.t("tree.gridfs"),
|
||||
type: "mongo-gridfs" as const,
|
||||
connectionId,
|
||||
database,
|
||||
isExpanded: false,
|
||||
})),
|
||||
);
|
||||
},
|
||||
...collectionChildren,
|
||||
];
|
||||
setChildren(node, children);
|
||||
node.isExpanded = true;
|
||||
} catch (e) {
|
||||
recordMetadataLoadError(connectionId, e);
|
||||
@@ -2649,6 +2663,8 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
await loadMongoCollections(node.connectionId, node.database);
|
||||
} else if (node.type === "mongo-collection" && node.connectionId && node.database) {
|
||||
await loadTableGroups(node.connectionId, node.database, node.label, node.schema, node.id);
|
||||
} else if (node.type === "mongo-gridfs") {
|
||||
node.isExpanded = true;
|
||||
} else if (node.type === "database" && node.connectionId && hasTreeNodeDatabaseContext(node)) {
|
||||
const config = getConfig(node.connectionId);
|
||||
const effectiveDbType = effectiveDatabaseTypeForConnection(config);
|
||||
|
||||
Reference in new issue
Block a user