feat: voortgang delete in headerbar

This commit is contained in:
kodi
2026-03-15 11:52:39 +01:00
parent 73b09d2802
commit 7d910479f9
23 changed files with 311 additions and 43 deletions
+5 -16
View File
@@ -120,9 +120,8 @@ let headerTaskState = {
pollTimer: null,
lastRenderKey: "",
};
// The header chip reflects only user-visible file actions that currently use the shared task system.
// Delete stays out of this set because it still runs as a direct request flow, not as a backend task.
const ACTIVE_TASK_OPERATIONS = new Set(["copy", "move", "duplicate"]);
// The header chip reflects only user-visible file actions that use the shared task system.
const ACTIVE_TASK_OPERATIONS = new Set(["copy", "move", "duplicate", "delete"]);
const ACTIVE_TASK_STATUSES = new Set(["queued", "running"]);
const VALID_THEME_FAMILIES = [
"default",
@@ -2767,24 +2766,14 @@ async function executeDeleteItems(pane, items, recursivePaths) {
let firstError = null;
for (const item of items) {
try {
await apiRequest("POST", "/api/files/delete", {
const result = await apiRequest("POST", "/api/files/delete", {
path: item.path,
recursive: recursivePaths.has(item.path),
});
state.selectedTaskId = result.task_id;
await refreshTasksSnapshot();
successes += 1;
} catch (err) {
if (err.code === "directory_not_empty" && recursivePaths.has(item.path)) {
try {
await apiRequest("POST", "/api/files/delete", {
path: item.path,
recursive: true,
});
successes += 1;
continue;
} catch (retryErr) {
err = retryErr;
}
}
failures += 1;
if (!firstError) {
firstError = `${item.path}: ${err.message}`;