From c8ff9969aa183171a5ac12bb2bfaa86d8b754f2d Mon Sep 17 00:00:00 2001
From: pkupczyk <piotr.kupczyk@id.ethz.ch>
Date: Wed, 9 Nov 2022 18:21:09 +0100
Subject: [PATCH] SSDM-13152 : Exports for master data and metadata UI - update
 ELN grids export configs

---
 .../eln-lims/html/js/config/StandardProfile.js  |  5 ++++-
 .../html/js/controllers/MainController.js       | 15 ++++++++++++---
 .../views/AdvancedSearch/AdvancedSearchView.js  |  5 ++++-
 .../js/views/DataGrid/DataGridController.js     | 17 +++++++----------
 .../js/views/DataGrid/ExperimentDataGridUtil.js |  5 ++++-
 .../js/views/DataGrid/SampleDataGridUtil.js     |  5 ++++-
 .../views/HierarchyTable/HierarchyTableView.js  |  5 ++++-
 .../html/js/views/History/HistoryView.js        |  5 ++++-
 .../views/SampleForm/widgets/StorageListView.js |  5 ++++-
 .../js/views/TrashManager/TrashManagerView.js   |  5 ++++-
 .../js/views/UserManager/UserManagerView.js     |  5 ++++-
 .../VocabularyManager/VocabularyManagerView.js  | 10 ++++++++--
 .../html/plugins/bbb-hub/snakemake-table.js     |  5 ++++-
 13 files changed, 67 insertions(+), 25 deletions(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js
index d676f925817..832ad5f191d 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js
@@ -412,7 +412,10 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, {
 							repTitle += " (as saved when ordered)"
 						}
 						
-						var orderSummary = new DataGridController(repTitle, columns, [], null, getDataRows, null, false, "ORDER_SUMMARY", false, false, 30);
+						var orderSummary = new DataGridController(repTitle, columns, [], null, getDataRows, null, false, "ORDER_SUMMARY", false, {
+							fileFormat: 'XLS',
+							filePrefix: 'order-summary'
+						}, 30);
 						orderSummary.init(orderSummaryContainer);
 						
 						var totalsByCurrencyContainer = $("<div>").append($("<br>")).append($("<legend>").append("Total:"));
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js
index c177e7d734a..be423edc570 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js
@@ -1542,7 +1542,10 @@ function MainController(profile) {
 									}
 								}
 								
-								var dataGrid = new DataGridController(searchDomainLabel + " Search Results", columns, [], null, getDataList, rowClick, true, "SEARCH_" + searchDomainLabel, false, false, 90);
+								var dataGrid = new DataGridController(searchDomainLabel + " Search Results", columns, [], null, getDataList, rowClick, true, "SEARCH_" + searchDomainLabel, false, {
+									fileFormat: 'TSV',
+									filePrefix: 'search-' + searchDomainLabel
+								}, 90);
 								localReference.currentView = dataGrid;
 								var content = localReference._getBackwardsCompatibleMainContainer();
 								dataGrid.init(content);
@@ -1670,7 +1673,10 @@ function MainController(profile) {
 										}
 									}
 									
-									var dataGrid = new DataGridController(searchDomainLabel + " Search Results", columns, [], null, getDataList, rowClick, true, "SEARCH_" + searchDomainLabel, false, false, 90);
+									var dataGrid = new DataGridController(searchDomainLabel + " Search Results", columns, [], null, getDataList, rowClick, true, "SEARCH_" + searchDomainLabel, false, {
+										fileFormat: 'TSV',
+										filePrefix: 'search-' + searchDomainLabel
+									}, 90);
 									localReference.currentView = dataGrid;
 									var content = localReference._getBackwardsCompatibleMainContainer();
 									dataGrid.init(content);
@@ -1843,7 +1849,10 @@ function MainController(profile) {
 				mainController.changeView('showViewSamplePageFromPermId', e.data.permId);
 			}
 			
