1
0
Fork 0

Centralize downloading

This commit is contained in:
Andreas Streichardt 2016-06-14 10:11:37 +02:00
parent 53834c3be6
commit b82290cc13
7 changed files with 34 additions and 41 deletions

File diff suppressed because one or more lines are too long

View File

@ -3040,6 +3040,10 @@ if (list.length > 0) {
<div class="pure-g pure-table pure-table-body">
<div class="pure-table-row" collection="<%= collectionName %>" shard="<%= name %>" leader="<%= shard.leader%>">
<% if (name.substring(0,1) === '_') { %>
<% name = name.slice(1) %>
<% } %>
<div class="<%= genClass %> left"><%= name %></div>
<% if (name === Object.keys(collection.Current)[counter]) { %>
@ -3511,4 +3515,4 @@ var cutByResolution = function (str) {
</div>
<div id="workMonitorContent" class="innerContent">
</div></script></head><body><nav class="navbar" style="display: none"><div class="primary"><div class="navlogo"><a class="logo big" href="#"><img class="arangodbLogo" src="img/arangodb_logo_big.png"></a> <a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a> <a class="version"><span>VERSION:</span><span id="currentVersion"></span></a></div><div class="statmenu" id="statisticBar"></div><div class="navmenu" id="navigationBar"></div></div></nav><div id="modalPlaceholder"></div><div class="bodyWrapper" style="display: none"><div class="centralRow"><div id="navbar2" class="navbarWrapper secondary"><div class="subnavmenu" id="subNavigationBar"></div></div><div class="resizecontainer contentWrapper"><div id="loadingScreen" class="loadingScreen" style="display: none"><i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw margin-bottom"></i> <span class="sr-only">Loading...</span></div><div id="content" class="centralContent"></div><footer class="footer"><div id="footerBar"></div></footer></div></div></div><div id="progressPlaceholder" style="display:none"></div><div id="spotlightPlaceholder" style="display:none"></div><div id="offlinePlaceholder" style="display:none"><div class="offline-div"><div class="pure-u"><div class="pure-u-1-4"></div><div class="pure-u-1-2 offline-window"><div class="offline-header"><h3>You have been disconnected from the server</h3></div><div class="offline-body"><p>The connection to the server has been lost. The server may be under heavy load.</p><p>Trying to reconnect in <span id="offlineSeconds">10</span> seconds.</p><p class="animation_state"><span><button class="button-success">Reconnect now</button></span></p></div></div><div class="pure-u-1-4"></div></div></div></div><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="libs.js?version=1465855187794"></script><script src="app.js?version=1465855187794"></script></body></html>
</div></script></head><body><nav class="navbar" style="display: none"><div class="primary"><div class="navlogo"><a class="logo big" href="#"><img class="arangodbLogo" src="img/arangodb_logo_big.png"></a> <a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a> <a class="version"><span>VERSION:</span><span id="currentVersion"></span></a></div><div class="statmenu" id="statisticBar"></div><div class="navmenu" id="navigationBar"></div></div></nav><div id="modalPlaceholder"></div><div class="bodyWrapper" style="display: none"><div class="centralRow"><div id="navbar2" class="navbarWrapper secondary"><div class="subnavmenu" id="subNavigationBar"></div></div><div class="resizecontainer contentWrapper"><div id="loadingScreen" class="loadingScreen" style="display: none"><i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw margin-bottom"></i> <span class="sr-only">Loading...</span></div><div id="content" class="centralContent"></div><footer class="footer"><div id="footerBar"></div></footer></div></div></div><div id="progressPlaceholder" style="display:none"></div><div id="spotlightPlaceholder" style="display:none"></div><div id="offlinePlaceholder" style="display:none"><div class="offline-div"><div class="pure-u"><div class="pure-u-1-4"></div><div class="pure-u-1-2 offline-window"><div class="offline-header"><h3>You have been disconnected from the server</h3></div><div class="offline-body"><p>The connection to the server has been lost. The server may be under heavy load.</p><p>Trying to reconnect in <span id="offlineSeconds">10</span> seconds.</p><p class="animation_state"><span><button class="button-success">Reconnect now</button></span></p></div></div><div class="pure-u-1-4"></div></div></div></div><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="libs.js?version=1465891326472"></script><script src="app.js?version=1465891326472"></script></body></html>

View File

@ -768,7 +768,22 @@
}
}
return this.backendUrl("/_db/" + encodeURIComponent(databaseName) + url);
},
download: function(url) {
$.ajax(url)
.success(function(result, dummy, request) {
var blob = new Blob([JSON.stringify(result)], {type: request.getResponseHeader("Content-Type") || "application/octet-stream"});
var blobUrl = window.URL.createObjectURL(blob);
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
a.href = blobUrl;
a.download = request.getResponseHeader("Content-Disposition").replace(/.* filename="([^")]*)"/, "$1");
a.click();
window.URL.revokeObjectURL(blobUrl);
document.body.removeChild(a);
});
}
};
}());

View File

@ -146,9 +146,7 @@
},
download: function () {
window.open(
arangoHelper.databaseUrl("/_admin/aardvark/foxxes/download/zip?mount=" + this.encodedMount())
);
arangoHelper.download(arangoHelper.databaseUrl("/_admin/aardvark/foxxes/download/zip?mount=" + this.encodedMount()));
},
fetchThumbnail: function(cb) {

View File

@ -207,19 +207,7 @@
name = "root";
}
var url = "query/download/" + encodeURIComponent(name);
$.ajax(url)
.success(function(result, dummy, request) {
var blob = new Blob([JSON.stringify(result)], {type: "application/octet-stream"});
var blobUrl = window.URL.createObjectURL(blob);
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
a.href = blobUrl;
a.download = request.getResponseHeader("Content-Disposition").replace(/.* filename="([^")]*)"/, "$1");
a.click();
window.URL.revokeObjectURL(blobUrl);
document.body.removeChild(a);
});
arangoHelper.download(url);
});
},
@ -407,19 +395,7 @@
bindVars: this.bindParamTableObj
})));
}
$.ajax(url)
.success(function(result, dummy, request) {
var blob = new Blob([JSON.stringify(result)], {type: "application/octet-stream"});
var blobUrl = window.URL.createObjectURL(blob);
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
a.href = blobUrl;
a.download = request.getResponseHeader("Content-Disposition").replace(/.* filename="([^")]*)"/, "$1");
a.click();
window.URL.revokeObjectURL(blobUrl);
document.body.removeChild(a);
});
arangoHelper.download(url);
}
else {
arangoHelper.arangoError("Query error", "could not query result.");