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