feat(milvus): add database and collection deletion

This commit is contained in:
onenewcode authored and GitHub committed 2026-08-20 18:25:12 +08:00
1 parent db8f262c14
commit 439f2c2617
14 files changed
+309 -12

No files matched your search

@@ -40,6 +40,18 @@ function connectionGroupNode(groupId: string): TreeNode {
};
}
function vectorDatabaseNode(database: string): TreeNode {
return {
id: `conn-1:${database}`,
label: database,
type: "vector-database",
connectionId: "conn-1",
database,
isExpanded: false,
children: [],
};
}
function connectionStore(selectedTreeNodeIds: string[]) {
const lastSelectedTreeNodeId = selectedTreeNodeIds[selectedTreeNodeIds.length - 1] ?? null;
return {
@@ -57,6 +69,7 @@ function connectionStore(selectedTreeNodeIds: string[]) {
disconnect: vi.fn().mockResolvedValue(undefined),
isTreeNodeChildrenLoaded: vi.fn(() => false),
getConfig: vi.fn(() => undefined),
isDefaultDatabase: vi.fn(() => false),
};
}
@@ -73,6 +86,22 @@ function runtime(activeNode: TreeNode, store: ReturnType<typeof connectionStore>
});
}
describe("sidebar default database state", () => {
beforeEach(() => {
vi.clearAllMocks();
sidebarFormTarget.value = null;
});
it("recognizes the configured Milvus vector database as default", () => {
const store = connectionStore([]);
store.isDefaultDatabase.mockReturnValue(true);
const { isNodeDefaultDatabase } = runtime(vectorDatabaseNode("analytics"), store);
expect(isNodeDefaultDatabase.value).toBe(true);
expect(store.isDefaultDatabase).toHaveBeenCalledWith("conn-1", "analytics");
});
});
describe("sidebar connection move selection", () => {
beforeEach(() => {
vi.clearAllMocks();