Refresh explorers after transfer completion
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
set -eu
|
||||
|
||||
PLUGIN="u-navigator"
|
||||
VERSION="2026.06.23.r008"
|
||||
VERSION="2026.06.23.r009"
|
||||
PKG_DIR="packages"
|
||||
WORK_DIR=".plugin-build"
|
||||
PKG_NAME="${PLUGIN}-${VERSION}.tgz"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+29
-8
@@ -14,6 +14,7 @@ const state = {
|
||||
debug: [],
|
||||
nextDebugId: 1,
|
||||
jobs: new Map(),
|
||||
jobRefresh: new Map(),
|
||||
nextWindowId: 1,
|
||||
zIndex: 20
|
||||
};
|
||||
@@ -389,8 +390,8 @@ async function handleDrop(event, win, targetPath) {
|
||||
}
|
||||
}
|
||||
|
||||
async function createJob(type, source, destination) {
|
||||
recordDebug('job.create.request', { type, source, destination });
|
||||
async function createJob(type, source, destination, refreshWindowIds = []) {
|
||||
recordDebug('job.create.request', { type, source, destination, refreshWindowIds });
|
||||
const body = new URLSearchParams();
|
||||
body.set('source', source);
|
||||
body.set('destination', destination);
|
||||
@@ -402,8 +403,13 @@ async function createJob(type, source, destination) {
|
||||
});
|
||||
recordDebug('job.create.response', job);
|
||||
state.jobs.set(job.id, job);
|
||||
state.jobRefresh.set(job.id, {
|
||||
windowIds: [...new Set(refreshWindowIds)].filter(Boolean),
|
||||
done: false
|
||||
});
|
||||
pollJob(job.id);
|
||||
render();
|
||||
return job;
|
||||
}
|
||||
|
||||
async function reloadExplorerWindows(ids) {
|
||||
@@ -466,8 +472,7 @@ async function renameEntry(win, entry) {
|
||||
showError(new Error('Der Name darf keinen Slash enthalten.'));
|
||||
return;
|
||||
}
|
||||
await createJob('move', entry.path, `${dirname(entry.path)}/${nextName}`);
|
||||
await loadExplorer(win, win.data.path);
|
||||
await createJob('move', entry.path, `${dirname(entry.path)}/${nextName}`, [win.id]);
|
||||
}
|
||||
|
||||
async function promptTransfer(win, entry, type) {
|
||||
@@ -475,8 +480,7 @@ async function promptTransfer(win, entry, type) {
|
||||
if (!targetDir) {
|
||||
return;
|
||||
}
|
||||
await createJob(type, entry.path, `${targetDir.replace(/\/$/, '')}/${entry.name}`);
|
||||
await loadExplorer(win, win.data.path);
|
||||
await createJob(type, entry.path, `${targetDir.replace(/\/$/, '')}/${entry.name}`, []);
|
||||
}
|
||||
|
||||
function showContextMenu(event, win, entry) {
|
||||
@@ -551,6 +555,8 @@ async function pollJob(id) {
|
||||
render();
|
||||
if (['queued', 'running', 'cancel_requested'].includes(job.status)) {
|
||||
setTimeout(() => pollJob(id), 700);
|
||||
} else {
|
||||
await refreshAfterJob(job);
|
||||
}
|
||||
} catch (error) {
|
||||
recordDebug('job.poll.error', { id, error: serializeError(error) });
|
||||
@@ -558,6 +564,22 @@ async function pollJob(id) {
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshAfterJob(job) {
|
||||
const refresh = state.jobRefresh.get(job.id);
|
||||
if (refresh?.done) {
|
||||
return;
|
||||
}
|
||||
if (refresh) {
|
||||
refresh.done = true;
|
||||
}
|
||||
const windowIds = refresh?.windowIds || [];
|
||||
recordDebug('job.refresh', { id: job.id, status: job.status, windowIds });
|
||||
await reloadExplorerWindows(windowIds);
|
||||
if (refresh) {
|
||||
state.jobRefresh.delete(job.id);
|
||||
}
|
||||
}
|
||||
|
||||
function selectEntry(win, entry, scrollBody = null) {
|
||||
if (state.suppressClickPath === entry.path) {
|
||||
state.suppressClickPath = null;
|
||||
@@ -680,8 +702,7 @@ async function finishItemPointerDrag(event, move, up) {
|
||||
if (destination === drag.path) {
|
||||
throw new Error('Quelle und Ziel sind identisch.');
|
||||
}
|
||||
await createJob(event.altKey ? 'copy' : 'move', drag.path, destination);
|
||||
await reloadExplorerWindows([drag.sourceWindowId, target.windowId]);
|
||||
await createJob(event.altKey ? 'copy' : 'move', drag.path, destination, [drag.sourceWindowId, target.windowId]);
|
||||
} catch (error) {
|
||||
showError(error);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE PLUGIN [
|
||||
<!ENTITY name "u-navigator">
|
||||
<!ENTITY author "michael">
|
||||
<!ENTITY version "2026.06.23.r008">
|
||||
<!ENTITY version "2026.06.23.r009">
|
||||
<!ENTITY package "&name;-&version;.tgz">
|
||||
]>
|
||||
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg">
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<FILE Name="/boot/config/plugins/&name;/&package;">
|
||||
<URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL>
|
||||
<MD5>6a584ee446fc442c9a3c95877f15d1ae</MD5>
|
||||
<MD5>1388b0f68a4cc0ddfaacc4e6f2402ea7</MD5>
|
||||
</FILE>
|
||||
|
||||
<FILE Run="/bin/bash">
|
||||
|
||||
Reference in New Issue
Block a user