fix: copy and move
This commit is contained in:
+14
-14
@@ -15,6 +15,7 @@ let state = {
|
||||
},
|
||||
activePane: "left",
|
||||
selectedTaskId: null,
|
||||
lastTaskCount: 0,
|
||||
};
|
||||
|
||||
function paneState(pane) {
|
||||
@@ -66,6 +67,15 @@ async function apiRequest(method, url, body) {
|
||||
return data;
|
||||
}
|
||||
|
||||
async function refreshTasksSnapshot() {
|
||||
try {
|
||||
const data = await apiRequest("GET", "/api/tasks");
|
||||
state.lastTaskCount = Array.isArray(data.items) ? data.items.length : state.lastTaskCount;
|
||||
} catch (_) {
|
||||
// Task list panel is not visible in current UI; silently keep flow stable.
|
||||
}
|
||||
}
|
||||
|
||||
function createButton(text, onClick) {
|
||||
const button = document.createElement("button");
|
||||
button.textContent = text;
|
||||
@@ -396,13 +406,7 @@ async function startCopySelected() {
|
||||
if (selectedItems.length === 0) {
|
||||
return;
|
||||
}
|
||||
const baseDestination = window.prompt(
|
||||
"Copy destination base path (full path)",
|
||||
paneState(destinationPane).currentPath,
|
||||
);
|
||||
if (!baseDestination) {
|
||||
return;
|
||||
}
|
||||
const baseDestination = paneState(destinationPane).currentPath;
|
||||
setError("actions-error", "");
|
||||
let successes = 0;
|
||||
let failures = 0;
|
||||
@@ -418,6 +422,7 @@ async function startCopySelected() {
|
||||
destination,
|
||||
});
|
||||
state.selectedTaskId = result.task_id;
|
||||
await refreshTasksSnapshot();
|
||||
successes += 1;
|
||||
} catch (err) {
|
||||
failures += 1;
|
||||
@@ -437,13 +442,7 @@ async function startMoveSelected() {
|
||||
if (selectedItems.length === 0) {
|
||||
return;
|
||||
}
|
||||
const baseDestination = window.prompt(
|
||||
"Move destination base path (full path)",
|
||||
paneState(destinationPane).currentPath,
|
||||
);
|
||||
if (!baseDestination) {
|
||||
return;
|
||||
}
|
||||
const baseDestination = paneState(destinationPane).currentPath;
|
||||
setError("actions-error", "");
|
||||
let successes = 0;
|
||||
let failures = 0;
|
||||
@@ -459,6 +458,7 @@ async function startMoveSelected() {
|
||||
destination,
|
||||
});
|
||||
state.selectedTaskId = result.task_id;
|
||||
await refreshTasksSnapshot();
|
||||
successes += 1;
|
||||
} catch (err) {
|
||||
failures += 1;
|
||||
|
||||
Reference in New Issue
Block a user