mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat: add chunkText to messageText to distinguish table rows and when parsing, the delete and other buttons are set to disabled. (#130)
* feat: when parsing, the delete and other buttons are set to disabled. * feat: add chunkText to messageText to distinguish table rows
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
.iconButton {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
@ -3,6 +3,9 @@ import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import { DeleteOutlined, EditOutlined, ToolOutlined } from '@ant-design/icons';
|
||||
import { Button, Dropdown, MenuProps, Space, Tooltip } from 'antd';
|
||||
import { useDispatch } from 'umi';
|
||||
import { isParserRunning } from '../utils';
|
||||
|
||||
import styles from './index.less';
|
||||
|
||||
interface IProps {
|
||||
knowledgeBaseId: string;
|
||||
@ -17,6 +20,7 @@ const ParsingActionCell = ({
|
||||
}: IProps) => {
|
||||
const dispatch = useDispatch();
|
||||
const documentId = record.id;
|
||||
const isRunning = isParserRunning(record.run);
|
||||
|
||||
const removeDocument = () => {
|
||||
dispatch({
|
||||
@ -29,7 +33,9 @@ const ParsingActionCell = ({
|
||||
};
|
||||
|
||||
const onRmDocument = () => {
|
||||
showDeleteConfirm({ onOk: removeDocument });
|
||||
if (!isRunning) {
|
||||
showDeleteConfirm({ onOk: removeDocument });
|
||||
}
|
||||
};
|
||||
|
||||
const setCurrentRecord = () => {
|
||||
@ -49,11 +55,13 @@ const ParsingActionCell = ({
|
||||
};
|
||||
|
||||
const showRenameModal = () => {
|
||||
setCurrentRecord();
|
||||
dispatch({
|
||||
type: 'kFModel/setIsShowRenameModal',
|
||||
payload: true,
|
||||
});
|
||||
if (!isRunning) {
|
||||
setCurrentRecord();
|
||||
dispatch({
|
||||
type: 'kFModel/setIsShowRenameModal',
|
||||
payload: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const chunkItems: MenuProps['items'] = [
|
||||
@ -70,14 +78,38 @@ const ParsingActionCell = ({
|
||||
];
|
||||
|
||||
return (
|
||||
<Space size={'middle'}>
|
||||
<Dropdown menu={{ items: chunkItems }} trigger={['click']}>
|
||||
<ToolOutlined size={20} onClick={setDocumentAndParserId} />
|
||||
<Space size={0}>
|
||||
<Dropdown
|
||||
menu={{ items: chunkItems }}
|
||||
trigger={['click']}
|
||||
disabled={isRunning}
|
||||
>
|
||||
<Button
|
||||
type="text"
|
||||
onClick={setDocumentAndParserId}
|
||||
className={styles.iconButton}
|
||||
>
|
||||
<ToolOutlined size={20} />
|
||||
</Button>
|
||||
</Dropdown>
|
||||
<Tooltip title="Rename">
|
||||
<EditOutlined size={20} onClick={showRenameModal} />
|
||||
<Button
|
||||
type="text"
|
||||
disabled={isRunning}
|
||||
onClick={showRenameModal}
|
||||
className={styles.iconButton}
|
||||
>
|
||||
<EditOutlined size={20} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<DeleteOutlined size={20} onClick={onRmDocument} />
|
||||
<Button
|
||||
type="text"
|
||||
disabled={isRunning}
|
||||
onClick={onRmDocument}
|
||||
className={styles.iconButton}
|
||||
>
|
||||
<DeleteOutlined size={20} />
|
||||
</Button>
|
||||
</Space>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user