mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-25 09:53:29 +08:00
Fix: Metadata mult-selected display error (#13189)
### What problem does this PR solve? Fix: Metadata mult-selected display error ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { t } from 'i18next';
|
||||
import { BrushCleaning } from 'lucide-react';
|
||||
import { ReactNode, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
ConfirmDeleteDialog,
|
||||
ConfirmDeleteDialogNode,
|
||||
@@ -21,22 +21,28 @@ type BulkOperateBarProps = {
|
||||
list: BulkOperateItemType[];
|
||||
count: number;
|
||||
className?: string;
|
||||
unit?: string;
|
||||
};
|
||||
|
||||
export function BulkOperateBar({
|
||||
list,
|
||||
count,
|
||||
className,
|
||||
unit,
|
||||
}: BulkOperateBarProps) {
|
||||
const isDeleteItem = useCallback((id: string) => {
|
||||
return id === 'delete';
|
||||
}, []);
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Card className={cn('mb-4', className)}>
|
||||
<CardContent className="p-1 pl-5 flex items-center gap-6">
|
||||
<section className="text-text-sub-title-invert flex items-center gap-2">
|
||||
<span>Selected: {count} Files</span>
|
||||
<span>
|
||||
{t('common.selected')}: {count}{' '}
|
||||
{unit ?? t('knowledgeDetails.files')}
|
||||
</span>
|
||||
<BrushCleaning className="size-3" />
|
||||
</section>
|
||||
<Separator orientation={'vertical'} className="h-3"></Separator>
|
||||
@@ -49,12 +55,16 @@ export function BulkOperateBar({
|
||||
<ConfirmDeleteDialog
|
||||
hidden={!isDeleteItem(x.id)}
|
||||
onOk={x.onClick}
|
||||
title={t('deleteModal.delFiles')}
|
||||
title={
|
||||
unit
|
||||
? t('common.delete') + ' ' + unit
|
||||
: t('deleteModal.delFiles')
|
||||
}
|
||||
content={{
|
||||
title: t('common.deleteThem'),
|
||||
node: (
|
||||
<ConfirmDeleteDialogNode
|
||||
name={`${t('deleteModal.delFilesContent', { count })}`}
|
||||
name={`${unit ? t('common.selected') + ' ' + count + ' ' + unit : t('deleteModal.delFilesContent', { count })}`}
|
||||
></ConfirmDeleteDialogNode>
|
||||
),
|
||||
}}
|
||||
|
||||
@@ -198,6 +198,7 @@ Example: A 1 KB message with 1024-dim embedding uses ~9 KB. The 5 MB default lim
|
||||
},
|
||||
knowledgeDetails: {
|
||||
metadata: {
|
||||
fields: 'fields',
|
||||
selectFiles: 'Selected {{count}} files',
|
||||
type: 'Type',
|
||||
fieldNameInvalid: 'Field name can only contain letters or underscores.',
|
||||
|
||||
@@ -177,6 +177,7 @@ export default {
|
||||
},
|
||||
knowledgeDetails: {
|
||||
metadata: {
|
||||
fields: '字段',
|
||||
selectFiles: '已选择 {{count}} 个文件',
|
||||
type: '类型',
|
||||
fieldNameInvalid: '字段名称只能包含字母或下划线。',
|
||||
|
||||
@@ -30,7 +30,6 @@ import {
|
||||
import { Plus, Trash2 } from 'lucide-react';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useHandleMenuClick } from '../../sidebar/hooks';
|
||||
import {
|
||||
getMetadataValueTypeLabel,
|
||||
MetadataType,
|
||||
@@ -99,7 +98,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
|
||||
otherData,
|
||||
documentIds,
|
||||
);
|
||||
const { handleMenuClick } = useHandleMenuClick();
|
||||
// const { handleMenuClick } = useHandleMenuClick();
|
||||
const [shouldSave, setShouldSave] = useState(false);
|
||||
const [isAddValueMode, setIsAddValueMode] = useState(false);
|
||||
const {
|
||||
@@ -350,6 +349,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
|
||||
<BulkOperateBar
|
||||
list={operateList}
|
||||
count={selectedCount}
|
||||
unit={t('knowledgeDetails.metadata.fields')}
|
||||
></BulkOperateBar>
|
||||
)}
|
||||
{metadataType === MetadataType.Setting ||
|
||||
|
||||
@@ -107,7 +107,7 @@ export default function Dataset() {
|
||||
secondTitle: (
|
||||
<>
|
||||
{t('knowledgeDetails.metadata.selectFiles', {
|
||||
count: documents.length,
|
||||
count: selectedCount,
|
||||
})}
|
||||
</>
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user