feat: feedback verbetering - 06

This commit is contained in:
kodi
2026-03-15 15:51:13 +01:00
parent ae6a9d8c45
commit 9537a29de3
17 changed files with 368 additions and 37 deletions
+19 -17
View File
@@ -121,7 +121,7 @@ let headerTaskState = {
lastRenderKey: "",
};
// The header chip/popover reflects user-visible file operations, not every task-backed file action.
const ACTIVE_OPERATION_OPERATIONS = new Set(["copy", "move", "duplicate"]);
const ACTIVE_OPERATION_OPERATIONS = new Set(["copy", "move", "duplicate", "delete"]);
const ACTIVE_TASK_STATUSES = new Set(["queued", "running", "cancelling"]);
const VALID_THEME_FAMILIES = [
"default",
@@ -2761,28 +2761,30 @@ function openConfirmModal({ title, message, path, applyText = "Confirm" }) {
}
async function executeDeleteItems(pane, items, recursivePaths) {
let successes = 0;
let failures = 0;
let firstError = null;
for (const item of items) {
try {
const result = await apiRequest("POST", "/api/files/delete", {
try {
let result;
if (items.length > 1) {
result = await apiRequest("POST", "/api/files/delete", {
paths: items.map((item) => item.path),
recursive_paths: Array.from(recursivePaths),
});
setStatus("Delete: operation started");
} else {
const item = items[0];
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) {
failures += 1;
if (!firstError) {
firstError = `${item.path}: ${err.message}`;
}
setStatus("Delete: started");
}
state.selectedTaskId = result.task_id;
await refreshTasksSnapshot();
} catch (err) {
setActionError("Delete", err);
return;
}
setSelectedItem(pane, null);
await loadBrowsePane(pane);
showActionSummary("Delete", successes, failures, firstError);
}
async function submitDeleteConfirmModal() {
@@ -3901,7 +3903,7 @@ function canShowChipItemProgress(task) {
if (!hasMeaningfulItemProgress(task)) {
return false;
}
return task.operation === "copy" || task.operation === "duplicate";
return task.operation === "copy" || task.operation === "duplicate" || task.operation === "delete";
}
function compactTaskCurrentItem(task) {