Fix: Issues and style fixes related to the 'Memory' page (#12469)

### What problem does this PR solve?

Fix:  Some bugs
- Issues and style fixes related to the 'Memory' page
- Data source icon replacement
- Build optimization

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
chanx
2026-01-07 10:03:54 +08:00
committed by GitHub
parent 6814ace1aa
commit 2a4627d9a0
25 changed files with 239 additions and 51 deletions

View File

@ -22,8 +22,32 @@ export function groupListByType<T extends Record<string, any>>(
return fileTypeList;
}
export function buildOwnersFilter<T extends Record<string, any>>(list: T[]) {
const owners = groupListByType(list, 'tenant_id', 'nickname');
export function groupListByArray<T extends Record<string, any>>(
list: T[],
idField: string,
) {
const fileTypeList: FilterType[] = [];
list.forEach((x) => {
if (Array.isArray(x[idField])) {
x[idField].forEach((j) => {
const item = fileTypeList.find((i) => i.id === j);
if (!item) {
fileTypeList.push({ id: j, label: j, count: 1 });
} else {
item.count += 1;
}
});
}
});
return fileTypeList;
}
export function buildOwnersFilter<T extends Record<string, any>>(
list: T[],
nickName?: string,
) {
const owners = groupListByType(list, 'tenant_id', nickName || 'nickname');
return { field: 'owner', list: owners, label: 'Owner' };
}