Skip to content

Commit 6a9853c

Browse files
committed
Fix bug preventing UI from updating after one wiki has finished backing up
1 parent 2a026c4 commit 6a9853c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

static/js/backup.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ function statusMessage(status) {
167167
}
168168

169169
let updateIntervalId = 0;
170+
let finishedWikiCount = 0;
170171

171172
function updateStatus() {
172173
fetch('/backup/status').then(response => response.json()).then(data => {
@@ -201,7 +202,9 @@ function updateStatus() {
201202
case MessageType.ErrorFatal: messageStrings.push(`[${msg.tag}] Kritická chyba: ${msg.error_message}`); break;
202203
case MessageType.FinishSuccess:
203204
messageStrings.push(`[${msg.tag}] Záloha dokončena, zpracovávám data`);
204-
clearInterval(updateIntervalId);
205+
if(++finishedWikiCount === data.length) {
206+
clearInterval(updateIntervalId);
207+
}
205208
break;
206209
}
207210
})
@@ -222,6 +225,7 @@ function logMessage(message) {
222225
}
223226

224227
async function start_backup() {
228+
finishedWikiCount = 0;
225229
updateIntervalId = setInterval(updateStatus, 2000);
226230
$('#status-text').text('Záloha spuštěna');
227231
let response = await fetch('/backup/start')

0 commit comments

Comments
 (0)