Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: add loading to 'delete' button & 'save' button (#9214)

Wu Tianwei8bcad002dffc
diff --git a/web/app/components/datasets/documents/list.tsx b/web/app/components/datasets/documents/list.tsx
index 540474e7a57..0e0eebb034d 100644
--- a/web/app/components/datasets/documents/list.tsx
+++ b/web/app/components/datasets/documents/list.tsx
@@ -122,6 +122,7 @@ export const OperationAction: FC<{
}> = ({ embeddingAvailable, datasetId, detail, onUpdate, scene = 'list', className = '' }) => {
const { id, enabled = false, archived = false, data_source_type } = detail || {}
const [showModal, setShowModal] = useState(false)
+ const [deleting, setDeleting] = useState(false)
const { notify } = useContext(ToastContext)
const { t } = useTranslation()
const router = useRouter()
@@ -153,6 +154,7 @@ export const OperationAction: FC<{
break
default:
opApi = deleteDocument
+ setDeleting(true)
break
}
const [e] = await asyncRunSafe<CommonResponse>(opApi({ datasetId, documentId: id }) as Promise<CommonResponse>)
@@ -160,6 +162,8 @@ export const OperationAction: FC<{
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
else
notify({ type: 'error', message: t('common.actionMsg.modifiedUnsuccessfully') })
+ if (operationName === 'delete')
+ setDeleting(false)
onUpdate(operationName)
}
@@ -295,6 +299,8 @@ export const OperationAction: FC<{
{showModal
&& <Confirm
isShow={showModal}
+ isLoading={deleting}
+ isDisabled={deleting}
title={t('datasetDocuments.list.delete.title')}
content={t('datasetDocuments.list.delete.content')}
confirmText={t('common.operation.sure')}
diff --git a/web/app/components/datasets/settings/form/index.tsx b/web/app/components/datasets/settings/form/index.tsx
index 0bdfa3c5c88..fa8c8de62ec 100644
--- a/web/app/components/datasets/settings/form/index.tsx
+++ b/web/app/components/datasets/settings/form/index.tsx
@@ -335,6 +335,8 @@ const Form = () => {
<Button
className='min-w-24'
variant='primary'
+ loading={loading}
+ disabled={loading}
onClick={handleSave}
>
{t('datasetSettings.form.save')}