downloads: handle multi-page results from Azure (#19138)
This commit is contained in:
parent
680f715585
commit
02c039f102
|
@ -305,13 +305,37 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
// Create the blob retriever that iterates over all the pages of the blobstore.
|
||||||
|
var blobs = [];
|
||||||
|
var retrieveBlobs = function(marker, finished) {
|
||||||
|
// Generate the blob listing URL and request it from Azure
|
||||||
|
var url = 'https://gethstore.blob.core.windows.net/builds?restype=container&comp=list&maxresults=5000&prefix=geth-';
|
||||||
|
if (marker != "") {
|
||||||
|
url += "&marker=" + marker;
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'https://gethstore.blob.core.windows.net/builds?restype=container&comp=list',
|
url: url,
|
||||||
|
type: 'GET',
|
||||||
error: function() {
|
error: function() {
|
||||||
alert("Failed to load releases!");
|
alert("Failed to load releases!");
|
||||||
},
|
},
|
||||||
dataType: 'xml',
|
dataType: 'xml',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
// List of blobs retrieved, acumulate them first of all
|
||||||
|
Array.prototype.push.apply(blobs, $(data).find('Blob'));
|
||||||
|
|
||||||
|
// If there are more pages, load them all
|
||||||
|
marker = $($(data).find('NextMarker')[0]).text();
|
||||||
|
if (marker != "") {
|
||||||
|
retrieveBlobs(marker, finished);
|
||||||
|
} else {
|
||||||
|
finished(blobs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Start retrieving the release blobs and populate the page on success
|
||||||
|
retrieveBlobs("", function() {
|
||||||
// Define the release tables
|
// Define the release tables
|
||||||
var releases = {
|
var releases = {
|
||||||
stable: [],
|
stable: [],
|
||||||
|
@ -321,7 +345,6 @@
|
||||||
var signatures = {};
|
var signatures = {};
|
||||||
|
|
||||||
// Iterate over all the blobs and populate the tables
|
// Iterate over all the blobs and populate the tables
|
||||||
var blobs = $(data).find('Blob')
|
|
||||||
for (var i = 0; i < blobs.length; i++) {
|
for (var i = 0; i < blobs.length; i++) {
|
||||||
// Gather all available resources to later inspection
|
// Gather all available resources to later inspection
|
||||||
var name = $($(blobs[i]).find('Name')[0]).text();
|
var name = $($(blobs[i]).find('Name')[0]).text();
|
||||||
|
@ -332,12 +355,6 @@
|
||||||
signatures[name] = true;
|
signatures[name] = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip any blobs that do not start with "geth"
|
|
||||||
if (!name.startsWith("geth")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise add an entry to one of the release tables
|
// Otherwise add an entry to one of the release tables
|
||||||
var parts = name.split("-");
|
var parts = name.split("-");
|
||||||
var date = parts[parts.length-1].split(".")[0];
|
var date = parts[parts.length-1].split(".")[0];
|
||||||
|
@ -521,8 +538,6 @@
|
||||||
}
|
}
|
||||||
// Mark the request done to possibly hide the loading page
|
// Mark the request done to possibly hide the loading page
|
||||||
requestDone();
|
requestDone();
|
||||||
},
|
|
||||||
type: 'GET'
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue