From 1ab5179d68a68c33c89c66ccc125c4b6d0fc44f5 Mon Sep 17 00:00:00 2001 From: felmer <franz-josef.elmer@id.ethz.ch> Date: Tue, 19 Nov 2019 11:28:47 +0100 Subject: [PATCH] SSDM-8929: ELN: Warning popup if single unarchiving will unarchive additional data sets --- .../eln-lims/html/js/server/ServerFacade.js | 17 ++++++++++++----- .../views/DataSetForm/DataSetFormController.js | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js index d6274e6a0e0..45c27d4ea9c 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js @@ -477,14 +477,21 @@ function ServerFacade(openbisServer) { }; // - // Gets submission types + // Gets archiving info for specified data set codes // - this.listSubmissionTypes = function(callbackFunction) { + this.getArchivingInfo = function(dataSets, callbackFunction) { this.customELNApi({ - "method" : "getSubmissionTypes", - }, callbackFunction, "rc-exports-api"); + "method" : "getArchivingInfo", + "args" : dataSets.join(","), + }, function(error, result) { + if (error) { + Util.showError(error); + } else { + callbackFunction(result.data); + } + }, "archiving-api"); }; - + // // Metadata Related Functions // diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormController.js index 9200b7d98ee..50cc7345502 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormController.js @@ -266,6 +266,24 @@ function DataSetFormController(parentController, mode, entity, dataSet, isMini, this.unarchive = function() { var _this = this; var dataSetPermId = this._dataSetFormModel.dataSetV3.permId.permId; + mainController.serverFacade.getArchivingInfo([dataSetPermId], function(info) { + var containerSize = info[dataSetPermId]["container"].length; + if (containerSize > 1) { + var warning = "Unarchiving this data set leads to unarchiving of additional " + + (containerSize - 1) + " data sets. All these data sets need " + + (info["total size"]/1e9).toFixed(1) + " GB memory.\n Do you want to unarchive this data set anyway?"; + Util.showWarning(warning, function() { + _this.forceUnarchiving(dataSetPermId) + }); + } else { + _this.forceUnarchiving(dataSetPermId); + } + + }); + } + + this.forceUnarchiving = function(dataSetPermId) { + var _this = this; Util.blockUI(); mainController.serverFacade.unarchiveDataSet(dataSetPermId, function() { _this._reloadView(); -- GitLab