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
ac493db0
authored
Jul 10, 2025
by
heheer
Committed by
GitHub
Jul 10, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tag manage modal scroll (#5193)
parent
286138a4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
70 deletions
+41
-70
projects/app/src/pageComponents/dataset/detail/CollectionCard/TagManageModal.tsx
+41
-70
No files found.
projects/app/src/pageComponents/dataset/detail/CollectionCard/TagManageModal.tsx
View file @
ac493db0
...
@@ -18,10 +18,7 @@ import {
...
@@ -18,10 +18,7 @@ import {
import
{
useRequest2
}
from
'@fastgpt/web/hooks/useRequest'
;
import
{
useRequest2
}
from
'@fastgpt/web/hooks/useRequest'
;
import
MyInput
from
'@/components/MyInput'
;
import
MyInput
from
'@/components/MyInput'
;
import
{
type
DatasetTagType
}
from
'@fastgpt/global/core/dataset/type'
;
import
{
type
DatasetTagType
}
from
'@fastgpt/global/core/dataset/type'
;
import
{
import
{
useScrollPagination
}
from
'@fastgpt/web/hooks/useScrollPagination'
;
type
ScrollListType
,
useVirtualScrollPagination
}
from
'@fastgpt/web/hooks/useScrollPagination'
;
import
EmptyTip
from
'@fastgpt/web/components/common/EmptyTip'
;
import
EmptyTip
from
'@fastgpt/web/components/common/EmptyTip'
;
import
PopoverConfirm
from
'@fastgpt/web/components/common/MyPopover/PopoverConfirm'
;
import
PopoverConfirm
from
'@fastgpt/web/components/common/MyPopover/PopoverConfirm'
;
import
{
type
DatasetCollectionsListItemType
}
from
'@/global/core/dataset/type'
;
import
{
type
DatasetCollectionsListItemType
}
from
'@/global/core/dataset/type'
;
...
@@ -70,7 +67,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -70,7 +67,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
}),
}),
{
{
onSuccess
()
{
onSuccess
()
{
fetchData
(
1
);
refreshList
(
);
setSearchTagKey
(
''
);
setSearchTagKey
(
''
);
loadAllDatasetTags
();
loadAllDatasetTags
();
},
},
...
@@ -89,7 +86,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -89,7 +86,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
},
},
{
{
onSuccess
()
{
onSuccess
()
{
fetchData
(
1
);
refreshList
(
);
setSearchTagKey
(
''
);
setSearchTagKey
(
''
);
loadAllDatasetTags
();
loadAllDatasetTags
();
}
}
...
@@ -124,59 +121,40 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -124,59 +121,40 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
// Tags list
// Tags list
const
{
const
{
scrollDataList
:
renderTags
,
data
:
collectionTags
,
totalData
:
collectionTags
,
ScrollData
,
ScrollList
,
refreshList
,
isLoading
:
isRequesting
,
fetchData
,
total
:
tagsTotal
total
:
tagsTotal
}
=
useVirtualScrollPagination
(
getDatasetCollectionTags
,
{
}
=
useScrollPagination
(
getDatasetCollectionTags
,
{
refreshDeps
:
[
''
],
// debounceWait: 300,
itemHeight
:
56
,
overscan
:
10
,
pageSize
:
10
,
pageSize
:
10
,
defaultP
arams
:
{
p
arams
:
{
datasetId
:
datasetDetail
.
_id
,
datasetId
:
datasetDetail
.
_id
,
searchText
:
''
searchText
}
},
refreshDeps
:
[
searchText
],
EmptyTip
:
<
EmptyTip
text=
{
t
(
'dataset:dataset.no_tags'
)
}
/>
});
});
// Collections list
// Collections list
const
{
const
{
data
:
collectionsList
,
ScrollData
:
ScrollDataCollections
}
=
useScrollPagination
(
scrollDataList
:
collectionsList
,
getDatasetCollections
,
ScrollList
:
ScrollListCollections
,
{
isLoading
:
collectionsListLoading
}
=
useVirtualScrollPagination
(
getDatasetCollections
,
{
refreshDeps
:
[
searchText
],
// debounceWait: 300,
itemHeight
:
37
,
overscan
:
10
,
pageSize
:
30
,
pageSize
:
30
,
defaultP
arams
:
{
p
arams
:
{
datasetId
:
datasetDetail
.
_id
,
datasetId
:
datasetDetail
.
_id
,
simple
:
true
,
simple
:
true
,
searchText
searchText
},
refreshDeps
:
[
searchText
],
EmptyTip
:
<
EmptyTip
text=
{
t
(
'dataset:dataset.no_collections'
)
}
/>
}
}
}
);
);
const
{
data
:
tagUsages
}
=
useRequest2
(()
=>
getTagUsage
(
datasetDetail
.
_id
),
{
const
{
data
:
tagUsages
}
=
useRequest2
(()
=>
getTagUsage
(
datasetDetail
.
_id
),
{
manual
:
false
,
manual
:
false
,
refreshDeps
:
[
collections
]
refreshDeps
:
[
collections
]
});
});
const
isLoading
=
isRequesting
||
isCreateCollectionTagLoading
||
isDeleteCollectionTagLoading
||
isUpdateCollectionTagLoading
||
isSaveCollectionTagLoading
||
collectionsListLoading
;
return
(
return
(
<
MyModal
<
MyModal
isOpen
isOpen
...
@@ -187,7 +165,6 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -187,7 +165,6 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
w=
{
'580px'
}
w=
{
'580px'
}
h=
{
'600px'
}
h=
{
'600px'
}
closeOnOverlayClick=
{
false
}
closeOnOverlayClick=
{
false
}
isLoading=
{
isLoading
}
>
>
{
currentAddTag
===
undefined
?
(
{
currentAddTag
===
undefined
?
(
<>
<>
...
@@ -205,6 +182,15 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -205,6 +182,15 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
total
:
tagsTotal
total
:
tagsTotal
})
}
})
}
</
Box
>
</
Box
>
<
MyInput
placeholder=
{
t
(
'common:Search'
)
}
w=
{
'160px'
}
h=
{
8
}
mr=
{
2
}
onChange=
{
(
e
)
=>
{
setSearchText
(
e
.
target
.
value
);
}
}
/>
<
Button
<
Button
size=
{
'sm'
}
size=
{
'sm'
}
leftIcon=
{
<
MyIcon
name=
"common/addLight"
w=
{
4
}
/>
}
leftIcon=
{
<
MyIcon
name=
"common/addLight"
w=
{
4
}
/>
}
...
@@ -229,7 +215,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -229,7 +215,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
onBlur=
{
async
()
=>
{
onBlur=
{
async
()
=>
{
if
(
newTag
&&
!
collectionTags
.
map
((
item
)
=>
item
.
tag
).
includes
(
newTag
))
{
if
(
newTag
&&
!
collectionTags
.
map
((
item
)
=>
item
.
tag
).
includes
(
newTag
))
{
await
onCreateCollectionTag
(
newTag
);
await
onCreateCollectionTag
(
newTag
);
fetchData
(
1
);
refreshList
(
);
}
}
setNewTag
(
undefined
);
setNewTag
(
undefined
);
}
}
}
}
...
@@ -237,14 +223,8 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -237,14 +223,8 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
</
Flex
>
</
Flex
>
)
}
)
}
</
Flex
>
</
Flex
>
<
ScrollList
<
ScrollData
px=
{
8
}
flex=
{
'1 0 0'
}
fontSize=
{
'sm'
}
pb=
{
2
}
>
px=
{
8
}
{
collectionTags
.
map
((
item
)
=>
{
flex=
{
'1 0 0'
}
fontSize=
{
'sm'
}
EmptyChildren=
{
<
EmptyTip
text=
{
t
(
'dataset:dataset.no_tags'
)
}
/>
}
>
{
renderTags
.
map
((
listItem
)
=>
{
const
item
=
listItem
.
data
;
const
tagUsage
=
tagUsages
?.
find
((
tagUsage
)
=>
tagUsage
.
tagId
===
item
.
_id
);
const
tagUsage
=
tagUsages
?.
find
((
tagUsage
)
=>
tagUsage
.
tagId
===
item
.
_id
);
const
collections
=
tagUsage
?.
collections
||
[];
const
collections
=
tagUsage
?.
collections
||
[];
const
usage
=
collections
.
length
;
const
usage
=
collections
.
length
;
...
@@ -324,6 +304,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -324,6 +304,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
borderRadius=
{
'sm'
}
borderRadius=
{
'sm'
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
setCurrentAddTag
({
...
item
,
collections
});
setCurrentAddTag
({
...
item
,
collections
});
setSearchText
(
''
);
}
}
}
}
cursor=
{
'pointer'
}
cursor=
{
'pointer'
}
>
>
...
@@ -366,7 +347,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -366,7 +347,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
</
Flex
>
</
Flex
>
);
);
})
}
})
}
</
Scroll
List
>
</
Scroll
Data
>
</>
</>
)
:
(
)
:
(
<
AddTagToCollections
<
AddTagToCollections
...
@@ -375,7 +356,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -375,7 +356,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
onSaveCollectionTag=
{
onSaveCollectionTag
}
onSaveCollectionTag=
{
onSaveCollectionTag
}
setSearchText=
{
setSearchText
}
setSearchText=
{
setSearchText
}
collectionsList=
{
collectionsList
}
collectionsList=
{
collectionsList
}
Scroll
ListCollections=
{
ScrollList
Collections
}
Scroll
DataCollections=
{
ScrollData
Collections
}
/>
/>
)
}
)
}
</
MyModal
>
</
MyModal
>
...
@@ -390,7 +371,7 @@ const AddTagToCollections = ({
...
@@ -390,7 +371,7 @@ const AddTagToCollections = ({
onSaveCollectionTag
,
onSaveCollectionTag
,
setSearchText
,
setSearchText
,
collectionsList
,
collectionsList
,
Scroll
List
Collections
Scroll
Data
Collections
}:
{
}:
{
currentAddTag
:
DatasetTagType
&
{
collections
:
string
[]
};
currentAddTag
:
DatasetTagType
&
{
collections
:
string
[]
};
setCurrentAddTag
:
(
tag
:
(
DatasetTagType
&
{
collections
:
string
[]
})
|
undefined
)
=>
void
;
setCurrentAddTag
:
(
tag
:
(
DatasetTagType
&
{
collections
:
string
[]
})
|
undefined
)
=>
void
;
...
@@ -404,11 +385,8 @@ const AddTagToCollections = ({
...
@@ -404,11 +385,8 @@ const AddTagToCollections = ({
collectionIds
:
string
[];
collectionIds
:
string
[];
})
=>
void
;
})
=>
void
;
setSearchText
:
(
text
:
string
)
=>
void
;
setSearchText
:
(
text
:
string
)
=>
void
;
collectionsList
:
{
collectionsList
:
DatasetCollectionsListItemType
[];
index
:
number
;
ScrollDataCollections
:
ReturnType
<
typeof
useScrollPagination
>
[
'ScrollData'
];
data
:
DatasetCollectionsListItemType
;
}[];
ScrollListCollections
:
ScrollListType
;
})
=>
{
})
=>
{
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
...
@@ -419,8 +397,7 @@ const AddTagToCollections = ({
...
@@ -419,8 +397,7 @@ const AddTagToCollections = ({
const
formatCollections
=
useMemo
(
const
formatCollections
=
useMemo
(
()
=>
()
=>
collectionsList
.
map
((
item
)
=>
{
collectionsList
.
map
((
collection
)
=>
{
const
collection
=
item
.
data
;
const
icon
=
getCollectionIcon
({
type
:
collection
.
type
,
name
:
collection
.
name
});
const
icon
=
getCollectionIcon
({
type
:
collection
.
type
,
name
:
collection
.
name
});
return
{
return
{
id
:
collection
.
_id
,
id
:
collection
.
_id
,
...
@@ -488,13 +465,7 @@ const AddTagToCollections = ({
...
@@ -488,13 +465,7 @@ const AddTagToCollections = ({
{
t
(
'common:Save'
)
}
{
t
(
'common:Save'
)
}
</
Button
>
</
Button
>
</
Flex
>
</
Flex
>
<
ScrollListCollections
<
ScrollDataCollections
px=
{
8
}
mt=
{
2
}
flex=
{
'1 0 0'
}
fontSize=
{
'sm'
}
>
px=
{
8
}
mt=
{
2
}
flex=
{
'1 0 0'
}
fontSize=
{
'sm'
}
EmptyChildren=
{
<
EmptyTip
text=
{
t
(
'dataset:dataset.no_collections'
)
}
/>
}
>
{
formatCollections
.
map
((
collection
)
=>
{
{
formatCollections
.
map
((
collection
)
=>
{
return
(
return
(
<
Flex
<
Flex
...
@@ -544,7 +515,7 @@ const AddTagToCollections = ({
...
@@ -544,7 +515,7 @@ const AddTagToCollections = ({
</
Flex
>
</
Flex
>
);
);
})
}
})
}
</
Scroll
List
Collections
>
</
Scroll
Data
Collections
>
</>
</>
);
);
};
};
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