-			var dataGrid = new DataGridController("Search Results", columns, [], null, getDataList, rowClick, true, "SEARCH_OPENBIS", false, false, 90);
+			var dataGrid = new DataGridController("Search Results", columns, [], null, getDataList, rowClick, true, "SEARCH_OPENBIS", false, {
+				fileFormat: 'TSV',
+				filePrefix: 'search'
+			}, 90);
 			localReference.currentView = dataGrid;
 			var content = localReference._getBackwardsCompatibleMainContainer();
 			dataGrid.init(content);
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js
index 3855177276d..e5173938364 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js
@@ -1292,7 +1292,10 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) {
 
             var filterModes = isGlobalSearch ? [] : null
 			var getDataRows = this._advancedSearchController.searchWithPagination(criteria, isGlobalSearch);
-			var dataGrid = new DataGridController(this.resultsTitle, this._filterColumns(columns), columnsLast, dynamicColumnsFunc, getDataRows, null, false, this.configKeyPrefix + this._advancedSearchModel.criteria.entityKind, isMultiselectable, false, 70, filterModes);
+			var dataGrid = new DataGridController(this.resultsTitle, this._filterColumns(columns), columnsLast, dynamicColumnsFunc, getDataRows, null, false, this.configKeyPrefix + this._advancedSearchModel.criteria.entityKind, isMultiselectable, {
+				fileFormat: 'TSV',
+				filePrefix: 'advanced-search'
+			}, 70, filterModes);
 			return dataGrid;
 	}
 
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js
index 445504a8756..76204d03172 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js
@@ -23,8 +23,8 @@ function DataGridController(
     rowClickEventHandler,
     showAllColumns,
     configKey,
-    isMultiselectable,
-    isExportable,
+    multiselectable,
+    exportable,
     heightPercentage,
     filterModes
 ) {
@@ -74,11 +74,10 @@ function DataGridController(
                     loadRows: _this._loadRows,
                     onSettingsChange: _this._onSettingsChange,
                     onRowClick: rowClickEventHandler,
-                    exportable: isExportable,
-                    scheduleExport: _this._scheduleExport,
-                    loadExported: _this._loadExported,
+                    exportable: exportable,
+                    onExportXLS: _this._onExportXLS,
                     selectable: false,
-                    multiselectable: isMultiselectable,
+                    multiselectable: multiselectable,
                     actions: _this._actions(extraOptions),
                 })
             )
@@ -279,10 +278,10 @@ function DataGridController(
         mainController.serverFacade.setSetting(configKey, elnGridSettingsStr)
     }
 
-	this._scheduleExport = function (parameters) {
+	this._onExportXLS = function (parameters) {
 		let serviceParameters = {
 			"method" : "export",
-			"file_name" : "test",
+			"file_name" : parameters.exportedFilePrefix,
 			"ids" : parameters.exportedIds,
 			"export_referred" : true,
 			"export_properties" : parameters.exportedProperties,
@@ -308,8 +307,6 @@ function DataGridController(
 		}, true);
 	}
 
-    this._loadExported = function () {}
-
     this.refresh = function () {
         if (_this.controller) {
             _this.controller.load()
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/ExperimentDataGridUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/ExperimentDataGridUtil.js
index e352201072e..94a1dd029d9 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/ExperimentDataGridUtil.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/ExperimentDataGridUtil.js
@@ -166,7 +166,10 @@ var ExperimentDataGridUtil = new function() {
 			
 		//Create and return a data grid controller
         var configKey = "EXPERIMENT_TABLE";
-        var dataGridController = new DataGridController(null, columns, [], dynamicColumnsFunc, getDataList, rowClick, false, configKey, null, true, heightPercentage);
+        var dataGridController = new DataGridController(null, columns, [], dynamicColumnsFunc, getDataList, rowClick, false, configKey, null, {
+            fileFormat: 'XLS',
+            filePrefix: 'collections'
+        }, heightPercentage);
 		dataGridController.setId("experiment-grid")
 		return dataGridController;
 	}
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js
index dbe49a7031a..c4a7d8de55f 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js
@@ -350,7 +350,10 @@ var SampleDataGridUtil = new function() {
 			configKey += "_" + optionalConfigPostKey;
 		}
 		
-		var dataGridController = new DataGridController(null, columnsFirst, columnsLast, dynamicColumnsFunc, getDataList, rowClick, false, configKey, isMultiselectable, true, heightPercentage);
+		var dataGridController = new DataGridController(null, columnsFirst, columnsLast, dynamicColumnsFunc, getDataList, rowClick, false, configKey, isMultiselectable, {
+			fileFormat: 'XLS',
+			filePrefix: 'objects'
+		}, heightPercentage);
 		dataGridController.setId("sample-grid")
 		return dataGridController;
 	}
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/HierarchyTable/HierarchyTableView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/HierarchyTable/HierarchyTableView.js
index 9f803fa6aa3..4e2323dcf40 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/HierarchyTable/HierarchyTableView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/HierarchyTable/HierarchyTableView.js
@@ -166,7 +166,10 @@ function HierarchyTableView(controller, model) {
 			callback(filteredData);
 		}
 		
-		this._dataGrid = new DataGridController(null, columns, [], null, getDataList, null, false, this._model.entity["@type"] + "_HIERARCHY_TABLE", false, false, 90);
+		this._dataGrid = new DataGridController(null, columns, [], null, getDataList, null, false, this._model.entity["@type"] + "_HIERARCHY_TABLE", false, {
+			fileFormat: 'TSV',
+			filePrefix: 'hierarchy'
+		}, 90);
 		this._dataGrid.init(this._container);
 		this._container.prepend($("<legend>").append(" " + ELNDictionary.Sample + " Hierarchy"));
 	}
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/History/HistoryView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/History/HistoryView.js
index 44c6b9d2886..947898b2f95 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/History/HistoryView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/History/HistoryView.js
@@ -119,7 +119,10 @@ function HistoryView(controller, model) {
             null,
             false,
             this._model.entity["@type"] + "_HISTORY",
-            false,
+            {
+                fileFormat: 'TSV',
+                filePrefix: 'history'
+            },
             false
         )
 
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/StorageListView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/StorageListView.js
index 364e676d1d2..9772f292853 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/StorageListView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/StorageListView.js
@@ -145,7 +145,10 @@ function StorageListView(storageListController, storageListModel) {
 			}});
 		}
 
