From d272fc6dc78b05bd05bd1d20a709c563b7b5fdcf Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Wed, 1 Jun 2016 14:47:50 +0000
Subject: [PATCH] SSDM-3092 : Export functionality, working prototype

SVN: 36613
---
 .../eln-lims/html/js/views/SpaceForm/SpaceFormView.js     | 8 ++++++--
 .../1/dss/reporting-plugins/exports-api/exports-api.py    | 7 ++++---
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SpaceForm/SpaceFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SpaceForm/SpaceFormView.js
index c3cd26175bb..8f251dc9462 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SpaceForm/SpaceFormView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SpaceForm/SpaceFormView.js
@@ -40,8 +40,12 @@ function SpaceFormView(spaceFormController, spaceFormModel) {
 		var $export = FormUtil.getButtonWithIcon("glyphicon-export", function() {
 			Util.blockUI();
 			var facade = mainController.serverFacade;
-			facade.exportAll({ type: "SPACE", permId : _this._spaceFormModel.space.code }, facade.getUserId(), function(error, result) {
-				Util.showSuccess("Export is being processed, you will receibe an email when is ready.", function() { Util.unblockUI(); });
+			facade.exportAll({ type: "SPACE", permId : _this._spaceFormModel.space.code, expand : true }, facade.getUserId(), function(error, result) {
+				if(error) {
+					Util.showError(error);
+				} else {
+					Util.showSuccess("Export is being processed, you will receibe an email when is ready.", function() { Util.unblockUI(); });
+				}
 			});
 		});
 		
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py
index f88ac94bb6d..0adc64267c5 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py
@@ -73,7 +73,6 @@ def process(tr, params, tableBuilder):
 	
 	# Set user using the Dropbox
 	tr.setUserId(userId);
-	
 	if method == "exportAll":
 		isOk = exportAll(tr, params);
 
@@ -103,9 +102,11 @@ def exportAll(tr, params):
 	
 	entity = params.get("entity");
 	userEmail = params.get("userEmail");
-	entityAsPythonMap = { "type" : entity.get("type"), "permId" : entity.get("permId") };
+	entityAsPythonMap = { "type" : entity.get("type"), "permId" : entity.get("permId"), "expand" : entity.get("expand") };
 	entitiesToExport = [entityAsPythonMap];
-	entitiesToExpand = deque([entityAsPythonMap]);
+	entitiesToExpand = deque([]);
+	if entity.get("expand"):
+		entitiesToExpand.append(entityAsPythonMap);
 	
 	while entitiesToExpand:
 		entityToExpand = entitiesToExpand.popleft();
-- 
GitLab