fix: SSH update modal polls locally, collapsed log by default (v0.5.9)
Modal owns job poll and completion UI with countdown; log hidden until user clicks Показать лог; db.refresh on remote-job; cache-bust poll requests.
This commit is contained in:
@@ -95,16 +95,28 @@ function applyJobToEntry(entry: HostRemoteActionLogEntry, job: HostRemoteActionJ
|
||||
}
|
||||
|
||||
function finishEntry(entry: HostRemoteActionLogEntry, job: HostRemoteActionJobStatus) {
|
||||
if (!entry.loading && entry.ok != null) {
|
||||
return;
|
||||
}
|
||||
entry.loading = false;
|
||||
entry.ok = job.ok ?? job.status === "success";
|
||||
applyJobToEntry(entry, job);
|
||||
entry.logVisible = true;
|
||||
entry.open = true;
|
||||
if (entry.ok) {
|
||||
scheduleSuccessAutoClose(entry.id);
|
||||
}
|
||||
}
|
||||
|
||||
export function syncHostRemoteActionJobFinished(
|
||||
entryId: string,
|
||||
job: HostRemoteActionJobStatus,
|
||||
): void {
|
||||
const entry = findLogById(entryId);
|
||||
if (!entry) return;
|
||||
finishEntry(entry, job);
|
||||
void patchHostFromJob(entry.hostId, job);
|
||||
}
|
||||
|
||||
async function pollRemoteJob(hostId: number, entry: HostRemoteActionLogEntry): Promise<HostRemoteActionJobStatus> {
|
||||
for (;;) {
|
||||
const job = await fetchHostRemoteJob(hostId);
|
||||
@@ -189,7 +201,7 @@ export async function pollHostRemoteAction(
|
||||
id: newLogId(),
|
||||
hostId,
|
||||
open: true,
|
||||
logVisible: true,
|
||||
logVisible: false,
|
||||
loading: true,
|
||||
ok: null,
|
||||
title,
|
||||
@@ -239,7 +251,7 @@ export async function runHostRemoteAction(
|
||||
id: newLogId(),
|
||||
hostId,
|
||||
open: true,
|
||||
logVisible: true,
|
||||
logVisible: false,
|
||||
loading: true,
|
||||
ok: null,
|
||||
title,
|
||||
|
||||
Reference in New Issue
Block a user