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
5a534aa6
authored
Jun 12, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: del loading
parent
98e3c0a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
client/src/pages/kb/components/DataCard.tsx
+16
-5
No files found.
client/src/pages/kb/components/DataCard.tsx
View file @
5a534aa6
...
...
@@ -29,6 +29,7 @@ import Papa from 'papaparse';
import
dynamic
from
'next/dynamic'
;
import
InputModal
,
{
FormData
as
InputDataType
}
from
'./InputDataModal'
;
import
{
debounce
}
from
'lodash'
;
import
{
getErrText
}
from
'@/utils/tools'
;
const
SelectFileModal
=
dynamic
(()
=>
import
(
'./SelectFileModal'
));
const
SelectCsvModal
=
dynamic
(()
=>
import
(
'./SelectCsvModal'
));
...
...
@@ -37,6 +38,7 @@ const DataCard = ({ kbId }: { kbId: string }) => {
const
lastSearch
=
useRef
(
''
);
const
[
searchText
,
setSearchText
]
=
useState
(
''
);
const
{
toast
}
=
useToast
();
const
[
isDeleting
,
setIsDeleting
]
=
useState
(
false
);
const
{
data
:
kbDataList
,
...
...
@@ -219,7 +221,7 @@ const DataCard = ({ kbId }: { kbId: string }) => {
pt=
{
3
}
userSelect=
{
'none'
}
boxShadow=
{
'none'
}
_hover=
{
{
boxShadow
:
'lg'
,
'& .delete'
:
{
display
:
'
block
'
}
}
}
_hover=
{
{
boxShadow
:
'lg'
,
'& .delete'
:
{
display
:
'
flex
'
}
}
}
border=
{
'1px solid '
}
borderColor=
{
'myGray.200'
}
onClick=
{
()
=>
...
...
@@ -249,19 +251,28 @@ const DataCard = ({ kbId }: { kbId: string }) => {
</
Box
>
<
IconButton
className=
"delete"
display=
{
[
'
block
'
,
'none'
]
}
display=
{
[
'
flex
'
,
'none'
]
}
icon=
{
<
DeleteIcon
/>
}
variant=
{
'base'
}
colorScheme=
{
'gray'
}
aria
-
label=
{
'delete'
}
size=
{
'xs'
}
borderRadius=
{
'md'
}
lineHeight=
{
1
}
_hover=
{
{
color
:
'red.600'
}
}
isLoading=
{
isDeleting
}
onClick=
{
async
(
e
)
=>
{
e
.
stopPropagation
();
await
delOneKbDataByDataId
(
item
.
id
);
refetchData
(
pageNum
);
try
{
setIsDeleting
(
true
);
await
delOneKbDataByDataId
(
item
.
id
);
refetchData
(
pageNum
);
}
catch
(
error
)
{
toast
({
title
:
getErrText
(
error
),
status
:
'error'
});
}
setIsDeleting
(
false
);
}
}
/>
</
Flex
>
...
...
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