From 0e1cc7fcf90f61477485916096bd0c19afd63f4d Mon Sep 17 00:00:00 2001 From: Viktor Kovtun <viktor.kovtun@id.ethz.ch> Date: Mon, 19 Aug 2019 14:43:36 +0200 Subject: [PATCH] SSDM-8405 Added UI verification for the cases when the API would produce an empty export file. --- .../ResearchCollectionExportController.js | 12 ++++++++++++ .../js/views/ZenodoExport/ZenodoExportController.js | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ResearchCollectionExport/ResearchCollectionExportController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ResearchCollectionExport/ResearchCollectionExportController.js index 3e0e4e18b8e..df2a9b1fce2 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ResearchCollectionExport/ResearchCollectionExportController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ResearchCollectionExport/ResearchCollectionExportController.js @@ -56,6 +56,8 @@ function ResearchCollectionExportController(parentController) { if (toExport.length === 0) { 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) { Util.showInfo('First select submission type.'); } else { @@ -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) { var _this = this; require(["as/dto/operation/id/OperationExecutionPermId", diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ZenodoExport/ZenodoExportController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ZenodoExport/ZenodoExportController.js index 99e24671fe9..e52004a77bc 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ZenodoExport/ZenodoExportController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ZenodoExport/ZenodoExportController.js @@ -34,6 +34,8 @@ function ZenodoExportController(parentController) { if (toExport.length === 0) { 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 { Util.blockUI(); this.getUserInformation(function(userInformation) { @@ -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) { var _this = this; require(['as/dto/operation/id/OperationExecutionPermId', -- GitLab