Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
90f5f84b
authored
Aug 14, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: del dat confirm
parent
3a49efd4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletions
+16
-1
client/public/locales/en/common.json
+3
-0
client/public/locales/zh/common.json
+3
-0
client/src/pages/kb/detail/components/DataCard.tsx
+10
-1
No files found.
client/public/locales/en/common.json
View file @
90f5f84b
...
@@ -37,6 +37,9 @@
...
@@ -37,6 +37,9 @@
"Input"
:
"Input"
,
"Input"
:
"Input"
,
"Output"
:
"Output"
"Output"
:
"Output"
},
},
"dataset"
:
{
"Confirm to delete the data"
:
"Confirm to delete the data?"
},
"file"
:
{
"file"
:
{
"Click to download CSV template"
:
"Click to download CSV template"
,
"Click to download CSV template"
:
"Click to download CSV template"
,
"Drag and drop"
:
"Drag and drop files here, or click"
,
"Drag and drop"
:
"Drag and drop files here, or click"
,
...
...
client/public/locales/zh/common.json
View file @
90f5f84b
...
@@ -37,6 +37,9 @@
...
@@ -37,6 +37,9 @@
"Input"
:
"输入"
,
"Input"
:
"输入"
,
"Output"
:
"输出"
"Output"
:
"输出"
},
},
"dataset"
:
{
"Confirm to delete the data"
:
"确认删除该数据?"
},
"file"
:
{
"file"
:
{
"Click to download CSV template"
:
"点击下载 CSV 模板"
,
"Click to download CSV template"
:
"点击下载 CSV 模板"
,
"Drag and drop"
:
"拖拽文件至此,或点击"
,
"Drag and drop"
:
"拖拽文件至此,或点击"
,
...
...
client/src/pages/kb/detail/components/DataCard.tsx
View file @
90f5f84b
...
@@ -16,15 +16,21 @@ import Papa from 'papaparse';
...
@@ -16,15 +16,21 @@ import Papa from 'papaparse';
import
InputModal
,
{
FormData
as
InputDataType
}
from
'./InputDataModal'
;
import
InputModal
,
{
FormData
as
InputDataType
}
from
'./InputDataModal'
;
import
{
debounce
}
from
'lodash'
;
import
{
debounce
}
from
'lodash'
;
import
{
getErrText
}
from
'@/utils/tools'
;
import
{
getErrText
}
from
'@/utils/tools'
;
import
{
useConfirm
}
from
'@/hooks/useConfirm'
;
import
{
useTranslation
}
from
'react-i18next'
;
import
MyIcon
from
'@/components/Icon'
;
import
MyIcon
from
'@/components/Icon'
;
import
MyTooltip
from
'@/components/MyTooltip'
;
import
MyTooltip
from
'@/components/MyTooltip'
;
const
DataCard
=
({
kbId
}:
{
kbId
:
string
})
=>
{
const
DataCard
=
({
kbId
}:
{
kbId
:
string
})
=>
{
const
BoxRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
BoxRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
lastSearch
=
useRef
(
''
);
const
lastSearch
=
useRef
(
''
);
const
{
t
}
=
useTranslation
();
const
[
searchText
,
setSearchText
]
=
useState
(
''
);
const
[
searchText
,
setSearchText
]
=
useState
(
''
);
const
{
toast
}
=
useToast
();
const
{
toast
}
=
useToast
();
const
[
isDeleting
,
setIsDeleting
]
=
useState
(
false
);
const
[
isDeleting
,
setIsDeleting
]
=
useState
(
false
);
const
{
openConfirm
,
ConfirmModal
}
=
useConfirm
({
content
:
t
(
'dataset.Confirm to delete the data'
)
});
const
{
const
{
data
:
kbDataList
,
data
:
kbDataList
,
...
@@ -225,8 +231,9 @@ const DataCard = ({ kbId }: { kbId: string }) => {
...
@@ -225,8 +231,9 @@ const DataCard = ({ kbId }: { kbId: string }) => {
borderRadius=
{
'md'
}
borderRadius=
{
'md'
}
_hover=
{
{
color
:
'red.600'
}
}
_hover=
{
{
color
:
'red.600'
}
}
isLoading=
{
isDeleting
}
isLoading=
{
isDeleting
}
onClick=
{
async
(
e
)
=>
{
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
e
.
stopPropagation
();
openConfirm
(
async
()
=>
{
try
{
try
{
setIsDeleting
(
true
);
setIsDeleting
(
true
);
await
delOneKbDataByDataId
(
item
.
id
);
await
delOneKbDataByDataId
(
item
.
id
);
...
@@ -238,6 +245,7 @@ const DataCard = ({ kbId }: { kbId: string }) => {
...
@@ -238,6 +245,7 @@ const DataCard = ({ kbId }: { kbId: string }) => {
});
});
}
}
setIsDeleting
(
false
);
setIsDeleting
(
false
);
})();
}
}
}
}
/>
/>
</
Flex
>
</
Flex
>
...
@@ -267,6 +275,7 @@ const DataCard = ({ kbId }: { kbId: string }) => {
...
@@ -267,6 +275,7 @@ const DataCard = ({ kbId }: { kbId: string }) => {
onSuccess=
{
()
=>
refetchData
()
}
onSuccess=
{
()
=>
refetchData
()
}
/>
/>
)
}
)
}
<
ConfirmModal
/>
</
Box
>
</
Box
>
);
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment