@kangyishuai/dsh-session-delete 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +123 -2
- package/README.zh-CN.md +124 -0
- package/cordis.patch.yml +3 -0
- package/lib/audit.js +93 -0
- package/lib/capability.js +106 -0
- package/lib/client.js +1412 -0
- package/lib/index.js +7 -0
- package/lib/journal.js +136 -0
- package/lib/locate.js +129 -0
- package/lib/operations.js +848 -0
- package/lib/paths.js +148 -0
- package/lib/plan.js +185 -0
- package/lib/receipts.js +65 -0
- package/lib/refs.js +192 -0
- package/lib/service.js +202 -0
- package/lib/trash.js +250 -0
- package/locale/en.json +49 -0
- package/locale/zh.json +49 -0
- package/package.json +57 -3
package/lib/client.js
ADDED
|
@@ -0,0 +1,1412 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// client 半:classic script,以 __ModuleLoader__.load 注册 factory,不能使用 import。
|
|
3
|
+
// 注册:会话「…」菜单两项 + shell.overlay 里的确认框、回收站面板、toast(一次注册,三个浮层)。
|
|
4
|
+
// 宿主调用走 ctx.connection.rpc.call("/api", ...) —— 无构建插件没有 typert 生成的客户端产物,
|
|
5
|
+
// 因此不能用 ctx.reflect.get("remote.xxx")(见 docs/runtime/0.2.1-rc.5.md §6.10)。
|
|
6
|
+
window.__ModuleLoader__.load({
|
|
7
|
+
id: "@kangyishuai/dsh-session-delete",
|
|
8
|
+
factory(require) {
|
|
9
|
+
var module = { exports: /** @type {any} */ ({}) };
|
|
10
|
+
var exports = module.exports;
|
|
11
|
+
|
|
12
|
+
/** @type {any} */
|
|
13
|
+
var React = require("react");
|
|
14
|
+
var h = React.createElement;
|
|
15
|
+
|
|
16
|
+
/** 官方 UI 原语:优先用它们以获得主题与动效,缺失时回退到自绘。 */
|
|
17
|
+
/** @type {any} */
|
|
18
|
+
var primitives = {};
|
|
19
|
+
try {
|
|
20
|
+
primitives = require("@deepseek-ai/dsh-client-ui-primitives") || {};
|
|
21
|
+
} catch (error) {
|
|
22
|
+
primitives = {};
|
|
23
|
+
}
|
|
24
|
+
var MenuItemButton = primitives.MenuItemButton;
|
|
25
|
+
var Modal = primitives.Modal;
|
|
26
|
+
var IconTrash = primitives.IconTrashOutlineRegular;
|
|
27
|
+
|
|
28
|
+
/** 设计变量(宿主主题 token):深色/浅色自动跟随。 */
|
|
29
|
+
var T = {
|
|
30
|
+
bg: "var(--dsw-alias-bg-layer-2, var(--dsw-alias-bg-base, Canvas))",
|
|
31
|
+
bgBase: "var(--dsw-alias-bg-base, Canvas)",
|
|
32
|
+
text: "var(--dsw-alias-label-primary, CanvasText)",
|
|
33
|
+
dim: "var(--dsw-alias-label-secondary, GrayText)",
|
|
34
|
+
faint: "var(--dsw-alias-label-tertiary, GrayText)",
|
|
35
|
+
border: "var(--dsw-alias-border-l2, rgba(128,128,128,0.35))",
|
|
36
|
+
hover: "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.12))",
|
|
37
|
+
danger: "var(--dsw-alias-state-error-primary, #d9534f)",
|
|
38
|
+
mask: "var(--dsw-alias-bg-mask-1, rgba(0,0,0,0.45))",
|
|
39
|
+
toastBg: "var(--dsw-alias-toast-bg, Canvas)",
|
|
40
|
+
toastText: "var(--dsw-alias-toast-label, CanvasText)",
|
|
41
|
+
radius: "10px",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** locale 命名空间;必须与 locale/*.json 顶层键一致。 */
|
|
45
|
+
var NS = "sessionDelete";
|
|
46
|
+
|
|
47
|
+
/** 简体中文词典(键集的事实来源)。 */
|
|
48
|
+
var zh = {
|
|
49
|
+
"menu.delete": "删除会话…",
|
|
50
|
+
"menu.trash": "回收站…",
|
|
51
|
+
"footer.trash": "回收站",
|
|
52
|
+
"confirm.title": "删除这个会话?",
|
|
53
|
+
"confirm.loading": "正在读取影响面…",
|
|
54
|
+
"confirm.desc": "会话会被移入本机回收站,可以恢复。",
|
|
55
|
+
"confirm.size": "会话日志约 {size}",
|
|
56
|
+
"confirm.live": "该会话仍在本机打开,删除前会先停止它的工作。",
|
|
57
|
+
"confirm.children": "会一并带上 {n} 个子代理会话",
|
|
58
|
+
"confirm.refs": "将清理:{list}",
|
|
59
|
+
"confirm.trashPath": "回收站位置:{path}",
|
|
60
|
+
"confirm.blocked": "暂时无法删除:{reason}",
|
|
61
|
+
"confirm.cancel": "取消",
|
|
62
|
+
"confirm.confirm": "移入回收站",
|
|
63
|
+
"confirm.pending": "正在移入回收站…",
|
|
64
|
+
"confirm.done": "已移入回收站",
|
|
65
|
+
"confirm.undo": "撤销",
|
|
66
|
+
"confirm.failed": "删除失败",
|
|
67
|
+
"panel.title": "会话回收站",
|
|
68
|
+
"panel.tabTrash": "回收站",
|
|
69
|
+
"panel.tabAudit": "审计",
|
|
70
|
+
"panel.tabHealth": "体检",
|
|
71
|
+
"panel.tabReceipts": "回执",
|
|
72
|
+
"receipts.empty": "还没有操作回执。",
|
|
73
|
+
"receipts.restored": "已移回原位置",
|
|
74
|
+
"health.loading": "正在检查…",
|
|
75
|
+
"health.inventory":
|
|
76
|
+
"已存 {stored} · live {live} · 归档 {archived} · 回收站 {trash} · 待处理 {pending}",
|
|
77
|
+
"health.ok": "未发现失效引用。",
|
|
78
|
+
"health.items": "{n} 条",
|
|
79
|
+
"health.unavailable": "无法体检:{reason}",
|
|
80
|
+
"health.clean": "清理失效引用({n})",
|
|
81
|
+
"health.cleanConfirm": "确认清理 {n} 条?只动登记表,不碰会话文件",
|
|
82
|
+
"health.cleanDone": "已清理 {n} 条",
|
|
83
|
+
"panel.empty": "回收站是空的。",
|
|
84
|
+
"panel.auditEmpty": "还没有审计记录。",
|
|
85
|
+
"panel.restore": "恢复",
|
|
86
|
+
"panel.purge": "彻底删除",
|
|
87
|
+
"panel.purgeConfirm": "彻底删除?不可恢复",
|
|
88
|
+
"panel.size": "占用 {size}",
|
|
89
|
+
"panel.trashedAt": "删除于 {time}",
|
|
90
|
+
"panel.unknown": "{n} 个无法识别的目录已保留",
|
|
91
|
+
"panel.pending": "{n} 个未完成的操作",
|
|
92
|
+
"panel.readOnly": "只读模式:当前 DSH 版本缺少依赖接口,删除功能已禁用。",
|
|
93
|
+
"panel.close": "关闭",
|
|
94
|
+
"toast.failed": "操作失败:{message}",
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/** English dictionary(键集与 zh 完全一致)。 */
|
|
98
|
+
var en = {
|
|
99
|
+
"menu.delete": "Delete session…",
|
|
100
|
+
"menu.trash": "Trash…",
|
|
101
|
+
"footer.trash": "Trash",
|
|
102
|
+
"confirm.title": "Delete this session?",
|
|
103
|
+
"confirm.loading": "Reading what will be removed…",
|
|
104
|
+
"confirm.desc": "The session moves to the local trash and can be restored.",
|
|
105
|
+
"confirm.size": "Session log is about {size}",
|
|
106
|
+
"confirm.live": "This session is still open; its work is stopped first.",
|
|
107
|
+
"confirm.children": "{n} subagent session(s) come along",
|
|
108
|
+
"confirm.refs": "Will clean: {list}",
|
|
109
|
+
"confirm.trashPath": "Trash location: {path}",
|
|
110
|
+
"confirm.blocked": "Cannot delete right now: {reason}",
|
|
111
|
+
"confirm.cancel": "Cancel",
|
|
112
|
+
"confirm.confirm": "Move to trash",
|
|
113
|
+
"confirm.pending": "Moving to trash…",
|
|
114
|
+
"confirm.done": "Moved to trash",
|
|
115
|
+
"confirm.undo": "Undo",
|
|
116
|
+
"confirm.failed": "Deletion failed",
|
|
117
|
+
"panel.title": "Session trash",
|
|
118
|
+
"panel.tabTrash": "Trash",
|
|
119
|
+
"panel.tabAudit": "Audit",
|
|
120
|
+
"panel.tabHealth": "Health",
|
|
121
|
+
"panel.tabReceipts": "Receipts",
|
|
122
|
+
"receipts.empty": "No operation receipts yet.",
|
|
123
|
+
"receipts.restored": "restored",
|
|
124
|
+
"health.loading": "Checking…",
|
|
125
|
+
"health.inventory":
|
|
126
|
+
"stored {stored} · live {live} · archived {archived} · trash {trash} · pending {pending}",
|
|
127
|
+
"health.ok": "No dangling references found.",
|
|
128
|
+
"health.items": "{n} item(s)",
|
|
129
|
+
"health.unavailable": "Cannot run the check: {reason}",
|
|
130
|
+
"health.clean": "Clean dangling references ({n})",
|
|
131
|
+
"health.cleanConfirm": "Clean {n} dangling reference(s)? Bookkeeping only, no session files.",
|
|
132
|
+
"health.cleanDone": "Cleaned {n}",
|
|
133
|
+
"panel.empty": "The trash is empty.",
|
|
134
|
+
"panel.auditEmpty": "No audit entries yet.",
|
|
135
|
+
"panel.restore": "Restore",
|
|
136
|
+
"panel.purge": "Delete for good",
|
|
137
|
+
"panel.purgeConfirm": "Delete for good? This cannot be undone",
|
|
138
|
+
"panel.size": "{size}",
|
|
139
|
+
"panel.trashedAt": "Trashed {time}",
|
|
140
|
+
"panel.unknown": "{n} unrecognized director(ies) kept",
|
|
141
|
+
"panel.pending": "{n} unfinished operation(s)",
|
|
142
|
+
"panel.readOnly":
|
|
143
|
+
"Read-only: this DSH version is missing required APIs; deletion is disabled.",
|
|
144
|
+
"panel.close": "Close",
|
|
145
|
+
"toast.failed": "Operation failed: {message}",
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/** @param {any} initial @returns {any} */
|
|
149
|
+
function createStore(initial) {
|
|
150
|
+
var value = initial;
|
|
151
|
+
var listeners = new Set();
|
|
152
|
+
return {
|
|
153
|
+
getSnapshot: () => value,
|
|
154
|
+
subscribe: (/** @type {any} */ listener) => {
|
|
155
|
+
listeners.add(listener);
|
|
156
|
+
return () => {
|
|
157
|
+
listeners.delete(listener);
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
set: (/** @type {any} */ next) => {
|
|
161
|
+
value = typeof next === "function" ? next(value) : next;
|
|
162
|
+
listeners.forEach((/** @type {any} */ listener) => {
|
|
163
|
+
listener();
|
|
164
|
+
});
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function useStore(/** @type {any} */ store) {
|
|
170
|
+
return [React.useSyncExternalStore(store.subscribe, store.getSnapshot), store.set];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** 主题化按钮:优先官方 Button,缺失时自绘。 */
|
|
174
|
+
/** 主题化按钮:hover / active / focus-visible 由注入的 CSS 类提供,不依赖合成事件。 */
|
|
175
|
+
function Btn(/** @type {any} */ props) {
|
|
176
|
+
return h(
|
|
177
|
+
"button",
|
|
178
|
+
{
|
|
179
|
+
type: "button",
|
|
180
|
+
autoFocus: props.autoFocus,
|
|
181
|
+
disabled: props.disabled,
|
|
182
|
+
onClick: props.onClick,
|
|
183
|
+
className: "dsh-sdel-btn" + (props.danger ? " dsh-sdel-btn--danger" : ""),
|
|
184
|
+
style: {
|
|
185
|
+
padding: "6px 14px",
|
|
186
|
+
borderRadius: "8px",
|
|
187
|
+
fontSize: "13px",
|
|
188
|
+
cursor: props.disabled ? "not-allowed" : "pointer",
|
|
189
|
+
opacity: props.disabled ? 0.45 : 1,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
props.children,
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** 挂载时淡入的容器:官方 Modal 没有明确的入场过渡时,用它补齐。 */
|
|
197
|
+
function Reveal(/** @type {any} */ props) {
|
|
198
|
+
const state = React.useState(false);
|
|
199
|
+
const shown = state[0];
|
|
200
|
+
const setShown = state[1];
|
|
201
|
+
React.useEffect(() => {
|
|
202
|
+
const frame = requestAnimationFrame(() => setShown(true));
|
|
203
|
+
return () => cancelAnimationFrame(frame);
|
|
204
|
+
}, []);
|
|
205
|
+
const style = Object.assign(
|
|
206
|
+
{
|
|
207
|
+
opacity: shown ? 1 : 0,
|
|
208
|
+
transform: shown ? "translateY(0) scale(1)" : "translateY(6px) scale(0.985)",
|
|
209
|
+
transition: "opacity 180ms ease-out, transform 180ms ease-out",
|
|
210
|
+
},
|
|
211
|
+
props.style || {},
|
|
212
|
+
);
|
|
213
|
+
return h("div", { style: style }, props.children);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** 主题化浮层:优先官方 Modal,缺失时自绘(至少跟随深浅色)。 */
|
|
217
|
+
function Dialog(/** @type {any} */ props) {
|
|
218
|
+
React.useEffect(() => {
|
|
219
|
+
const onKey = (/** @type {any} */ event) => {
|
|
220
|
+
if (event.key !== "Escape") return;
|
|
221
|
+
event.preventDefault();
|
|
222
|
+
props.onClose?.();
|
|
223
|
+
};
|
|
224
|
+
window.addEventListener("keydown", onKey);
|
|
225
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
226
|
+
}, []);
|
|
227
|
+
if (typeof Modal === "function") {
|
|
228
|
+
return h(
|
|
229
|
+
Modal,
|
|
230
|
+
{
|
|
231
|
+
open: true,
|
|
232
|
+
onClose: props.onClose,
|
|
233
|
+
closeLabel: props.closeLabel,
|
|
234
|
+
title: props.title,
|
|
235
|
+
description: props.description,
|
|
236
|
+
footer: props.footer,
|
|
237
|
+
},
|
|
238
|
+
h(Reveal, null, props.children),
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
return h(
|
|
242
|
+
"div",
|
|
243
|
+
{
|
|
244
|
+
style: {
|
|
245
|
+
position: "fixed",
|
|
246
|
+
inset: 0,
|
|
247
|
+
zIndex: 2147000000,
|
|
248
|
+
background: T.mask,
|
|
249
|
+
display: "flex",
|
|
250
|
+
alignItems: "center",
|
|
251
|
+
justifyContent: "center",
|
|
252
|
+
},
|
|
253
|
+
onClick: props.onClose,
|
|
254
|
+
},
|
|
255
|
+
h(
|
|
256
|
+
Reveal,
|
|
257
|
+
{ style: { width: "min(600px, 92vw)" } },
|
|
258
|
+
h(
|
|
259
|
+
"div",
|
|
260
|
+
{
|
|
261
|
+
style: {
|
|
262
|
+
width: "100%",
|
|
263
|
+
maxHeight: "82vh",
|
|
264
|
+
overflow: "auto",
|
|
265
|
+
background: T.bg,
|
|
266
|
+
color: T.text,
|
|
267
|
+
border: "1px solid " + T.border,
|
|
268
|
+
borderRadius: T.radius,
|
|
269
|
+
padding: "18px 20px",
|
|
270
|
+
fontSize: "13px",
|
|
271
|
+
lineHeight: 1.6,
|
|
272
|
+
boxShadow: "0 16px 48px rgba(0,0,0,0.35)",
|
|
273
|
+
},
|
|
274
|
+
onClick: (/** @type {any} */ event) => {
|
|
275
|
+
event.stopPropagation();
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
props.title
|
|
279
|
+
? h(
|
|
280
|
+
"div",
|
|
281
|
+
{ style: { fontSize: "15px", fontWeight: 600, marginBottom: "6px" } },
|
|
282
|
+
props.title,
|
|
283
|
+
)
|
|
284
|
+
: null,
|
|
285
|
+
props.description
|
|
286
|
+
? h("div", { style: { color: T.dim, marginBottom: "12px" } }, props.description)
|
|
287
|
+
: null,
|
|
288
|
+
props.children,
|
|
289
|
+
props.footer
|
|
290
|
+
? h(
|
|
291
|
+
"div",
|
|
292
|
+
{
|
|
293
|
+
style: {
|
|
294
|
+
display: "flex",
|
|
295
|
+
justifyContent: "flex-end",
|
|
296
|
+
gap: "8px",
|
|
297
|
+
marginTop: "16px",
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
props.footer,
|
|
301
|
+
)
|
|
302
|
+
: null,
|
|
303
|
+
),
|
|
304
|
+
),
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function formatBytes(/** @type {any} */ bytes) {
|
|
309
|
+
if (typeof bytes !== "number" || bytes < 0) return "?";
|
|
310
|
+
if (bytes < 1024) return Math.round(bytes) + " B";
|
|
311
|
+
var units = ["KB", "MB", "GB", "TB"];
|
|
312
|
+
var value = bytes / 1024;
|
|
313
|
+
var unit = 0;
|
|
314
|
+
while (value >= 1024 && unit < units.length - 1) {
|
|
315
|
+
value = value / 1024;
|
|
316
|
+
unit += 1;
|
|
317
|
+
}
|
|
318
|
+
return (value >= 10 ? value.toFixed(0) : value.toFixed(1)) + " " + units[unit];
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function formatTime(/** @type {any} */ value) {
|
|
322
|
+
if (typeof value !== "string") return "";
|
|
323
|
+
const date = new Date(value);
|
|
324
|
+
if (Number.isNaN(date.getTime())) return value;
|
|
325
|
+
return date.toLocaleString(undefined, {
|
|
326
|
+
year: "numeric",
|
|
327
|
+
month: "2-digit",
|
|
328
|
+
day: "2-digit",
|
|
329
|
+
hour: "2-digit",
|
|
330
|
+
minute: "2-digit",
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function errorText(/** @type {any} */ error) {
|
|
335
|
+
if (!error) return "unknown error";
|
|
336
|
+
if (typeof error === "string") return error;
|
|
337
|
+
if (error.message) return String(error.message);
|
|
338
|
+
return String(error);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function DeleteSessionMenuItem(/** @type {any} */ props) {
|
|
342
|
+
var menuState =
|
|
343
|
+
typeof props.useMenuOpenState === "function" ? props.useMenuOpenState() : [false, () => {}];
|
|
344
|
+
var closeMenu = menuState[1];
|
|
345
|
+
var onSelect = () => {
|
|
346
|
+
closeMenu(false);
|
|
347
|
+
props.requestDelete({ sessionId: props.sessionId, title: props.displayTitle || null });
|
|
348
|
+
};
|
|
349
|
+
if (typeof MenuItemButton === "function") {
|
|
350
|
+
return h(
|
|
351
|
+
MenuItemButton,
|
|
352
|
+
{
|
|
353
|
+
icon: typeof IconTrash === "function" ? h(IconTrash, { size: 14 }) : undefined,
|
|
354
|
+
danger: true,
|
|
355
|
+
separatorBefore: true,
|
|
356
|
+
onSelect: onSelect,
|
|
357
|
+
},
|
|
358
|
+
props.t("menu.delete"),
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
return h(
|
|
362
|
+
"button",
|
|
363
|
+
{
|
|
364
|
+
type: "button",
|
|
365
|
+
onClick: onSelect,
|
|
366
|
+
style: {
|
|
367
|
+
display: "block",
|
|
368
|
+
width: "100%",
|
|
369
|
+
textAlign: "left",
|
|
370
|
+
padding: "6px 12px",
|
|
371
|
+
border: "none",
|
|
372
|
+
borderRadius: "6px",
|
|
373
|
+
background: "transparent",
|
|
374
|
+
color: T.danger,
|
|
375
|
+
cursor: "pointer",
|
|
376
|
+
fontSize: "13px",
|
|
377
|
+
transition: "background-color .15s ease",
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
props.t("menu.delete"),
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** 侧栏底部的固定入口(slot: sidebar.footer.action,list,props 带 wide)。 */
|
|
385
|
+
function TrashFooterButton(/** @type {any} */ props) {
|
|
386
|
+
var panelState = useStore(props.panelStore);
|
|
387
|
+
var tickState = useStore(props.tickStore);
|
|
388
|
+
var countState = React.useState(null);
|
|
389
|
+
var count = countState[0];
|
|
390
|
+
var setCount = countState[1];
|
|
391
|
+
const fetchCount = () => {
|
|
392
|
+
props
|
|
393
|
+
.call("list")
|
|
394
|
+
.then((/** @type {any} */ value) => {
|
|
395
|
+
setCount(value && value.entries ? value.entries.length : 0);
|
|
396
|
+
})
|
|
397
|
+
.catch(() => setCount(null));
|
|
398
|
+
};
|
|
399
|
+
React.useEffect(() => {
|
|
400
|
+
fetchCount();
|
|
401
|
+
}, [panelState[0], tickState[0]]);
|
|
402
|
+
React.useEffect(() => {
|
|
403
|
+
const onVisible = () => {
|
|
404
|
+
if (document.visibilityState === "visible") fetchCount();
|
|
405
|
+
};
|
|
406
|
+
document.addEventListener("visibilitychange", onVisible);
|
|
407
|
+
return () => document.removeEventListener("visibilitychange", onVisible);
|
|
408
|
+
}, []);
|
|
409
|
+
|
|
410
|
+
var label =
|
|
411
|
+
props.t("footer.trash") +
|
|
412
|
+
(typeof count === "number" && count > 0 ? " (" + count + ")" : "");
|
|
413
|
+
return h(
|
|
414
|
+
"button",
|
|
415
|
+
{
|
|
416
|
+
type: "button",
|
|
417
|
+
title: label,
|
|
418
|
+
"aria-label": label,
|
|
419
|
+
onClick: () => props.openPanel(),
|
|
420
|
+
className: "dsh-sdel-footer",
|
|
421
|
+
style: {
|
|
422
|
+
display: "flex",
|
|
423
|
+
alignItems: "center",
|
|
424
|
+
gap: "6px",
|
|
425
|
+
width: props.wide ? "100%" : "32px",
|
|
426
|
+
height: "32px",
|
|
427
|
+
justifyContent: props.wide ? "flex-start" : "center",
|
|
428
|
+
padding: props.wide ? "0 8px" : 0,
|
|
429
|
+
cursor: "pointer",
|
|
430
|
+
fontSize: "12px",
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
typeof IconTrash === "function" ? h(IconTrash, { size: 16 }) : h("span", null, "Trash"),
|
|
434
|
+
props.wide ? h("span", null, props.t("footer.trash")) : null,
|
|
435
|
+
typeof count === "number" && count > 0
|
|
436
|
+
? h(
|
|
437
|
+
"span",
|
|
438
|
+
{
|
|
439
|
+
style: {
|
|
440
|
+
marginLeft: props.wide ? "auto" : 0,
|
|
441
|
+
minWidth: "16px",
|
|
442
|
+
padding: "0 4px",
|
|
443
|
+
borderRadius: "8px",
|
|
444
|
+
background: T.danger,
|
|
445
|
+
color: "#fff",
|
|
446
|
+
fontSize: "10px",
|
|
447
|
+
lineHeight: "16px",
|
|
448
|
+
textAlign: "center",
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
String(count),
|
|
452
|
+
)
|
|
453
|
+
: null,
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function DeleteConfirm(/** @type {any} */ props) {
|
|
458
|
+
var requestState = useStore(props.requestStore);
|
|
459
|
+
var request = requestState[0];
|
|
460
|
+
var planState = React.useState(null);
|
|
461
|
+
var plan = planState[0];
|
|
462
|
+
var setPlan = planState[1];
|
|
463
|
+
var errorState = React.useState(null);
|
|
464
|
+
var error = errorState[0];
|
|
465
|
+
var setError = errorState[1];
|
|
466
|
+
var busyState = React.useState(false);
|
|
467
|
+
var busy = busyState[0];
|
|
468
|
+
var setBusy = busyState[1];
|
|
469
|
+
var requestId = request ? request.sessionId : null;
|
|
470
|
+
|
|
471
|
+
React.useEffect(() => {
|
|
472
|
+
if (!requestId) {
|
|
473
|
+
setPlan(null);
|
|
474
|
+
setError(null);
|
|
475
|
+
setBusy(false);
|
|
476
|
+
return undefined;
|
|
477
|
+
}
|
|
478
|
+
var alive = true;
|
|
479
|
+
setPlan(null);
|
|
480
|
+
setError(null);
|
|
481
|
+
props
|
|
482
|
+
.call("plan", { sessionId: requestId })
|
|
483
|
+
.then((/** @type {any} */ value) => {
|
|
484
|
+
if (alive) setPlan(value);
|
|
485
|
+
})
|
|
486
|
+
.catch((/** @type {any} */ reason) => {
|
|
487
|
+
if (alive) setError(errorText(reason));
|
|
488
|
+
});
|
|
489
|
+
return () => {
|
|
490
|
+
alive = false;
|
|
491
|
+
};
|
|
492
|
+
}, [requestId]);
|
|
493
|
+
|
|
494
|
+
if (!request) return null;
|
|
495
|
+
|
|
496
|
+
var close = () => {
|
|
497
|
+
if (busy) return;
|
|
498
|
+
props.requestStore.set(null);
|
|
499
|
+
};
|
|
500
|
+
var confirm = () => {
|
|
501
|
+
if (!plan || busy) return;
|
|
502
|
+
setBusy(true);
|
|
503
|
+
props
|
|
504
|
+
.call("trash", {
|
|
505
|
+
sessionId: request.sessionId,
|
|
506
|
+
digest: plan.digest,
|
|
507
|
+
title: request.title || null,
|
|
508
|
+
})
|
|
509
|
+
.then((/** @type {any} */ result) => {
|
|
510
|
+
props.requestStore.set(null);
|
|
511
|
+
props.onTrashed(result);
|
|
512
|
+
})
|
|
513
|
+
.catch((/** @type {any} */ reason) => {
|
|
514
|
+
setBusy(false);
|
|
515
|
+
setError(errorText(reason));
|
|
516
|
+
});
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
var lines = [];
|
|
520
|
+
if (plan) {
|
|
521
|
+
if (typeof plan.sizeBytes === "number")
|
|
522
|
+
lines.push(props.t("confirm.size", { size: formatBytes(plan.sizeBytes) }));
|
|
523
|
+
if (plan.live) lines.push(props.t("confirm.live"));
|
|
524
|
+
if (plan.children && plan.children.length > 0)
|
|
525
|
+
lines.push(props.t("confirm.children", { n: plan.children.length }));
|
|
526
|
+
if (plan.removes && plan.removes.length > 0) {
|
|
527
|
+
lines.push(
|
|
528
|
+
props.t("confirm.refs", {
|
|
529
|
+
list: plan.removes.map((/** @type {any} */ item) => item.label).join(" · "),
|
|
530
|
+
}),
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
if (plan.blockers && plan.blockers.length > 0)
|
|
534
|
+
lines.push(props.t("confirm.blocked", { reason: plan.blockers[0].message }));
|
|
535
|
+
}
|
|
536
|
+
var blocked = !!(plan && plan.blockers && plan.blockers.length > 0);
|
|
537
|
+
|
|
538
|
+
var body = h(
|
|
539
|
+
React.Fragment,
|
|
540
|
+
null,
|
|
541
|
+
request.title
|
|
542
|
+
? h("div", { style: { fontWeight: 600, marginBottom: "10px" } }, request.title)
|
|
543
|
+
: null,
|
|
544
|
+
lines.map((/** @type {any} */ line, /** @type {any} */ index) =>
|
|
545
|
+
h("div", { key: "line-" + index, style: { marginBottom: "4px" } }, line),
|
|
546
|
+
),
|
|
547
|
+
!plan && !error ? h("div", { style: { color: T.dim } }, props.t("confirm.loading")) : null,
|
|
548
|
+
error ? h("div", { style: { color: T.danger, marginTop: "8px" } }, error) : null,
|
|
549
|
+
);
|
|
550
|
+
|
|
551
|
+
return h(
|
|
552
|
+
Dialog,
|
|
553
|
+
{
|
|
554
|
+
onClose: close,
|
|
555
|
+
closeLabel: props.t("confirm.cancel"),
|
|
556
|
+
title: props.t("confirm.title"),
|
|
557
|
+
description: props.t("confirm.desc"),
|
|
558
|
+
footer: h(
|
|
559
|
+
React.Fragment,
|
|
560
|
+
null,
|
|
561
|
+
h(Btn, { autoFocus: true, onClick: close, disabled: busy }, props.t("confirm.cancel")),
|
|
562
|
+
h(
|
|
563
|
+
Btn,
|
|
564
|
+
{ onClick: confirm, danger: true, disabled: busy || blocked || !plan },
|
|
565
|
+
busy ? props.t("confirm.pending") : props.t("confirm.confirm"),
|
|
566
|
+
),
|
|
567
|
+
),
|
|
568
|
+
},
|
|
569
|
+
body,
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function TrashPanel(/** @type {any} */ props) {
|
|
574
|
+
var panelState = useStore(props.panelStore);
|
|
575
|
+
var open = panelState[0];
|
|
576
|
+
var tabState = React.useState("trash");
|
|
577
|
+
var tab = tabState[0];
|
|
578
|
+
var setTab = tabState[1];
|
|
579
|
+
var dataState = React.useState(null);
|
|
580
|
+
var data = dataState[0];
|
|
581
|
+
var setData = dataState[1];
|
|
582
|
+
var auditState = React.useState(null);
|
|
583
|
+
var audit = auditState[0];
|
|
584
|
+
var setAudit = auditState[1];
|
|
585
|
+
var healthState = React.useState(null);
|
|
586
|
+
var health = healthState[0];
|
|
587
|
+
var setHealth = healthState[1];
|
|
588
|
+
var errorState = React.useState(null);
|
|
589
|
+
var error = errorState[0];
|
|
590
|
+
var setError = errorState[1];
|
|
591
|
+
var busyState = React.useState(null);
|
|
592
|
+
var busyId = busyState[0];
|
|
593
|
+
var setBusyId = busyState[1];
|
|
594
|
+
var purgeState = React.useState(null);
|
|
595
|
+
var confirmPurge = purgeState[0];
|
|
596
|
+
var setConfirmPurge = purgeState[1];
|
|
597
|
+
var scanState = React.useState(null);
|
|
598
|
+
var scan = scanState[0];
|
|
599
|
+
var setScan = scanState[1];
|
|
600
|
+
var scanErrorState = React.useState(null);
|
|
601
|
+
var scanError = scanErrorState[0];
|
|
602
|
+
var setScanError = scanErrorState[1];
|
|
603
|
+
var cleanState = React.useState(false);
|
|
604
|
+
var cleaning = cleanState[0];
|
|
605
|
+
var setCleaning = cleanState[1];
|
|
606
|
+
var cleanMsgState = React.useState("");
|
|
607
|
+
var cleanMsg = cleanMsgState[0];
|
|
608
|
+
var setCleanMsg = cleanMsgState[1];
|
|
609
|
+
var receiptsState = React.useState(null);
|
|
610
|
+
var receipts = receiptsState[0];
|
|
611
|
+
var setReceipts = receiptsState[1];
|
|
612
|
+
|
|
613
|
+
const loadReceipts = React.useCallback(() => {
|
|
614
|
+
props
|
|
615
|
+
.call("receipts", { limit: 50 })
|
|
616
|
+
.then((/** @type {any} */ value) => {
|
|
617
|
+
setReceipts(value && value.entries ? value.entries : []);
|
|
618
|
+
})
|
|
619
|
+
.catch(() => setReceipts([]));
|
|
620
|
+
}, []);
|
|
621
|
+
|
|
622
|
+
const loadHealth = React.useCallback(() => {
|
|
623
|
+
setScan(null);
|
|
624
|
+
setScanError(null);
|
|
625
|
+
props
|
|
626
|
+
.call("healthScan")
|
|
627
|
+
.then((/** @type {any} */ value) => {
|
|
628
|
+
setScan(value);
|
|
629
|
+
})
|
|
630
|
+
.catch((/** @type {any} */ reason) => {
|
|
631
|
+
setScanError(errorText(reason));
|
|
632
|
+
});
|
|
633
|
+
}, []);
|
|
634
|
+
|
|
635
|
+
const loadAudit = React.useCallback(() => {
|
|
636
|
+
props
|
|
637
|
+
.call("audit", { limit: 100 })
|
|
638
|
+
.then((/** @type {any} */ value) => {
|
|
639
|
+
setAudit(value && value.entries ? value.entries : []);
|
|
640
|
+
})
|
|
641
|
+
.catch(() => {});
|
|
642
|
+
}, []);
|
|
643
|
+
|
|
644
|
+
var refresh = React.useCallback(() => {
|
|
645
|
+
props
|
|
646
|
+
.call("list")
|
|
647
|
+
.then((/** @type {any} */ value) => {
|
|
648
|
+
setData(value);
|
|
649
|
+
})
|
|
650
|
+
.catch((/** @type {any} */ reason) => {
|
|
651
|
+
setError(errorText(reason));
|
|
652
|
+
});
|
|
653
|
+
}, []);
|
|
654
|
+
|
|
655
|
+
React.useEffect(() => {
|
|
656
|
+
if (!open) return undefined;
|
|
657
|
+
refresh();
|
|
658
|
+
props
|
|
659
|
+
.call("health")
|
|
660
|
+
.then((/** @type {any} */ value) => {
|
|
661
|
+
setHealth(value);
|
|
662
|
+
})
|
|
663
|
+
.catch(() => {});
|
|
664
|
+
loadAudit();
|
|
665
|
+
// 面板打开期间自动同步,不需要手动刷新按钮。
|
|
666
|
+
const timer = setInterval(() => {
|
|
667
|
+
if (document.visibilityState === "visible") refresh();
|
|
668
|
+
}, 5000);
|
|
669
|
+
const onVisible = () => {
|
|
670
|
+
if (document.visibilityState === "visible") refresh();
|
|
671
|
+
};
|
|
672
|
+
document.addEventListener("visibilitychange", onVisible);
|
|
673
|
+
return () => {
|
|
674
|
+
clearInterval(timer);
|
|
675
|
+
document.removeEventListener("visibilitychange", onVisible);
|
|
676
|
+
};
|
|
677
|
+
}, [open]);
|
|
678
|
+
|
|
679
|
+
const listRef = React.useRef(null);
|
|
680
|
+
const onListKeyDown = (/** @type {any} */ event) => {
|
|
681
|
+
if (event.key === "Escape") {
|
|
682
|
+
event.preventDefault();
|
|
683
|
+
props.panelStore.set(false);
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
const keys = ["ArrowDown", "ArrowUp", "Home", "End"];
|
|
687
|
+
if (!keys.includes(event.key)) return;
|
|
688
|
+
const root = listRef.current;
|
|
689
|
+
if (!root) return;
|
|
690
|
+
const items = [...root.querySelectorAll("button:not([disabled])")];
|
|
691
|
+
if (items.length === 0) return;
|
|
692
|
+
const current = items.indexOf(document.activeElement);
|
|
693
|
+
let next = 0;
|
|
694
|
+
if (event.key === "Home") next = 0;
|
|
695
|
+
else if (event.key === "End") next = items.length - 1;
|
|
696
|
+
else if (event.key === "ArrowDown")
|
|
697
|
+
next = current < 0 ? 0 : Math.min(items.length - 1, current + 1);
|
|
698
|
+
else next = current <= 0 ? 0 : current - 1;
|
|
699
|
+
event.preventDefault();
|
|
700
|
+
items[next].focus();
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
if (!open) return null;
|
|
704
|
+
|
|
705
|
+
var doRestore = (/** @type {any} */ entryId, /** @type {any} */ sessionId) => {
|
|
706
|
+
setBusyId(entryId);
|
|
707
|
+
props
|
|
708
|
+
.call("restore", { entryId: entryId })
|
|
709
|
+
.then(() => {
|
|
710
|
+
setBusyId(null);
|
|
711
|
+
refresh();
|
|
712
|
+
props.bump?.();
|
|
713
|
+
props.onRestored?.(sessionId);
|
|
714
|
+
})
|
|
715
|
+
.catch((/** @type {any} */ reason) => {
|
|
716
|
+
setBusyId(null);
|
|
717
|
+
setError(errorText(reason));
|
|
718
|
+
});
|
|
719
|
+
};
|
|
720
|
+
var doPurge = (/** @type {any} */ entryId, /** @type {any} */ sessionId) => {
|
|
721
|
+
setBusyId(entryId);
|
|
722
|
+
props
|
|
723
|
+
.call("purge", { entryId: entryId })
|
|
724
|
+
.then(() => {
|
|
725
|
+
setBusyId(null);
|
|
726
|
+
setConfirmPurge(null);
|
|
727
|
+
refresh();
|
|
728
|
+
props.bump?.();
|
|
729
|
+
props.onPurged?.(sessionId);
|
|
730
|
+
})
|
|
731
|
+
.catch((/** @type {any} */ reason) => {
|
|
732
|
+
setBusyId(null);
|
|
733
|
+
setError(errorText(reason));
|
|
734
|
+
});
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
var entries = (data && data.entries) || [];
|
|
738
|
+
var readOnly = !!(health && health.readOnly);
|
|
739
|
+
var rowStyle = { borderTop: "1px solid " + T.border, padding: "10px 0" };
|
|
740
|
+
|
|
741
|
+
var content = [];
|
|
742
|
+
if (readOnly)
|
|
743
|
+
content.push(
|
|
744
|
+
h(
|
|
745
|
+
"div",
|
|
746
|
+
{ key: "ro", style: { color: T.danger, marginBottom: "10px" } },
|
|
747
|
+
props.t("panel.readOnly"),
|
|
748
|
+
),
|
|
749
|
+
);
|
|
750
|
+
if (error)
|
|
751
|
+
content.push(
|
|
752
|
+
h("div", { key: "err", style: { color: T.danger, marginBottom: "10px" } }, error),
|
|
753
|
+
);
|
|
754
|
+
content.push(
|
|
755
|
+
h(
|
|
756
|
+
"div",
|
|
757
|
+
{ key: "tabs", style: { display: "flex", gap: "8px", marginBottom: "12px" } },
|
|
758
|
+
h(
|
|
759
|
+
Btn,
|
|
760
|
+
{
|
|
761
|
+
onClick: () => {
|
|
762
|
+
setTab("trash");
|
|
763
|
+
},
|
|
764
|
+
},
|
|
765
|
+
props.t("panel.tabTrash") + (entries.length ? " (" + entries.length + ")" : ""),
|
|
766
|
+
),
|
|
767
|
+
h(
|
|
768
|
+
Btn,
|
|
769
|
+
{
|
|
770
|
+
onClick: () => {
|
|
771
|
+
setTab("audit");
|
|
772
|
+
loadAudit();
|
|
773
|
+
},
|
|
774
|
+
},
|
|
775
|
+
props.t("panel.tabAudit"),
|
|
776
|
+
),
|
|
777
|
+
h(
|
|
778
|
+
Btn,
|
|
779
|
+
{
|
|
780
|
+
onClick: () => {
|
|
781
|
+
setTab("health");
|
|
782
|
+
loadHealth();
|
|
783
|
+
},
|
|
784
|
+
},
|
|
785
|
+
props.t("panel.tabHealth"),
|
|
786
|
+
),
|
|
787
|
+
h(
|
|
788
|
+
Btn,
|
|
789
|
+
{
|
|
790
|
+
onClick: () => {
|
|
791
|
+
setTab("receipts");
|
|
792
|
+
loadReceipts();
|
|
793
|
+
},
|
|
794
|
+
},
|
|
795
|
+
props.t("panel.tabReceipts"),
|
|
796
|
+
),
|
|
797
|
+
),
|
|
798
|
+
);
|
|
799
|
+
|
|
800
|
+
if (tab === "receipts") {
|
|
801
|
+
if (!receipts || receipts.length === 0) {
|
|
802
|
+
content.push(
|
|
803
|
+
h(
|
|
804
|
+
"div",
|
|
805
|
+
{ key: "receipts-empty", style: { color: T.dim, padding: "8px 0" } },
|
|
806
|
+
props.t("receipts.empty"),
|
|
807
|
+
),
|
|
808
|
+
);
|
|
809
|
+
} else {
|
|
810
|
+
receipts.forEach((/** @type {any} */ receipt, /** @type {any} */ index) => {
|
|
811
|
+
const removed = receipt.removed || [];
|
|
812
|
+
const okCount = removed.filter(
|
|
813
|
+
(/** @type {any} */ item) => item.status === "ok",
|
|
814
|
+
).length;
|
|
815
|
+
const detail =
|
|
816
|
+
receipt.action === "trash"
|
|
817
|
+
? formatBytes(receipt.sizeBytes || 0) + " · " + okCount + "/" + removed.length
|
|
818
|
+
: receipt.action === "restore"
|
|
819
|
+
? props.t("receipts.restored")
|
|
820
|
+
: receipt.action === "purge"
|
|
821
|
+
? formatBytes(receipt.bytes || 0)
|
|
822
|
+
: String(receipt.total || 0);
|
|
823
|
+
content.push(
|
|
824
|
+
h(
|
|
825
|
+
"div",
|
|
826
|
+
{
|
|
827
|
+
key: "receipt-" + index,
|
|
828
|
+
title: String(receipt.sessionId || ""),
|
|
829
|
+
style: {
|
|
830
|
+
borderTop: "1px solid " + T.border,
|
|
831
|
+
padding: "7px 0",
|
|
832
|
+
fontSize: "12px",
|
|
833
|
+
display: "flex",
|
|
834
|
+
alignItems: "baseline",
|
|
835
|
+
gap: "6px",
|
|
836
|
+
},
|
|
837
|
+
},
|
|
838
|
+
h(
|
|
839
|
+
"span",
|
|
840
|
+
{ style: { color: T.faint, whiteSpace: "nowrap" } },
|
|
841
|
+
formatTime(receipt.at),
|
|
842
|
+
),
|
|
843
|
+
h(
|
|
844
|
+
"span",
|
|
845
|
+
{ style: { fontWeight: 600, whiteSpace: "nowrap" } },
|
|
846
|
+
String(receipt.action || ""),
|
|
847
|
+
),
|
|
848
|
+
h(
|
|
849
|
+
"span",
|
|
850
|
+
{
|
|
851
|
+
style: {
|
|
852
|
+
flex: 1,
|
|
853
|
+
minWidth: 0,
|
|
854
|
+
color: T.dim,
|
|
855
|
+
overflow: "hidden",
|
|
856
|
+
textOverflow: "ellipsis",
|
|
857
|
+
whiteSpace: "nowrap",
|
|
858
|
+
},
|
|
859
|
+
},
|
|
860
|
+
String(receipt.title || receipt.sessionId || "—"),
|
|
861
|
+
),
|
|
862
|
+
h("span", { style: { color: T.faint, whiteSpace: "nowrap" } }, detail),
|
|
863
|
+
),
|
|
864
|
+
);
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
} else if (tab === "health") {
|
|
868
|
+
if (scanError) {
|
|
869
|
+
content.push(
|
|
870
|
+
h("div", { key: "scan-err", style: { color: T.danger, padding: "8px 0" } }, scanError),
|
|
871
|
+
);
|
|
872
|
+
} else if (!scan) {
|
|
873
|
+
content.push(
|
|
874
|
+
h(
|
|
875
|
+
"div",
|
|
876
|
+
{ key: "scan-loading", style: { color: T.dim, padding: "8px 0" } },
|
|
877
|
+
props.t("health.loading"),
|
|
878
|
+
),
|
|
879
|
+
);
|
|
880
|
+
} else if (!scan.ok) {
|
|
881
|
+
content.push(
|
|
882
|
+
h(
|
|
883
|
+
"div",
|
|
884
|
+
{ key: "scan-na", style: { color: T.dim, padding: "8px 0" } },
|
|
885
|
+
props.t("health.unavailable", { reason: scan.reason || "" }),
|
|
886
|
+
),
|
|
887
|
+
);
|
|
888
|
+
} else {
|
|
889
|
+
content.push(
|
|
890
|
+
h(
|
|
891
|
+
"div",
|
|
892
|
+
{ key: "scan-inventory", style: { color: T.dim, fontSize: "12px" } },
|
|
893
|
+
props.t("health.inventory", scan.inventory || {}),
|
|
894
|
+
),
|
|
895
|
+
);
|
|
896
|
+
if (scan.findings.length === 0) {
|
|
897
|
+
content.push(
|
|
898
|
+
h("div", { key: "scan-ok", style: { padding: "8px 0" } }, props.t("health.ok")),
|
|
899
|
+
);
|
|
900
|
+
}
|
|
901
|
+
scan.findings.forEach((/** @type {any} */ finding, /** @type {any} */ index) => {
|
|
902
|
+
content.push(
|
|
903
|
+
h(
|
|
904
|
+
"div",
|
|
905
|
+
{
|
|
906
|
+
key: "finding-" + index,
|
|
907
|
+
style: {
|
|
908
|
+
borderTop: "1px solid " + T.border,
|
|
909
|
+
padding: "8px 0",
|
|
910
|
+
color: finding.severity === "warn" ? T.text : T.dim,
|
|
911
|
+
},
|
|
912
|
+
},
|
|
913
|
+
h(
|
|
914
|
+
"div",
|
|
915
|
+
{ style: { fontWeight: 600 } },
|
|
916
|
+
finding.label + " · " + props.t("health.items", { n: finding.items.length }),
|
|
917
|
+
),
|
|
918
|
+
h(
|
|
919
|
+
"div",
|
|
920
|
+
{ style: { color: T.faint, fontSize: "12px", wordBreak: "break-all" } },
|
|
921
|
+
finding.items
|
|
922
|
+
.slice(0, 6)
|
|
923
|
+
.map((/** @type {any} */ item) =>
|
|
924
|
+
typeof item === "string" ? item : JSON.stringify(item),
|
|
925
|
+
)
|
|
926
|
+
.join(" · "),
|
|
927
|
+
),
|
|
928
|
+
),
|
|
929
|
+
);
|
|
930
|
+
});
|
|
931
|
+
if (scan.cleanable && scan.cleanable.total > 0) {
|
|
932
|
+
content.push(
|
|
933
|
+
h(
|
|
934
|
+
"div",
|
|
935
|
+
{
|
|
936
|
+
key: "scan-clean",
|
|
937
|
+
style: { marginTop: "10px", display: "flex", gap: "8px", alignItems: "center" },
|
|
938
|
+
},
|
|
939
|
+
confirmPurge === "__health__"
|
|
940
|
+
? h(
|
|
941
|
+
Btn,
|
|
942
|
+
{
|
|
943
|
+
danger: true,
|
|
944
|
+
disabled: cleaning,
|
|
945
|
+
onClick: () => {
|
|
946
|
+
setCleaning(true);
|
|
947
|
+
setCleanMsg("");
|
|
948
|
+
props
|
|
949
|
+
.call("cleanHealth", { classes: ["archived", "pinned", "workspace"] })
|
|
950
|
+
.then((/** @type {any} */ result) => {
|
|
951
|
+
setCleaning(false);
|
|
952
|
+
setConfirmPurge(null);
|
|
953
|
+
setCleanMsg(props.t("health.cleanDone", { n: result.total }));
|
|
954
|
+
loadHealth();
|
|
955
|
+
props.bump?.();
|
|
956
|
+
})
|
|
957
|
+
.catch((/** @type {any} */ reason) => {
|
|
958
|
+
setCleaning(false);
|
|
959
|
+
setCleanMsg(errorText(reason));
|
|
960
|
+
});
|
|
961
|
+
},
|
|
962
|
+
},
|
|
963
|
+
props.t("health.cleanConfirm", { n: scan.cleanable.total }),
|
|
964
|
+
)
|
|
965
|
+
: h(
|
|
966
|
+
Btn,
|
|
967
|
+
{ onClick: () => setConfirmPurge("__health__") },
|
|
968
|
+
props.t("health.clean", { n: scan.cleanable.total }),
|
|
969
|
+
),
|
|
970
|
+
),
|
|
971
|
+
);
|
|
972
|
+
}
|
|
973
|
+
if (cleanMsg) {
|
|
974
|
+
content.push(
|
|
975
|
+
h(
|
|
976
|
+
"div",
|
|
977
|
+
{ key: "scan-msg", style: { color: T.dim, marginTop: "8px", fontSize: "12px" } },
|
|
978
|
+
cleanMsg,
|
|
979
|
+
),
|
|
980
|
+
);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
} else if (tab === "trash") {
|
|
984
|
+
if (entries.length === 0) {
|
|
985
|
+
content.push(
|
|
986
|
+
h(
|
|
987
|
+
"div",
|
|
988
|
+
{ key: "empty", style: { color: T.dim, padding: "12px 0" } },
|
|
989
|
+
props.t("panel.empty"),
|
|
990
|
+
),
|
|
991
|
+
);
|
|
992
|
+
} else {
|
|
993
|
+
entries.forEach((/** @type {any} */ entry) => {
|
|
994
|
+
content.push(
|
|
995
|
+
h(
|
|
996
|
+
"div",
|
|
997
|
+
{ key: entry.entryId, style: rowStyle },
|
|
998
|
+
h("div", { style: { fontWeight: 600 } }, entry.title || entry.sessionId),
|
|
999
|
+
h(
|
|
1000
|
+
"div",
|
|
1001
|
+
{ style: { color: T.dim, fontSize: "12px" } },
|
|
1002
|
+
props.t("panel.size", { size: formatBytes(entry.bytes) }) +
|
|
1003
|
+
" · " +
|
|
1004
|
+
props.t("panel.trashedAt", { time: formatTime(entry.trashedAt) }),
|
|
1005
|
+
),
|
|
1006
|
+
h(
|
|
1007
|
+
"div",
|
|
1008
|
+
{ style: { display: "flex", gap: "8px", marginTop: "6px" } },
|
|
1009
|
+
h(
|
|
1010
|
+
Btn,
|
|
1011
|
+
{
|
|
1012
|
+
onClick: () => {
|
|
1013
|
+
doRestore(entry.entryId, entry.sessionId);
|
|
1014
|
+
},
|
|
1015
|
+
disabled: busyId === entry.entryId,
|
|
1016
|
+
},
|
|
1017
|
+
props.t("panel.restore"),
|
|
1018
|
+
),
|
|
1019
|
+
confirmPurge === entry.entryId
|
|
1020
|
+
? h(
|
|
1021
|
+
Btn,
|
|
1022
|
+
{
|
|
1023
|
+
onClick: () => {
|
|
1024
|
+
doPurge(entry.entryId, entry.sessionId);
|
|
1025
|
+
},
|
|
1026
|
+
danger: true,
|
|
1027
|
+
disabled: busyId === entry.entryId,
|
|
1028
|
+
},
|
|
1029
|
+
props.t("panel.purgeConfirm"),
|
|
1030
|
+
)
|
|
1031
|
+
: h(
|
|
1032
|
+
Btn,
|
|
1033
|
+
{
|
|
1034
|
+
onClick: () => {
|
|
1035
|
+
setConfirmPurge(entry.entryId);
|
|
1036
|
+
},
|
|
1037
|
+
danger: true,
|
|
1038
|
+
},
|
|
1039
|
+
props.t("panel.purge"),
|
|
1040
|
+
),
|
|
1041
|
+
),
|
|
1042
|
+
),
|
|
1043
|
+
);
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
} else if ((audit || []).length === 0) {
|
|
1047
|
+
content.push(
|
|
1048
|
+
h(
|
|
1049
|
+
"div",
|
|
1050
|
+
{ key: "ae", style: { color: T.dim, padding: "12px 0" } },
|
|
1051
|
+
props.t("panel.auditEmpty"),
|
|
1052
|
+
),
|
|
1053
|
+
);
|
|
1054
|
+
} else {
|
|
1055
|
+
(audit || [])
|
|
1056
|
+
.slice()
|
|
1057
|
+
.reverse()
|
|
1058
|
+
.forEach((/** @type {any} */ entry, /** @type {any} */ index) => {
|
|
1059
|
+
content.push(
|
|
1060
|
+
h(
|
|
1061
|
+
"div",
|
|
1062
|
+
{
|
|
1063
|
+
key: "audit-" + index,
|
|
1064
|
+
style: { borderTop: "1px solid " + T.border, padding: "6px 0", fontSize: "12px" },
|
|
1065
|
+
},
|
|
1066
|
+
h("span", { style: { color: T.faint } }, formatTime(entry.ts) + " "),
|
|
1067
|
+
h("span", { style: { fontWeight: 600 } }, String(entry.action || "") + " "),
|
|
1068
|
+
h(
|
|
1069
|
+
"span",
|
|
1070
|
+
{ title: entry.sessionId || "", style: { color: T.dim } },
|
|
1071
|
+
String(entry.result || "") +
|
|
1072
|
+
(entry.sessionId ? " · " + String(entry.sessionId).slice(0, 13) + "…" : "") +
|
|
1073
|
+
(entry.detail ? " · " + entry.detail : ""),
|
|
1074
|
+
),
|
|
1075
|
+
),
|
|
1076
|
+
);
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
if (data && data.unknown && data.unknown.length > 0) {
|
|
1081
|
+
content.push(
|
|
1082
|
+
h(
|
|
1083
|
+
"div",
|
|
1084
|
+
{ key: "unk", style: { color: T.faint, fontSize: "12px", marginTop: "10px" } },
|
|
1085
|
+
props.t("panel.unknown", { n: data.unknown.length }),
|
|
1086
|
+
),
|
|
1087
|
+
);
|
|
1088
|
+
}
|
|
1089
|
+
if (data && data.pending && data.pending.length > 0) {
|
|
1090
|
+
content.push(
|
|
1091
|
+
h(
|
|
1092
|
+
"div",
|
|
1093
|
+
{ key: "pend", style: { color: T.faint, fontSize: "12px", marginTop: "6px" } },
|
|
1094
|
+
props.t("panel.pending", { n: data.pending.length }),
|
|
1095
|
+
),
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
return h(
|
|
1100
|
+
Dialog,
|
|
1101
|
+
{
|
|
1102
|
+
onClose: () => {
|
|
1103
|
+
props.panelStore.set(false);
|
|
1104
|
+
},
|
|
1105
|
+
closeLabel: props.t("panel.close"),
|
|
1106
|
+
title: props.t("panel.title"),
|
|
1107
|
+
footer: h(
|
|
1108
|
+
Btn,
|
|
1109
|
+
{
|
|
1110
|
+
autoFocus: true,
|
|
1111
|
+
onClick: () => {
|
|
1112
|
+
props.panelStore.set(false);
|
|
1113
|
+
},
|
|
1114
|
+
},
|
|
1115
|
+
props.t("panel.close"),
|
|
1116
|
+
),
|
|
1117
|
+
},
|
|
1118
|
+
h(
|
|
1119
|
+
"div",
|
|
1120
|
+
{ ref: listRef, onKeyDown: onListKeyDown, tabIndex: -1, style: { outline: "none" } },
|
|
1121
|
+
content,
|
|
1122
|
+
),
|
|
1123
|
+
);
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
function TrashToast(/** @type {any} */ props) {
|
|
1127
|
+
var toastState = useStore(props.toastStore);
|
|
1128
|
+
var toast = toastState[0];
|
|
1129
|
+
var entryId = toast ? toast.entryId : null;
|
|
1130
|
+
var shownState = React.useState(false);
|
|
1131
|
+
var shown = shownState[0];
|
|
1132
|
+
var setShown = shownState[1];
|
|
1133
|
+
var restoreState = React.useState(false);
|
|
1134
|
+
var restoring = restoreState[0];
|
|
1135
|
+
var setRestoring = restoreState[1];
|
|
1136
|
+
|
|
1137
|
+
React.useEffect(() => {
|
|
1138
|
+
if (!entryId) {
|
|
1139
|
+
setShown(false);
|
|
1140
|
+
return undefined;
|
|
1141
|
+
}
|
|
1142
|
+
var raise = setTimeout(() => {
|
|
1143
|
+
setShown(true);
|
|
1144
|
+
}, 10);
|
|
1145
|
+
var timer = setTimeout(() => {
|
|
1146
|
+
props.toastStore.set(null);
|
|
1147
|
+
}, 6000);
|
|
1148
|
+
return () => {
|
|
1149
|
+
clearTimeout(raise);
|
|
1150
|
+
clearTimeout(timer);
|
|
1151
|
+
};
|
|
1152
|
+
}, [entryId]);
|
|
1153
|
+
|
|
1154
|
+
if (!toast) return null;
|
|
1155
|
+
return h(
|
|
1156
|
+
"div",
|
|
1157
|
+
{
|
|
1158
|
+
style: {
|
|
1159
|
+
position: "fixed",
|
|
1160
|
+
bottom: "24px",
|
|
1161
|
+
right: "24px",
|
|
1162
|
+
zIndex: 2147000000,
|
|
1163
|
+
background: T.toastBg,
|
|
1164
|
+
color: T.toastText,
|
|
1165
|
+
border: "1px solid " + T.border,
|
|
1166
|
+
borderRadius: "10px",
|
|
1167
|
+
padding: "10px 14px",
|
|
1168
|
+
fontSize: "13px",
|
|
1169
|
+
boxShadow: "0 10px 30px rgba(0,0,0,0.35)",
|
|
1170
|
+
display: "flex",
|
|
1171
|
+
alignItems: "center",
|
|
1172
|
+
gap: "12px",
|
|
1173
|
+
opacity: shown ? 1 : 0,
|
|
1174
|
+
transform: shown ? "translateY(0)" : "translateY(8px)",
|
|
1175
|
+
transition: "opacity .18s ease, transform .18s ease",
|
|
1176
|
+
},
|
|
1177
|
+
},
|
|
1178
|
+
h("span", null, props.t("confirm.done")),
|
|
1179
|
+
h(
|
|
1180
|
+
Btn,
|
|
1181
|
+
{
|
|
1182
|
+
disabled: restoring,
|
|
1183
|
+
onClick: () => {
|
|
1184
|
+
setRestoring(true);
|
|
1185
|
+
props
|
|
1186
|
+
.call("restore", { entryId: toast.entryId })
|
|
1187
|
+
.then(() => {
|
|
1188
|
+
setRestoring(false);
|
|
1189
|
+
props.toastStore.set(null);
|
|
1190
|
+
})
|
|
1191
|
+
.catch(() => {
|
|
1192
|
+
setRestoring(false);
|
|
1193
|
+
});
|
|
1194
|
+
},
|
|
1195
|
+
},
|
|
1196
|
+
props.t("confirm.undo"),
|
|
1197
|
+
),
|
|
1198
|
+
);
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
/** 一个浮层里渲染确认框 + 面板 + toast,因为 shell.overlay 是单实例 slot。 */
|
|
1202
|
+
function SessionDeleteOverlay(/** @type {any} */ props) {
|
|
1203
|
+
return h(
|
|
1204
|
+
React.Fragment,
|
|
1205
|
+
null,
|
|
1206
|
+
h(
|
|
1207
|
+
DeleteConfirm,
|
|
1208
|
+
Object.assign({}, props, {
|
|
1209
|
+
requestStore: props.requestStore,
|
|
1210
|
+
call: props.call,
|
|
1211
|
+
onTrashed: props.onTrashed,
|
|
1212
|
+
}),
|
|
1213
|
+
),
|
|
1214
|
+
h(
|
|
1215
|
+
TrashPanel,
|
|
1216
|
+
Object.assign({}, props, {
|
|
1217
|
+
panelStore: props.panelStore,
|
|
1218
|
+
call: props.call,
|
|
1219
|
+
onPurged: props.onPurged,
|
|
1220
|
+
onRestored: props.onRestored,
|
|
1221
|
+
tickStore: props.tickStore,
|
|
1222
|
+
bump: props.bump,
|
|
1223
|
+
}),
|
|
1224
|
+
),
|
|
1225
|
+
h(TrashToast, Object.assign({}, props, { toastStore: props.toastStore, call: props.call })),
|
|
1226
|
+
);
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
exports.inject = ["slots", "locale", "connection"];
|
|
1230
|
+
exports.apply = function apply(/** @type {any} */ ctx) {
|
|
1231
|
+
ctx.effect(() => ctx.locale.register(NS, { zh: zh, en: en }), "session-delete: dictionaries");
|
|
1232
|
+
|
|
1233
|
+
// 用真实的 :hover / :focus-visible 伪类,避免依赖 React 合成事件与内联样式。
|
|
1234
|
+
ctx.effect(() => {
|
|
1235
|
+
const style = document.createElement("style");
|
|
1236
|
+
style.textContent = [
|
|
1237
|
+
".dsh-sdel-btn{background:transparent;color:var(--dsw-alias-label-primary,inherit);border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.35));transition:background-color 150ms ease,border-color 150ms ease,transform 80ms ease,color 150ms ease;}",
|
|
1238
|
+
".dsh-sdel-btn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.16));}",
|
|
1239
|
+
".dsh-sdel-btn:active{transform:scale(.98);}",
|
|
1240
|
+
".dsh-sdel-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f7cff);outline-offset:1px;}",
|
|
1241
|
+
".dsh-sdel-btn--danger{color:var(--dsw-alias-state-error-primary,#d9534f);}",
|
|
1242
|
+
".dsh-sdel-btn--danger:hover{background:var(--dsw-alias-interactive-bg-hover-danger,rgba(217,83,79,.16));}",
|
|
1243
|
+
".dsh-sdel-footer{background:transparent;color:var(--dsw-alias-label-secondary,GrayText);border:1px solid transparent;border-radius:8px;transition:background-color 150ms ease,color 150ms ease;}",
|
|
1244
|
+
".dsh-sdel-footer:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.16));color:var(--dsw-alias-label-primary,inherit);}",
|
|
1245
|
+
".dsh-sdel-footer:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f7cff);outline-offset:1px;}",
|
|
1246
|
+
].join("\n");
|
|
1247
|
+
document.head.appendChild(style);
|
|
1248
|
+
return () => style.remove();
|
|
1249
|
+
}, "session-delete: styles");
|
|
1250
|
+
|
|
1251
|
+
var requestStore = createStore(null);
|
|
1252
|
+
var panelStore = createStore(false);
|
|
1253
|
+
var toastStore = createStore(null);
|
|
1254
|
+
var tickStore = createStore(0);
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* 调宿主 sessionDelete 的 Remote 方法。走 /api 的普通 RPC 通道:
|
|
1258
|
+
* 无构建插件没有 typert 生成的客户端产物,不能用 ctx.reflect.get。
|
|
1259
|
+
* @param {string} method
|
|
1260
|
+
* @param {any} request
|
|
1261
|
+
* @returns {Promise<any>}
|
|
1262
|
+
*/
|
|
1263
|
+
function call(method, request) {
|
|
1264
|
+
var rpc = ctx.connection && ctx.connection.rpc;
|
|
1265
|
+
if (!rpc || typeof rpc.call !== "function") {
|
|
1266
|
+
return Promise.reject(new Error("session-delete: no connection to the host"));
|
|
1267
|
+
}
|
|
1268
|
+
var payload = request === undefined ? { args: {} } : { args: { request: request } };
|
|
1269
|
+
return Promise.resolve(rpc.call("/api", "sessionDelete/" + method, payload)).then(
|
|
1270
|
+
(/** @type {any} */ result) => {
|
|
1271
|
+
if (!result || typeof result !== "object") return result;
|
|
1272
|
+
if (result.ok === false) {
|
|
1273
|
+
const error = /** @type {any} */ (
|
|
1274
|
+
new Error((result.error && result.error.message) || "host rejected the call")
|
|
1275
|
+
);
|
|
1276
|
+
error.code = result.error && result.error.code;
|
|
1277
|
+
throw error;
|
|
1278
|
+
}
|
|
1279
|
+
return "value" in result ? result.value : result;
|
|
1280
|
+
},
|
|
1281
|
+
);
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
// 宿主列表 = persistence ∪ live:刷新会把宿主内存里还没释放的会话折回来。
|
|
1285
|
+
// 所以删掉的 id 要记住,并在每次 refresh 后重放移除事件(参考实现同款做法)。
|
|
1286
|
+
const retired = new Set();
|
|
1287
|
+
const hostSessions = () => {
|
|
1288
|
+
try {
|
|
1289
|
+
return ctx.get ? ctx.get("sessions") : undefined;
|
|
1290
|
+
} catch (error) {
|
|
1291
|
+
return undefined;
|
|
1292
|
+
}
|
|
1293
|
+
};
|
|
1294
|
+
const refreshRows = async (/** @type {any} */ retireId) => {
|
|
1295
|
+
if (retireId) retired.add(retireId);
|
|
1296
|
+
const sessions = hostSessions();
|
|
1297
|
+
if (!sessions) return;
|
|
1298
|
+
try {
|
|
1299
|
+
await sessions.refresh?.();
|
|
1300
|
+
} catch (error) {
|
|
1301
|
+
/* 刷新失败不影响已经完成的删除 */
|
|
1302
|
+
}
|
|
1303
|
+
retired.forEach((id) => {
|
|
1304
|
+
try {
|
|
1305
|
+
sessions.handleSessionRemoved?.(id);
|
|
1306
|
+
} catch (error) {
|
|
1307
|
+
/* 旧版本没有该通道时忽略 */
|
|
1308
|
+
}
|
|
1309
|
+
});
|
|
1310
|
+
};
|
|
1311
|
+
// 快捷键只做「打开回收站」这种非破坏性动作;删除始终需要菜单 + 确认框。
|
|
1312
|
+
window.addEventListener("keydown", (/** @type {any} */ event) => {
|
|
1313
|
+
if (!(event.metaKey || event.ctrlKey) || !event.altKey) return;
|
|
1314
|
+
if (event.key !== "t" && event.key !== "T") return;
|
|
1315
|
+
const target = /** @type {any} */ (event.target);
|
|
1316
|
+
const tag = target && target.tagName ? String(target.tagName).toLowerCase() : "";
|
|
1317
|
+
if (tag === "input" || tag === "textarea" || (target && target.isContentEditable)) return;
|
|
1318
|
+
event.preventDefault();
|
|
1319
|
+
panelStore.set(true);
|
|
1320
|
+
});
|
|
1321
|
+
|
|
1322
|
+
const onTrashed = (/** @type {any} */ result) => {
|
|
1323
|
+
if (result && result.entryId) {
|
|
1324
|
+
toastStore.set({ entryId: result.entryId, title: result.title || null });
|
|
1325
|
+
}
|
|
1326
|
+
void refreshRows(result && result.sessionId ? result.sessionId : undefined);
|
|
1327
|
+
tickStore.set(tickStore.getSnapshot() + 1);
|
|
1328
|
+
};
|
|
1329
|
+
const onPurged = (/** @type {any} */ sessionId) => {
|
|
1330
|
+
void refreshRows(sessionId || undefined);
|
|
1331
|
+
};
|
|
1332
|
+
const onRestored = (/** @type {any} */ sessionId) => {
|
|
1333
|
+
if (sessionId) retired.delete(sessionId);
|
|
1334
|
+
void refreshRows(undefined);
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
ctx.effect(
|
|
1338
|
+
() =>
|
|
1339
|
+
ctx.slots.inject("sidebar.workspaces.session.menu.item", () =>
|
|
1340
|
+
ctx.slots.register(
|
|
1341
|
+
{
|
|
1342
|
+
name: "sidebar.workspaces.session.menu.item",
|
|
1343
|
+
id: "session-delete",
|
|
1344
|
+
order: 420,
|
|
1345
|
+
locale: NS,
|
|
1346
|
+
inject: () => ({
|
|
1347
|
+
requestDelete: (/** @type {any} */ request) => {
|
|
1348
|
+
requestStore.set(request);
|
|
1349
|
+
},
|
|
1350
|
+
}),
|
|
1351
|
+
},
|
|
1352
|
+
DeleteSessionMenuItem,
|
|
1353
|
+
),
|
|
1354
|
+
),
|
|
1355
|
+
"session-delete: session menu item",
|
|
1356
|
+
);
|
|
1357
|
+
|
|
1358
|
+
// 回收站入口固定在侧栏页脚,不出现在每个会话的「…」菜单里。
|
|
1359
|
+
ctx.effect(
|
|
1360
|
+
() =>
|
|
1361
|
+
ctx.slots.inject("sidebar.footer.action", () =>
|
|
1362
|
+
ctx.slots.register(
|
|
1363
|
+
{
|
|
1364
|
+
name: "sidebar.footer.action",
|
|
1365
|
+
id: "session-delete-trash",
|
|
1366
|
+
order: 100,
|
|
1367
|
+
locale: NS,
|
|
1368
|
+
inject: () => ({
|
|
1369
|
+
panelStore: panelStore,
|
|
1370
|
+
tickStore: tickStore,
|
|
1371
|
+
call: call,
|
|
1372
|
+
openPanel: () => {
|
|
1373
|
+
panelStore.set(true);
|
|
1374
|
+
},
|
|
1375
|
+
}),
|
|
1376
|
+
},
|
|
1377
|
+
TrashFooterButton,
|
|
1378
|
+
),
|
|
1379
|
+
),
|
|
1380
|
+
"session-delete: sidebar footer trash entry",
|
|
1381
|
+
);
|
|
1382
|
+
|
|
1383
|
+
ctx.effect(
|
|
1384
|
+
() =>
|
|
1385
|
+
ctx.slots.inject("shell.overlay", () =>
|
|
1386
|
+
ctx.slots.register(
|
|
1387
|
+
{ name: "shell.overlay", id: "session-delete", locale: NS },
|
|
1388
|
+
function OverlayHost(/** @type {any} */ props) {
|
|
1389
|
+
return h(
|
|
1390
|
+
SessionDeleteOverlay,
|
|
1391
|
+
Object.assign({}, props, {
|
|
1392
|
+
requestStore: requestStore,
|
|
1393
|
+
panelStore: panelStore,
|
|
1394
|
+
toastStore: toastStore,
|
|
1395
|
+
call: call,
|
|
1396
|
+
onTrashed: onTrashed,
|
|
1397
|
+
onPurged: onPurged,
|
|
1398
|
+
onRestored: onRestored,
|
|
1399
|
+
tickStore: tickStore,
|
|
1400
|
+
bump: () => tickStore.set(tickStore.getSnapshot() + 1),
|
|
1401
|
+
}),
|
|
1402
|
+
);
|
|
1403
|
+
},
|
|
1404
|
+
),
|
|
1405
|
+
),
|
|
1406
|
+
"session-delete: overlay (confirm + panel + toast)",
|
|
1407
|
+
);
|
|
1408
|
+
};
|
|
1409
|
+
|
|
1410
|
+
return module.exports;
|
|
1411
|
+
},
|
|
1412
|
+
});
|