diff --git a/locales/ca/messages.json b/locales/ca/messages.json
index 61530ebb93..dfac3dce03 100644
--- a/locales/ca/messages.json
+++ b/locales/ca/messages.json
@@ -3335,10 +3335,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "èxit"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "cancel"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "s'ha esgotat el temps d'espera (torneu-ho a provar)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "ha fallat (comproveu el registre)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/da/messages.json b/locales/da/messages.json
index 385c982983..4dd787b933 100644
--- a/locales/da/messages.json
+++ b/locales/da/messages.json
@@ -3331,10 +3331,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "succes"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "aflyst"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "timeout (prøv igen)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "mislykkedes (tjek log)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/de/messages.json b/locales/de/messages.json
index d1553b274f..4d032b5b4b 100644
--- a/locales/de/messages.json
+++ b/locales/de/messages.json
@@ -2967,10 +2967,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "Erfolgreich"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "Abgebrochen"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "Zeitüberschreitung (bitte erneut versuchen)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "Fehlgeschlagen (bitte Log prüfen)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/en/messages.json b/locales/en/messages.json
index 77d9fe3cd6..bd6f0cd6d5 100755
--- a/locales/en/messages.json
+++ b/locales/en/messages.json
@@ -1397,7 +1397,7 @@
},
"configurationMotorIdleRpmHelp" : {
"message": "This is the dynamic idle value from the active PID profile. When Dynamic Idle is set to zero, only static motor idle will apply. Change the Dynamic Idle settings on the PID tuning tab.",
- "description": "Help text for dynamic idle setting"
+ "description": "Help text for dynamic idle setting"
},
"configurationThrottleMinimum": {
"message": "Minimum Throttle (Lowest ESC value when armed)"
@@ -3415,10 +3415,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "success"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "cancelled"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "timed out (please retry)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "failed (please check log)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/es/messages.json b/locales/es/messages.json
index 64af91a064..2b312c9f84 100644
--- a/locales/es/messages.json
+++ b/locales/es/messages.json
@@ -3327,10 +3327,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "éxito"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "anulado"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "tiempo agotado (vuelve a intentarlo)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "error (revisa el registro)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/fr/messages.json b/locales/fr/messages.json
index 3b25c87ec6..eca9cfa986 100644
--- a/locales/fr/messages.json
+++ b/locales/fr/messages.json
@@ -2891,10 +2891,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "succès"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "annulé"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "temps expiré (veuillez réessayer)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "échec (veuillez vérifier le log)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/gl/messages.json b/locales/gl/messages.json
index 6fd942971d..3ee9e2be4f 100644
--- a/locales/gl/messages.json
+++ b/locales/gl/messages.json
@@ -3327,10 +3327,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "éxito"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "cancelación"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "tempo esgotado (volva a intentalo)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "fallou (verifique o rexistro)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/it/messages.json b/locales/it/messages.json
index 714f12e72e..640a06bd9f 100644
--- a/locales/it/messages.json
+++ b/locales/it/messages.json
@@ -3327,10 +3327,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "successo"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "annullato"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "timeout (riprova)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "fallito (si prega di controllare il log)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/ja/messages.json b/locales/ja/messages.json
index d9028d3a97..78f4527351 100644
--- a/locales/ja/messages.json
+++ b/locales/ja/messages.json
@@ -3327,10 +3327,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "成功しました"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "キャンセル"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "タイムアウトしました (再試行してください)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "失敗しました (ログを確認してください)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/ko/messages.json b/locales/ko/messages.json
index a4846b169e..66e7abf5c8 100644
--- a/locales/ko/messages.json
+++ b/locales/ko/messages.json
@@ -3331,10 +3331,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "성공"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "취소가"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "시간 초과됨 (재시도하세요)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "실패 (로그기록을 확인하세요)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/pl/messages.json b/locales/pl/messages.json
index c8e50d421e..538374f7d7 100644
--- a/locales/pl/messages.json
+++ b/locales/pl/messages.json
@@ -3331,10 +3331,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "ukończono"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "anulowane"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "przekroczono limit czasu (spróbuj ponownie)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "nie powiodło się (proszę sprawdzić logi)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/pt/messages.json b/locales/pt/messages.json
index 8885fd76bc..bee8cf5dfd 100644
--- a/locales/pt/messages.json
+++ b/locales/pt/messages.json
@@ -3327,10 +3327,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "sucesso"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "cancelado"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "tempo expirou (pf tente novamente)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "falhou (pf verifique o log)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/pt_BR/messages.json b/locales/pt_BR/messages.json
index ceab8a623a..444af15d29 100644
--- a/locales/pt_BR/messages.json
+++ b/locales/pt_BR/messages.json
@@ -3121,10 +3121,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "sucesso"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "cancelado"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "tempo esgotado (tente novamente)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "falhou (por favor, verifique o log)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/locales/uk/messages.json b/locales/uk/messages.json
index e542ce7f18..9710f9863e 100644
--- a/locales/uk/messages.json
+++ b/locales/uk/messages.json
@@ -3327,10 +3327,13 @@
"firmwareFlasherCloudBuildSuccess": {
"message": "успішно"
},
- "firmwareFlasherCloudBuildTimedOut": {
+ "firmwareFlasherCloudBuildFailCancel": {
+ "message": "cкасовано"
+ },
+ "firmwareFlasherCloudBuildFailTimeOut": {
"message": "час вийшов (спробуйте ще раз)"
},
- "firmwareFlasherCloudBuildFailed": {
+ "firmwareFlasherCloudBuildFail": {
"message": "не вдалося (перевірте журнал)"
},
"firmwareFlasherReleaseFileUrl": {
diff --git a/src/js/tabs/firmware_flasher.js b/src/js/tabs/firmware_flasher.js
index 3c8ec71525..5d9b55c45c 100644
--- a/src/js/tabs/firmware_flasher.js
+++ b/src/js/tabs/firmware_flasher.js
@@ -23,7 +23,7 @@ import Sponsor from '../Sponsor';
const firmware_flasher = {
targets: null,
- releaseLoader: new BuildApi(),
+ buildApi: new BuildApi(),
sponsor: new Sponsor(),
localFirmwareLoaded: false,
selectedBoard: undefined,
@@ -39,6 +39,7 @@ const firmware_flasher = {
configFilename: null,
config: {},
developmentFirmwareLoaded: false, // Is the firmware to be flashed from the development branch?
+ cancelBuild: false,
};
firmware_flasher.initialize = function (callback) {
@@ -325,7 +326,7 @@ firmware_flasher.initialize = function (callback) {
if (!GUI.connect_lock) {
try {
- self.releaseLoader.loadTargets(loadTargetList);
+ self.buildApi.loadTargets(loadTargetList);
} catch (err) {
console.error(err);
}
@@ -360,7 +361,7 @@ firmware_flasher.initialize = function (callback) {
const expertMode = expertMode_e.is(':checked');
if (expertMode) {
if (response.releaseType === 'Unstable') {
- self.releaseLoader.loadCommits(response.release, (commits) => {
+ self.buildApi.loadCommits(response.release, (commits) => {
const select_e = $('select[name="commits"]');
select_e.empty();
commits.forEach((commit) => {
@@ -384,12 +385,12 @@ firmware_flasher.initialize = function (callback) {
self.enableLoadRemoteFileButton(true);
}
- self.releaseLoader.loadTarget(target, release, onTargetDetail);
+ self.buildApi.loadTarget(target, release, onTargetDetail);
if (self.validateBuildKey() && navigator.onLine) {
- self.releaseLoader.loadOptionsByBuildKey(release, self.cloudBuildKey, buildOptions);
+ self.buildApi.loadOptionsByBuildKey(release, self.cloudBuildKey, buildOptions);
} else {
- self.releaseLoader.loadOptions(release, buildOptions);
+ self.buildApi.loadOptions(release, buildOptions);
}
}
@@ -514,7 +515,7 @@ firmware_flasher.initialize = function (callback) {
),
);
- self.releaseLoader.loadTargetReleases(target, (data) => populateReleases(versions_e, data));
+ self.buildApi.loadTargetReleases(target, (data) => populateReleases(versions_e, data));
}
}
});
@@ -761,6 +762,11 @@ firmware_flasher.initialize = function (callback) {
},
);
+ $('a.cloud_build_cancel').on('click', function (evt) {
+ $('a.cloud_build_cancel').toggleClass('disabled', true);
+ self.cancelBuild = true;
+ });
+
$('a.load_remote_file').on('click', function (evt) {
if (!self.selectedBoard) {
return;
@@ -791,17 +797,20 @@ firmware_flasher.initialize = function (callback) {
$('.buildProgress').val(val);
}
- function processBuildStatus(response, statusResponse, retries) {
- if (statusResponse.status === 'success') {
- updateStatus(retries <= 0 ? 'SuccessCached' : "Success", response.key, 100, true);
- if (statusResponse.configuration !== undefined && !self.isConfigLocal) {
- setBoardConfig(statusResponse.configuration);
- }
- self.releaseLoader.loadTargetHex(response.url, (hex) => onLoadSuccess(hex, response.file), onLoadFailed);
- } else {
- updateStatus(retries > 10 ? 'TimedOut' : "Failed", response.key, 0, true);
- onLoadFailed();
+ function processBuildSuccess(response, statusResponse, suffix) {
+ if (statusResponse.status !== 'success') {
+ return;
+ }
+ updateStatus(`Success${suffix}`, response.key, 100, true);
+ if (statusResponse.configuration !== undefined && !self.isConfigLocal) {
+ setBoardConfig(statusResponse.configuration);
}
+ self.buildApi.loadTargetHex(response.url, (hex) => onLoadSuccess(hex, response.file), onLoadFailed);
+ }
+
+ function processBuildFailure(key, suffix) {
+ updateStatus(`Fail${suffix}`, key, 0, true);
+ onLoadFailed();
}
function requestCloudBuild(targetDetail) {
@@ -844,7 +853,7 @@ firmware_flasher.initialize = function (callback) {
}
console.info("Build request:", request);
- self.releaseLoader.requestBuild(request, (response) => {
+ self.buildApi.requestBuild(request, (response) => {
console.info("Build response:", response);
// Complete the summary object to be used later
@@ -852,32 +861,63 @@ firmware_flasher.initialize = function (callback) {
if (!targetDetail.cloudBuild) {
// it is a previous release, so simply load the hex
- self.releaseLoader.loadTargetHex(response.url, (hex) => onLoadSuccess(hex, response.file), onLoadFailed);
+ self.buildApi.loadTargetHex(response.url, (hex) => onLoadSuccess(hex, response.file), onLoadFailed);
return;
}
updateStatus('Pending', response.key, 0, false);
+ self.cancelBuild = false;
- let retries = 1;
- self.releaseLoader.requestBuildStatus(response.key, (statusResponse) => {
- if (statusResponse.status !== "queued") {
+ self.buildApi.requestBuildStatus(response.key, (statusResponse) => {
+ if (statusResponse.status === "success") {
// will be cached already, no need to wait.
- processBuildStatus(response, statusResponse, 0);
+ processBuildSuccess(response, statusResponse, "Cached");
return;
}
+ self.enableCancelBuildButton(true);
+ const retrySeconds = 5;
+ let retries = 1;
+ let processing = false;
+ let timeout = 120;
const timer = setInterval(() => {
- self.releaseLoader.requestBuildStatus(response.key, (statusResponse) => {
- if (statusResponse.status !== 'queued' || retries > 10) {
+ self.buildApi.requestBuildStatus(response.key, (statusResponse) => {
+ if (statusResponse.timeOut !== undefined) {
+ if (!processing) {
+ processing = true;
+ retries = 1;
+ }
+ timeout = statusResponse.timeOut;
+ }
+ const retryTotal = timeout / retrySeconds;
+
+ if (statusResponse.status !== 'queued' || retries > retryTotal || self.cancelBuild) {
+ self.enableCancelBuildButton(false);
clearInterval(timer);
- processBuildStatus(response, statusResponse, retries);
+
+ if (statusResponse.status === 'success') {
+ processBuildSuccess(response, statusResponse, "");
+ return;
+ }
+
+ let suffix = "";
+ if (retries > retryTotal) {
+ suffix = "TimeOut";
+ }
+
+ if (self.cancelBuild) {
+ suffix = "Cancel";
+ }
+ processBuildFailure(response.key, suffix);
return;
}
- updateStatus('Processing', response.key, retries * 10, false);
+ if (processing) {
+ updateStatus('Processing', response.key, retries * (100 / retryTotal), false);
+ }
retries++;
});
- }, 5000);
+ }, retrySeconds * 1000);
});
}, onLoadFailed);
}
@@ -1159,7 +1199,7 @@ firmware_flasher.initialize = function (callback) {
GUI.content_ready(callback);
}
- self.releaseLoader.loadTargets(() => {
+ self.buildApi.loadTargets(() => {
$('#content').load("./tabs/firmware_flasher.html", onDocumentLoad);
});
};
@@ -1267,7 +1307,7 @@ firmware_flasher.verifyBoard = function() {
self.cloudBuildKey = FC.CONFIG.buildKey;
if (self.validateBuildKey()) {
- self.releaseLoader.requestBuildOptions(self.cloudBuildKey, getCloudBuildOptions, getBoardInfo);
+ self.buildApi.requestBuildOptions(self.cloudBuildKey, getCloudBuildOptions, getBoardInfo);
} else {
getBoardInfo();
}
@@ -1493,6 +1533,11 @@ firmware_flasher.cleanup = function (callback) {
if (callback) callback();
};
+firmware_flasher.enableCancelBuildButton = function (enabled) {
+ $('a.cloud_build_cancel').toggleClass('disabled', !enabled);
+ self.cancelBuild = false; // remove the semaphore
+};
+
firmware_flasher.enableFlashButton = function (enabled) {
$('a.flash_firmware').toggleClass('disabled', !enabled);
};
diff --git a/src/tabs/firmware_flasher.html b/src/tabs/firmware_flasher.html
index 96e9949f38..92958c4dc1 100644
--- a/src/tabs/firmware_flasher.html
+++ b/src/tabs/firmware_flasher.html
@@ -254,6 +254,9 @@
+