From 34dcf05e144d0eb1f052fc47f8576790a10b98c7 Mon Sep 17 00:00:00 2001 From: balibabu Date: Wed, 15 May 2024 14:53:36 +0800 Subject: [PATCH] fix: .knowledgebase folder can be deleted bug and change "Add file to knowledge base" to "Link file to knowledge base" bug (#786) ### What problem does this PR solve? fix: .knowledgebase folder can be deleted bug fix: change "Add file to knowledge base" to "Link file to knowledge base" bug #783 #784 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/locales/en.ts | 2 +- web/src/locales/zh-traditional.ts | 2 +- web/src/locales/zh.ts | 2 +- web/src/pages/file-manager/hooks.ts | 6 +++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index d9e57355f5..1a0628d562 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -494,7 +494,7 @@ export default { knowledgeBase: 'Knowledge Base', size: 'Size', action: 'Action', - addToKnowledge: 'Add to Knowledge Base', + addToKnowledge: 'Link to Knowledge Base', pleaseSelect: 'Please select', newFolder: 'New Folder', file: 'File', diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts index 9afa94d053..55e911f9d1 100644 --- a/web/src/locales/zh-traditional.ts +++ b/web/src/locales/zh-traditional.ts @@ -458,7 +458,7 @@ export default { knowledgeBase: '知識庫', size: '大小', action: '操作', - addToKnowledge: '添加到知識庫', + addToKnowledge: '鏈接知識庫', pleaseSelect: '請選擇', newFolder: '新建文件夾', uploadFile: '上傳文件', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 1b8aa065a7..db52bf98c4 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -475,7 +475,7 @@ export default { knowledgeBase: '知识库', size: '大小', action: '操作', - addToKnowledge: '添加到知识库', + addToKnowledge: '链接知识库', pleaseSelect: '请选择', newFolder: '新建文件夹', uploadFile: '上传文件', diff --git a/web/src/pages/file-manager/hooks.ts b/web/src/pages/file-manager/hooks.ts index dc95043276..a3bce65ac6 100644 --- a/web/src/pages/file-manager/hooks.ts +++ b/web/src/pages/file-manager/hooks.ts @@ -14,6 +14,7 @@ import { useGetPagination, useSetPagination } from '@/hooks/logicHooks'; import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks'; import { IFile } from '@/interfaces/database/file-manager'; import { PaginationProps } from 'antd'; +import { TableRowSelection } from 'antd/es/table/interface'; import { UploadFile } from 'antd/lib'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useDispatch, useNavigate, useSearchParams, useSelector } from 'umi'; @@ -93,8 +94,11 @@ export const useHandleSearchChange = () => { export const useGetRowSelection = () => { const [selectedRowKeys, setSelectedRowKeys] = useState([]); - const rowSelection = { + const rowSelection: TableRowSelection = { selectedRowKeys, + getCheckboxProps: (record) => { + return { disabled: record.source_type === 'knowledgebase' }; + }, onChange: (newSelectedRowKeys: React.Key[]) => { setSelectedRowKeys(newSelectedRowKeys); },