mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 09:09:00 +08:00
### What problem does this PR solve? feat: Do not display arrow icons on leaf node of folders #1826 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
1d5a9b74ff
commit
ed6a693820
@ -57,6 +57,12 @@ class FileService(CommonService):
|
||||
if file["type"] == FileType.FOLDER.value:
|
||||
file["size"] = cls.get_folder_size(file["id"])
|
||||
file['kbs_info'] = []
|
||||
children = list(cls.model.select().where(
|
||||
(cls.model.tenant_id == tenant_id),
|
||||
(cls.model.parent_id == file["id"]),
|
||||
~(cls.model.id == file["id"]),
|
||||
).dicts())
|
||||
file["has_child_folder"] = any(value["type"] == FileType.FOLDER.value for value in children)
|
||||
continue
|
||||
kbs_info = cls.get_kb_id_by_file_id(file['id'])
|
||||
file['kbs_info'] = kbs_info
|
||||
|
@ -13,6 +13,7 @@ export interface IFile {
|
||||
update_date: string;
|
||||
update_time: number;
|
||||
source_type: string;
|
||||
has_child_folder?: boolean;
|
||||
}
|
||||
|
||||
export interface IFolder {
|
||||
|
@ -3,6 +3,7 @@ import { IFile } from '@/interfaces/database/file-manager';
|
||||
import type { GetProp, TreeSelectProps } from 'antd';
|
||||
import { TreeSelect } from 'antd';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
type DefaultOptionType = GetProp<TreeSelectProps, 'treeData'>[number];
|
||||
|
||||
@ -12,6 +13,7 @@ interface IProps {
|
||||
}
|
||||
|
||||
const AsyncTreeSelect = ({ value, onChange }: IProps) => {
|
||||
const { t } = useTranslation();
|
||||
const { fetchList } = useFetchPureFileList();
|
||||
const [treeData, setTreeData] = useState<Omit<DefaultOptionType, 'label'>[]>(
|
||||
[],
|
||||
@ -30,7 +32,10 @@ const AsyncTreeSelect = ({ value, onChange }: IProps) => {
|
||||
pId: x.parent_id,
|
||||
value: x.id,
|
||||
title: x.name,
|
||||
isLeaf: false,
|
||||
isLeaf:
|
||||
typeof x.has_child_folder === 'boolean'
|
||||
? !x.has_child_folder
|
||||
: false,
|
||||
})),
|
||||
);
|
||||
});
|
||||
@ -53,7 +58,7 @@ const AsyncTreeSelect = ({ value, onChange }: IProps) => {
|
||||
style={{ width: '100%' }}
|
||||
value={value}
|
||||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
||||
placeholder="Please select"
|
||||
placeholder={t('fileManager.pleaseSelect')}
|
||||
onChange={handleChange}
|
||||
loadData={onLoadData}
|
||||
treeData={treeData}
|
||||
|
Loading…
x
Reference in New Issue
Block a user