Skip to content
Snippets Groups Projects
Commit b76b2ad9 authored by juanf's avatar juanf
Browse files

BIS-627 / SP-1141: ELN UI - Improve Workspace Uploader (Selective delete functionality)

SVN: 30578
parent b771ff02
No related branches found
No related tags found
No related merge requests found
......@@ -1483,9 +1483,12 @@ openbis.prototype.createSessionWorkspaceUploaderForDataStore = function(uploader
sessionID: $this.getSession()
};
for(var key in uploaderSettings) {
finalSettings[key] = uploaderSettings[key];
if(uploaderSettings) {
for(var key in uploaderSettings) {
finalSettings[key] = uploaderSettings[key];
}
}
Uploader.init(finalSettings);
});
});
......
......@@ -28,6 +28,7 @@ var Uploader = new function () {
file_input_button: "#fileinput-button",
//file_list_clear_button: "#filelist-clear-button",
oncomplete: function(file) { },
ondelete: function(file) {},
chunk_size: 100*1024,
smart_mode: window.File && window.FileReader && window.XMLHttpRequest,
main_title_container : "#session-workspace-uploader-main-title",
......@@ -258,6 +259,7 @@ var Uploader = new function () {
++current_upload_id;
$(settings.file_list)
.append("<li class=\"upload\" id=\"upload-" + id + "\">" +
"<span id='delete-" + id + "' style='font-size: 20px;'>X</span> " +
"<span id=\"progress-" + id + "\" class=\"progressbar-container\">" +
"<span id=\"progressbar-" + id + "\" class=\"progressbar\"></span>" +
"</span>" +
......@@ -266,6 +268,12 @@ var Uploader = new function () {
" (" + styleSize(file.size) + ", " +
"<span id=\"speed-" + id + "\">? KB/s</span>)" +
"</li>");
$("#delete-"+id).click(function() {
var fileData = file;
$( "#upload-"+id).remove();
settings.ondelete(fileData);
});
$("#upload-" + id).addClass("starting");
if (settings.smart_mode) {
$("#stop-button").clone().attr("id", "stop-button-" + id)
......@@ -433,4 +441,4 @@ var Uploader = new function () {
$(settings.main_title_container).append(settings.main_title);
$(settings.uploads_title_container).append(settings.uploads_title);
}
}
\ No newline at end of file
}
......@@ -113,9 +113,19 @@ function DataSetForm(serverFacade, containerId, profile, sample, mode) {
}
}
var onDelete = function(data) {
for(var i=0; localInstance.files.length; i++) {
if(localInstance.files[i] === data.name) {
localInstance.files.splice(i, 1);
break;
}
}
}
this.serverFacade.openbisServer.createSessionWorkspaceUploader($("#APIUploader"), onComplete, {
main_title : $('<legend>').text('Files Uploader'),
uploads_title : $('<legend>').text('File list')
uploads_title : $('<legend>').text('File list'),
ondelete:onDelete
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment