mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 20:39:03 +08:00
### What problem does this PR solve? Fix: Hide the download button if it is an empty file #3762 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
cf37e2ef1a
commit
289f4f1916
@ -57,3 +57,8 @@ export enum KnowledgeSearchParams {
|
|||||||
DocumentId = 'doc_id',
|
DocumentId = 'doc_id',
|
||||||
KnowledgeId = 'id',
|
KnowledgeId = 'id',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum DocumentType {
|
||||||
|
Virtual = 'virtual',
|
||||||
|
Visual = 'visual',
|
||||||
|
}
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
import { Button, Dropdown, MenuProps, Space, Tooltip } from 'antd';
|
import { Button, Dropdown, MenuProps, Space, Tooltip } from 'antd';
|
||||||
import { isParserRunning } from '../utils';
|
import { isParserRunning } from '../utils';
|
||||||
|
|
||||||
|
import { DocumentType } from '../constant';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
@ -31,6 +32,7 @@ const ParsingActionCell = ({
|
|||||||
const { t } = useTranslate('knowledgeDetails');
|
const { t } = useTranslate('knowledgeDetails');
|
||||||
const { removeDocument } = useRemoveNextDocument();
|
const { removeDocument } = useRemoveNextDocument();
|
||||||
const showDeleteConfirm = useShowDeleteConfirm();
|
const showDeleteConfirm = useShowDeleteConfirm();
|
||||||
|
const isVirtualDocument = record.type === DocumentType.Virtual;
|
||||||
|
|
||||||
const onRmDocument = () => {
|
const onRmDocument = () => {
|
||||||
if (!isRunning) {
|
if (!isRunning) {
|
||||||
@ -73,6 +75,7 @@ const ParsingActionCell = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Space size={0}>
|
<Space size={0}>
|
||||||
|
{isVirtualDocument || (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
menu={{ items: chunkItems }}
|
menu={{ items: chunkItems }}
|
||||||
trigger={['click']}
|
trigger={['click']}
|
||||||
@ -82,6 +85,7 @@ const ParsingActionCell = ({
|
|||||||
<ToolOutlined size={20} />
|
<ToolOutlined size={20} />
|
||||||
</Button>
|
</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
)}
|
||||||
<Tooltip title={t('rename', { keyPrefix: 'common' })}>
|
<Tooltip title={t('rename', { keyPrefix: 'common' })}>
|
||||||
<Button
|
<Button
|
||||||
type="text"
|
type="text"
|
||||||
@ -102,6 +106,7 @@ const ParsingActionCell = ({
|
|||||||
<DeleteOutlined size={20} />
|
<DeleteOutlined size={20} />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
{isVirtualDocument || (
|
||||||
<Tooltip title={t('download', { keyPrefix: 'common' })}>
|
<Tooltip title={t('download', { keyPrefix: 'common' })}>
|
||||||
<Button
|
<Button
|
||||||
type="text"
|
type="text"
|
||||||
@ -112,6 +117,7 @@ const ParsingActionCell = ({
|
|||||||
<DownloadOutlined size={20} />
|
<DownloadOutlined size={20} />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@ import { Badge, DescriptionsProps, Flex, Popover, Space, Tag } from 'antd';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import reactStringReplace from 'react-string-replace';
|
import reactStringReplace from 'react-string-replace';
|
||||||
import { RunningStatus, RunningStatusMap } from '../constant';
|
import { DocumentType, RunningStatus, RunningStatusMap } from '../constant';
|
||||||
import { useHandleRunDocumentByIds } from '../hooks';
|
import { useHandleRunDocumentByIds } from '../hooks';
|
||||||
import { isParserRunning } from '../utils';
|
import { isParserRunning } from '../utils';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
@ -96,7 +96,7 @@ export const ParsingStatusCell = ({ record }: IProps) => {
|
|||||||
handleRunDocumentByIds(record.id, isRunning);
|
handleRunDocumentByIds(record.id, isRunning);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return record.type === DocumentType.Virtual ? null : (
|
||||||
<Flex justify={'space-between'} align="center">
|
<Flex justify={'space-between'} align="center">
|
||||||
<Popover content={<PopoverContent record={record}></PopoverContent>}>
|
<Popover content={<PopoverContent record={record}></PopoverContent>}>
|
||||||
<Tag color={runningStatus.color}>
|
<Tag color={runningStatus.color}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user