feat(vault): add confirmation dialog for stop enrichment button

This commit is contained in:
viettranx committed 2026-04-12 18:16:42 +07:00
1 parent 853255a227
commit 1808523f3f
4 files changed
+19 -1

No files matched your search

+2
View File
@@ -75,6 +75,8 @@
"enrichStopped": "Enrichment stopped",
"enrichStopFailed": "Failed to stop enrichment",
"stopEnrich": "Stop enrichment",
"stopEnrichConfirm": "Are you sure you want to stop the enrichment process? Documents already processed will keep their summaries.",
"stop": "Stop",
"errors": "errors",
"rescanNew": "{{count}} new",
"rescanUpdated": "{{count}} updated",
+2
View File
@@ -75,6 +75,8 @@
"enrichStopped": "Đã dừng xử lý",
"enrichStopFailed": "Không thể dừng xử lý",
"stopEnrich": "Dừng xử lý",
"stopEnrichConfirm": "Bạn có chắc muốn dừng quá trình xử lý? Các tài liệu đã xử lý sẽ giữ nguyên.",
"stop": "Dừng",
"errors": "lỗi",
"rescanNew": "{{count}} mới",
"rescanUpdated": "{{count}} cập nhật",
+2
View File
@@ -75,6 +75,8 @@
"enrichStopped": "处理已停止",
"enrichStopFailed": "停止处理失败",
"stopEnrich": "停止处理",
"stopEnrichConfirm": "确定要停止处理吗?已处理的文档将保留其摘要。",
"stop": "停止",
"errors": "错误",
"rescanNew": "{{count}} 个新文件",
"rescanUpdated": "{{count}} 个已更新",
+13 -1
View File
@@ -14,6 +14,7 @@ import { toast } from "@/stores/use-toast-store";
import { VaultDocumentSidebar } from "./vault-document-sidebar";
import { VaultSearchDialog } from "./vault-search-dialog";
import { VaultCreateDialog } from "./vault-create-dialog";
import { ConfirmDialog } from "@/components/shared/confirm-dialog";
import type { VaultDocument } from "@/types/vault";
const VaultGraphView = lazy(() =>
@@ -41,6 +42,7 @@ export function VaultPage() {
const [searchOpen, setSearchOpen] = useState(false);
const [createOpen, setCreateOpen] = useState(false);
const [sidebarOpen, setSidebarOpen] = useState(false);
const [stopConfirmOpen, setStopConfirmOpen] = useState(false);
const { rescan, isPending: rescanPending } = useRescanWorkspace();
const { stop: stopEnrich, isPending: stopPending } = useStopEnrichment();
@@ -155,7 +157,7 @@ export function VaultPage() {
<Button
size="sm"
variant="outline"
onClick={enriching ? stopEnrich : async () => { await rescan(); loadRoot(); }}
onClick={enriching ? () => setStopConfirmOpen(true) : async () => { await rescan(); loadRoot(); }}
disabled={rescanPending || stopPending}
>
{rescanPending || stopPending ? (
@@ -222,6 +224,16 @@ export function VaultPage() {
/>
)}
<VaultCreateDialog open={createOpen} onOpenChange={setCreateOpen} defaultAgentId={selectedAgent} defaultTeamId={selectedTeam} />
<ConfirmDialog
open={stopConfirmOpen}
onOpenChange={setStopConfirmOpen}
title={t("stopEnrich", "Stop enrichment")}
description={t("stopEnrichConfirm", "Are you sure you want to stop the enrichment process? Documents already processed will keep their summaries.")}
confirmLabel={t("stop", "Stop")}
variant="destructive"
onConfirm={() => { stopEnrich(); setStopConfirmOpen(false); }}
loading={stopPending}
/>
<Suspense fallback={null}>
<VaultDetailDialog