downloads: disable primary buttons if binary is not yet available

pull/17125/head
Péter Szilágyi 8 years ago
parent f112f782e6
commit 65f267756f
No known key found for this signature in database
GPG Key ID: 119A76381CCB7DD2
  1. 21
      downloads/index.html

@ -275,6 +275,9 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
// Maintain a set of downloadable resources to cross check URL liveliness later
var resources = {};
// Maintain a counter for external requests to show a loader modal during // Maintain a counter for external requests to show a loader modal during
$('#loader').modal('show'); $('#loader').modal('show');
$('#loader').attr('data-reqs', '3'); $('#loader').attr('data-reqs', '3');
@ -282,6 +285,19 @@
var requestDone = function() { var requestDone = function() {
var reqs = $('#loader').data('reqs'); var reqs = $('#loader').data('reqs');
if (reqs == 1) { if (reqs == 1) {
// All requests done, check which primary download buttons can be activated
var prefix = "https://gethstore.blob.core.windows.net/builds/";
if (!($('#download_linux').attr("href").slice(prefix.length) in resources)) {
$('#download_linux').addClass("disabled");
}
if (!($('#download_darwin').attr("href").slice(prefix.length) in resources)) {
$('#download_darwin').addClass("disabled");
}
if (!($('#download_windows').attr("href").slice(prefix.length) in resources)) {
$('#download_windows').addClass("disabled");
}
// Finally hide the load screen
$('#loader').modal('hide'); $('#loader').modal('hide');
} }
$('#loader').data('reqs', reqs-1); $('#loader').data('reqs', reqs-1);
@ -307,8 +323,11 @@
// Iterate over all the blobs and populate the tables // Iterate over all the blobs and populate the tables
var blobs = $(data).find('Blob') var blobs = $(data).find('Blob')
for (var i = 0; i < blobs.length; i++) { for (var i = 0; i < blobs.length; i++) {
// Skip any signatures, those are assumed implicitly // Gather all available resources to later inspection
var name = $($(blobs[i]).find('Name')[0]).text(); var name = $($(blobs[i]).find('Name')[0]).text();
resources[name] = true;
// Skip any signatures, those are assumed implicitly
if (name.endsWith(".asc")) { if (name.endsWith(".asc")) {
signatures[name] = true; signatures[name] = true;
continue; continue;

Loading…
Cancel
Save