Merge pull request #5351 from berendjan/download_multiple_files

tree added download multiple files
This commit is contained in:
Zachary Sailer 2020-05-15 10:15:32 -07:00 committed by GitHub
commit cbfc4dae91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -729,10 +729,9 @@ define([
$('.move-button').css('display', 'none'); $('.move-button').css('display', 'none');
} }
// Download is only visible when one item is selected, and it is not a // Download is only visible when items are selected, and none are
// running notebook or a directory // running notebooks or a directories
// TODO(nhdaly): Add support for download multiple items at once. if (selected.length > 0 && !has_running_notebook && !has_directory) {
if (selected.length === 1 && !has_running_notebook && !has_directory) {
$('.download-button').css('display', 'inline-block'); $('.download-button').css('display', 'inline-block');
} else { } else {
$('.download-button').css('display', 'none'); $('.download-button').css('display', 'none');
@ -1151,14 +1150,10 @@ define([
NotebookList.prototype.download_selected = function() { NotebookList.prototype.download_selected = function() {
var that = this; var that = this;
// TODO(nhdaly): Support download multiple items at once. that.selected.forEach(function(item) {
if (that.selected.length !== 1){ var item_path = utils.encode_uri_components(item.path);
return;
}
var item_path = that.selected[0].path;
window.open(utils.url_path_join(that.base_url, 'files', utils.encode_uri_components(item_path)) + '?download=1', IPython._target); window.open(utils.url_path_join(that.base_url, 'files', utils.encode_uri_components(item_path)) + '?download=1', IPython._target);
});
}; };
NotebookList.prototype.delete_selected = function() { NotebookList.prototype.delete_selected = function() {