Skip to content
Snippets Groups Projects
Commit 0e1cc7fc authored by vkovtun's avatar vkovtun
Browse files

SSDM-8405 Added UI verification for the cases when the API would produce an empty export file.

parent 0efbb52c
No related branches found
No related tags found
No related merge requests found
...@@ -56,6 +56,8 @@ function ResearchCollectionExportController(parentController) { ...@@ -56,6 +56,8 @@ function ResearchCollectionExportController(parentController) {
if (toExport.length === 0) { if (toExport.length === 0) {
Util.showInfo('First select something to export.'); Util.showInfo('First select something to export.');
} else if (!this.isValid(toExport)) {
Util.showInfo('Not only spaces and the root should be selected. It will result in an empty export file.');
} else if (!submissionUrl) { } else if (!submissionUrl) {
Util.showInfo('First select submission type.'); Util.showInfo('First select submission type.');
} else { } else {
...@@ -82,6 +84,16 @@ function ResearchCollectionExportController(parentController) { ...@@ -82,6 +84,16 @@ function ResearchCollectionExportController(parentController) {
} }
}; };
this.isValid = function(toExport) {
for (var i = 0; i < toExport.length; i++) {
var value = toExport[i];
if (value.type !== 'ROOT' && value.type !== 'SPACE' || value.expand) {
return true;
}
}
return false;
};
this.waitForOpExecutionResponse = function(operationExecutionPermIdString, callbackFunction) { this.waitForOpExecutionResponse = function(operationExecutionPermIdString, callbackFunction) {
var _this = this; var _this = this;
require(["as/dto/operation/id/OperationExecutionPermId", require(["as/dto/operation/id/OperationExecutionPermId",
......
...@@ -34,6 +34,8 @@ function ZenodoExportController(parentController) { ...@@ -34,6 +34,8 @@ function ZenodoExportController(parentController) {
if (toExport.length === 0) { if (toExport.length === 0) {
Util.showInfo('First select something to export.'); Util.showInfo('First select something to export.');
} else if (!this.isValid(toExport)) {
Util.showInfo('Not only spaces and the root should be selected. It will result in an empty export file.');
} else { } else {
Util.blockUI(); Util.blockUI();
this.getUserInformation(function(userInformation) { this.getUserInformation(function(userInformation) {
...@@ -58,6 +60,16 @@ function ZenodoExportController(parentController) { ...@@ -58,6 +60,16 @@ function ZenodoExportController(parentController) {
} }
}; };
this.isValid = function(toExport) {
for (var i = 0; i < toExport.length; i++) {
var value = toExport[i];
if (value.type !== 'ROOT' && value.type !== 'SPACE' || value.expand) {
return true;
}
}
return false;
};
this.waitForOpExecutionResponse = function(operationExecutionPermIdString, callbackFunction) { this.waitForOpExecutionResponse = function(operationExecutionPermIdString, callbackFunction) {
var _this = this; var _this = this;
require(['as/dto/operation/id/OperationExecutionPermId', require(['as/dto/operation/id/OperationExecutionPermId',
......
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