-		this._dataGrid = new DataGridController(null, columns, [], null, getDataList, rowClick, false, "STORAGE_WIDGET", isMultiselectable, false, 60);
+		this._dataGrid = new DataGridController(null, columns, [], null, getDataList, rowClick, false, "STORAGE_WIDGET", isMultiselectable, {
+			fileFormat: 'TSV',
+			filePrefix: 'storage'
+		}, 60);
 
 		var $dataGridContainer = $("<div>");
 		this._dataGrid.init($dataGridContainer, extraOptions);
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerView.js
index a818988bf82..3397db3a536 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/TrashManager/TrashManagerView.js
@@ -209,7 +209,10 @@ function TrashManagerView(trashManagerController, trashManagerModel) {
 		}
 		
 		var dataGridContainer = $("<div>").css("margin-top", "-10px").css("margin-left", "-10px");
-		var dataGrid = new DataGridController(null, columns, [], null, getDataList, null, true, "TRASHCAN_TABLE", false, false, 90);
+		var dataGrid = new DataGridController(null, columns, [], null, getDataList, null, true, "TRASHCAN_TABLE", false, {
+			fileFormat: 'TSV',
+			filePrefix: 'trashcan'
+		}, 90);
 		dataGrid.init(dataGridContainer);
 		$containerColumn.append(dataGridContainer);
 	}
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserManager/UserManagerView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserManager/UserManagerView.js
index 27c82ab7559..04a3e9ab2fd 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserManager/UserManagerView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserManager/UserManagerView.js
@@ -124,7 +124,10 @@ function UserManagerView(userManagerController, userManagerModel) {
 			callback(dataList);
 		}
 		
-		var dataGrid = new DataGridController(null, columns, [], null, getDataList, null, false, "USER_MANAGER_TABLE", false, false, 90);
+		var dataGrid = new DataGridController(null, columns, [], null, getDataList, null, false, "USER_MANAGER_TABLE", false, {
+			fileFormat: 'TSV',
+			filePrefix: 'users'
+		}, 90);
 		dataGrid.setId("user-grid")
 		dataGrid.init(dataGridContainer);
 		
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/VocabularyManager/VocabularyManagerView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/VocabularyManager/VocabularyManagerView.js
index a42c417fc55..a273ba3afd7 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/VocabularyManager/VocabularyManagerView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/VocabularyManager/VocabularyManagerView.js
@@ -83,7 +83,10 @@ function VocabularyManagerView(vocabularyManagerController, vocabularyManagerMod
 			_this._showVocabulary(e.data.object)
 		}
 		
-		var dataGrid = new DataGridController(null, columns, [], null, getDataList, rowClick, true, "VOCABULARY_TABLE", false, true, 90);
+		var dataGrid = new DataGridController(null, columns, [], null, getDataList, rowClick, true, "VOCABULARY_TABLE", false, {
+			fileFormat: 'XLS',
+			filePrefix: 'vocabularies'
+		}, 90);
 		dataGrid.setId("vocabulary-grid")
 		dataGrid.init(this._dataGridContainer);
 		
@@ -125,7 +128,10 @@ function VocabularyManagerView(vocabularyManagerController, vocabularyManagerMod
 			callback(dataList);
 		}
 		
-		var dataGrid = new DataGridController(null, columns, [], null, getDataList, null, true, "VOCABULARY_TERMS_TABLE", false, false, 90);
+		var dataGrid = new DataGridController(null, columns, [], null, getDataList, null, true, "VOCABULARY_TERMS_TABLE", false, {
+			fileFormat: 'TSV',
+			filePrefix: 'vocabulary-terms-grid'
+		}, 90);
 		dataGrid.setId("vocabulary-terms-table")
 		dataGrid.init(this._dataGridContainer);
 		
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/snakemake-table.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/snakemake-table.js
index 3593dd1780c..bf424f4bf92 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/snakemake-table.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/snakemake-table.js
@@ -70,7 +70,10 @@ var SnakemakeTable = new function() {
             callback(dataList);
         };
 
-        var dataGridController = new DataGridController(null, columns, [], null, getDataList, null, true, "ENTITY_TABLE_BBB", null, false, 90);
+        var dataGridController = new DataGridController(null, columns, [], null, getDataList, null, true, "ENTITY_TABLE_BBB", null, {
+            fileFormat: 'TSV',
+            filePrefix: 'entities'
+        }, 90);
         dataGridController.init(container);
     }
 
-- 
GitLab