mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-07 19:15:05 +08:00
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:
@ -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' };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user