@michengai/dsh-archive-manager 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +20 -12
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -2675,7 +2675,12 @@ window.__ModuleLoader__.load({
|
|
|
2675
2675
|
if (option !== void 0) choose(option.value);
|
|
2676
2676
|
return;
|
|
2677
2677
|
}
|
|
2678
|
-
if (event.key === "Escape" || event.key === "Tab")
|
|
2678
|
+
if (event.key === "Escape" || event.key === "Tab") {
|
|
2679
|
+
event.preventDefault();
|
|
2680
|
+
event.stopPropagation();
|
|
2681
|
+
if (typeof event.stopImmediatePropagation === "function") event.stopImmediatePropagation();
|
|
2682
|
+
setOpen(false);
|
|
2683
|
+
}
|
|
2679
2684
|
},
|
|
2680
2685
|
children: options.map((option, index) => (0, react_jsx_runtime.jsx)("button", {
|
|
2681
2686
|
id: id + "-opt-" + String(index),
|
|
@@ -2701,7 +2706,7 @@ window.__ModuleLoader__.load({
|
|
|
2701
2706
|
const [query, setQuery] = (0, react.useState)("");
|
|
2702
2707
|
const [project, setProject] = (0, react.useState)("all");
|
|
2703
2708
|
const groups = (0, react.useMemo)(() => {
|
|
2704
|
-
// 列表仍隐藏 subagent
|
|
2709
|
+
// 列表仍隐藏 subagent;删除全部只提交列表里可见的已归档会话,子代理由服务端级联。
|
|
2705
2710
|
const archived = new Set(workspaceState.archivedSessionIds);
|
|
2706
2711
|
const byWorkspace = workspaceState.items.map((workspace) => ({
|
|
2707
2712
|
title: workspace.title,
|
|
@@ -2726,16 +2731,7 @@ window.__ModuleLoader__.load({
|
|
|
2726
2731
|
sessions: group.sessions.filter((session) => normalizedQuery === "" || displayTitle(session, t).toLocaleLowerCase().includes(normalizedQuery))
|
|
2727
2732
|
})).filter((group) => group.sessions.length > 0);
|
|
2728
2733
|
}, [groups, project, query, t]);
|
|
2729
|
-
const deleteAllSessionIds = (0, react.useMemo)(() =>
|
|
2730
|
-
const ids = [];
|
|
2731
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2732
|
-
for (const id of workspaceState.archivedSessionIds ?? []) {
|
|
2733
|
-
if (typeof id !== "string" || id.length === 0 || seen.has(id)) continue;
|
|
2734
|
-
seen.add(id);
|
|
2735
|
-
ids.push(id);
|
|
2736
|
-
}
|
|
2737
|
-
return ids;
|
|
2738
|
-
}, [workspaceState.archivedSessionIds]);
|
|
2734
|
+
const deleteAllSessionIds = (0, react.useMemo)(() => groups.flatMap((group) => group.sessions.map((session) => session.id)), [groups]);
|
|
2739
2735
|
const onUnarchive = (sessionId) => {
|
|
2740
2736
|
setError(null);
|
|
2741
2737
|
unarchiveSession(sessionId).catch((reason) => {
|
|
@@ -2745,6 +2741,18 @@ window.__ModuleLoader__.load({
|
|
|
2745
2741
|
const closeDelete = () => {
|
|
2746
2742
|
if (!busy) setDeleteTarget(null);
|
|
2747
2743
|
};
|
|
2744
|
+
(0, react.useEffect)(() => {
|
|
2745
|
+
if (deleteTarget === null) return;
|
|
2746
|
+
const onKeyDown = (event) => {
|
|
2747
|
+
if (event.key !== "Escape") return;
|
|
2748
|
+
event.preventDefault();
|
|
2749
|
+
event.stopPropagation();
|
|
2750
|
+
if (typeof event.stopImmediatePropagation === "function") event.stopImmediatePropagation();
|
|
2751
|
+
if (!busy) setDeleteTarget(null);
|
|
2752
|
+
};
|
|
2753
|
+
window.addEventListener("keydown", onKeyDown, true);
|
|
2754
|
+
return () => window.removeEventListener("keydown", onKeyDown, true);
|
|
2755
|
+
}, [deleteTarget, busy]);
|
|
2748
2756
|
const confirmDelete = async () => {
|
|
2749
2757
|
if (busy || deleteTarget === null) return;
|
|
2750
2758
|
setBusy(true);
|