Skip to content

Commit e8ef941

Browse files
authored
Always request hex via the post to API mechanism (#3149)
* Always request hex via the post to API mechanism - enables logging of requests for older versions via API rather than GA, - gives flexibility in future if we need to return alternative hex files for any reason. * The URL for the hex is now returned by the API * Only apply these settings if expertmode is enabled.
1 parent b6d8efc commit e8ef941

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/js/release_loader.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class ReleaseLoader {
9090
contentType: "application/json",
9191
dataType: "json",
9292
success: function(data) {
93-
data.url = `/api/builds/${data.key}/hex`;
9493
onSuccess(data);
9594
},
9695
}).fail(xhr => {

src/js/tabs/firmware_flasher.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ firmware_flasher.initialize = function (callback) {
784784
classicBuild: false,
785785
};
786786

787-
request.classicBuild = $('input[name="classicBuildModeCheckbox"]').is(':checked');
787+
request.classicBuild = !summary.cloudBuild || $('input[name="classicBuildModeCheckbox"]').is(':checked');
788788
if (!request.classicBuild) {
789789
$('select[name="radioProtocols"] option:selected').each(function () {
790790
request.radioProtocols.push($(this).val());
@@ -801,18 +801,27 @@ firmware_flasher.initialize = function (callback) {
801801
$('select[name="motorProtocols"] option:selected').each(function () {
802802
request.motorProtocols.push($(this).val());
803803
});
804-
}
805804

806-
if (summary.releaseType === "Unstable") {
807-
request.commit = $('select[name="commits"] option:selected').val();
808-
$('input[name="customDefines"]').val().split(' ').map(element => element.trim()).forEach(v => {
809-
request.options.push(v);
810-
});
805+
if ($('input[name="expertModeCheckbox"]').is(':checked')) {
806+
if (summary.releaseType === "Unstable") {
807+
request.commit = $('select[name="commits"] option:selected').val();
808+
}
809+
810+
$('input[name="customDefines"]').val().split(' ').map(element => element.trim()).forEach(v => {
811+
request.options.push(v);
812+
});
813+
}
811814
}
812815

813816
self.releaseLoader.requestBuild(request, (info) => {
814817
console.info("Build requested:", info);
815818

819+
if (!summary.cloudBuild) {
820+
// it is a previous release, so simply load the hex
821+
self.releaseLoader.loadTargetHex(info.url, (hex) => onLoadSuccess(hex, info.file), onLoadFailed);
822+
return;
823+
}
824+
816825
updateStatus('Pending', info.key, 0, false);
817826
let retries = 1;
818827
self.releaseLoader.requestBuildStatus(info.key, (status) => {
@@ -855,21 +864,13 @@ firmware_flasher.initialize = function (callback) {
855864
}, onLoadFailed);
856865
}
857866

858-
function requestLegacyBuild(summary) {
859-
self.releaseLoader.loadTargetHex(summary.url, (hex) => onLoadSuccess(hex, summary.file), onLoadFailed);
860-
}
861-
862867
if (self.summary) { // undefined while list is loading or while running offline
863868
$("a.load_remote_file").text(i18n.getMessage('firmwareFlasherButtonDownloading'));
864869
$("a.load_remote_file").addClass('disabled');
865870

866871
showReleaseNotes(self.summary);
867872

868-
if (self.summary.cloudBuild === true) {
869-
requestCloudBuild(self.summary);
870-
} else {
871-
requestLegacyBuild(self.summary);
872-
}
873+
requestCloudBuild(self.summary);
873874
} else {
874875
$('span.progressLabel').attr('i18n','firmwareFlasherFailedToLoadOnlineFirmware').removeClass('i18n-replaced');
875876
i18n.localizePage();

0 commit comments

Comments
 (0)