mirror of
https://github.com/langgenius/dify.git
synced 2026-04-25 09:36:40 +08:00
Merge branch 'feat/parent-child-retrieval' of https://github.com/langgenius/dify into feat/parent-child-retrieval
This commit is contained in:
commit
aa0d587516
@ -12,7 +12,7 @@ type IBatchActionProps = {
|
|||||||
selectedIds: string[]
|
selectedIds: string[]
|
||||||
onBatchEnable: () => void
|
onBatchEnable: () => void
|
||||||
onBatchDisable: () => void
|
onBatchDisable: () => void
|
||||||
onBatchDelete: () => void
|
onBatchDelete: () => Promise<void>
|
||||||
onArchive?: () => void
|
onArchive?: () => void
|
||||||
onCancel: () => void
|
onCancel: () => void
|
||||||
}
|
}
|
||||||
@ -31,6 +31,15 @@ const BatchAction: FC<IBatchActionProps> = ({
|
|||||||
setTrue: showDeleteConfirm,
|
setTrue: showDeleteConfirm,
|
||||||
setFalse: hideDeleteConfirm,
|
setFalse: hideDeleteConfirm,
|
||||||
}] = useBoolean(false)
|
}] = useBoolean(false)
|
||||||
|
const [isDeleting, {
|
||||||
|
setTrue: setIsDeleting,
|
||||||
|
}] = useBoolean(false)
|
||||||
|
|
||||||
|
const handleBatchDelete = async () => {
|
||||||
|
setIsDeleting()
|
||||||
|
await onBatchDelete()
|
||||||
|
hideDeleteConfirm()
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className={classNames('w-full flex justify-center gap-x-2', className)}>
|
<div className={classNames('w-full flex justify-center gap-x-2', className)}>
|
||||||
<div className='flex items-center gap-x-1 p-1 rounded-[10px] bg-components-actionbar-bg-accent border border-components-actionbar-border-accent shadow-xl shadow-shadow-shadow-5 backdrop-blur-[5px]'>
|
<div className='flex items-center gap-x-1 p-1 rounded-[10px] bg-components-actionbar-bg-accent border border-components-actionbar-border-accent shadow-xl shadow-shadow-shadow-5 backdrop-blur-[5px]'>
|
||||||
@ -80,11 +89,10 @@ const BatchAction: FC<IBatchActionProps> = ({
|
|||||||
title={t('datasetDocuments.list.delete.title')}
|
title={t('datasetDocuments.list.delete.title')}
|
||||||
content={t('datasetDocuments.list.delete.content')}
|
content={t('datasetDocuments.list.delete.content')}
|
||||||
confirmText={t('common.operation.sure')}
|
confirmText={t('common.operation.sure')}
|
||||||
onConfirm={() => {
|
onConfirm={handleBatchDelete}
|
||||||
onBatchDelete()
|
|
||||||
hideDeleteConfirm()
|
|
||||||
}}
|
|
||||||
onCancel={hideDeleteConfirm}
|
onCancel={hideDeleteConfirm}
|
||||||
|
isLoading={isDeleting}
|
||||||
|
isDisabled={isDeleting}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ export const useDocumentUnArchive = () => {
|
|||||||
export const useDocumentDelete = () => {
|
export const useDocumentDelete = () => {
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: ({ datasetId, documentIds, documentId }: UpdateDocumentBatchParams) => {
|
mutationFn: ({ datasetId, documentIds, documentId }: UpdateDocumentBatchParams) => {
|
||||||
return del<CommonResponse>(`/datasets/${datasetId}/documents/batch?${toBatchDocumentsIdParams(documentId || documentIds!)}`)
|
return del<CommonResponse>(`/datasets/${datasetId}/documents?${toBatchDocumentsIdParams(documentId || documentIds!)}`)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user