Refined conditional
@@ -91,6 +91,14 @@ function updateSelectionMenuContext() {
}
}
$("#fb-download-help").toggleClass("hidden", !flagDisableDownload);
+
+ // Multiple folder deletion is not allowed for composite resource
+ // to avoid race condition that can occur with logical file objects especially
+ // if a folder has many files
+ var foldersSelected = $("#fb-files-container li.fb-folder.ui-selected")
+ if(resourceType === 'Composite Resource' && foldersSelected.length > 1){
+ flagDisableDelete = true;
+ }
}
else if (selected.length == 1) { // Exactly one file selected
var size = parseInt(selected.find(".fb-file-size").attr("data-file-size"));
@@ -126,12 +134,6 @@ function updateSelectionMenuContext() {
flagDisableDownload = true;
flagDisableUnzip = true;
flagDisableGetLink = true;
- // Multiple folder deletion is not allowed for composite resource
- // to avoid race condition that can occur with logical file objects especially
- // if a folder has many files
- if(resourceType === 'Composite Resource' && selected.length > 1){
- flagDisableDelete = true;
- }
}
if (!sourcePaths.length) {
@@ -420,7 +422,7 @@ function bindFileBrowserItemEvents() {
function showFileTypeMetadata(){
var logical_file_id = $("#fb-files-container li.ui-selected").attr("data-logical-file-id");
- if (logical_file_id.length == 0){
+ if (logical_file_id && logical_file_id.length == 0){
return;
}
var logical_type = $("#fb-files-container li").children('span.fb-logical-file-type').attr("data-logical-file-type");
