From 9f218acb63dad9ab24c4fcb23dc675edfb3d8afe Mon Sep 17 00:00:00 2001
From: alaskowski <alaskowski@ethz.ch>
Date: Wed, 20 Sep 2023 16:50:10 +0200
Subject: [PATCH] SSDM-55: listPropertyTypesV3 method to ServerFacade, usage of
 the new method in Profile to download a full list of propertyTypes

---
 .../1/as/webapps/eln-lims/html/js/config/Profile.js  |  5 ++---
 .../webapps/eln-lims/html/js/server/ServerFacade.js  | 12 ++++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js
index 8f6923cafb9..de92a2ae70c 100644
--- a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js
+++ b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js
@@ -1129,9 +1129,8 @@ $.extend(DefaultProfile.prototype, {
 
 		this.initPropertyTypes = function(callback) {
 			var _this = this;
-			this.serverFacade.listPropertyTypes(function(data) {
-				_this.allPropertyTypes = data.result;
-
+			this.serverFacade.listPropertyTypesV3(function(data) {
+				_this.allPropertyTypes = data;
 				_this.serverFacade.listVocabularies(function(result) {
 					//Init Vocabularies, so we don't miss vocabularies missing on sample types used only on annotations, etc...
 					_this.allVocabularies = result.result;
diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js
index 52342ad2d74..9c185c247f7 100644
--- a/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js
+++ b/ui-eln-lims/src/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js
@@ -826,6 +826,18 @@ function ServerFacade(openbisServer) {
 		}
 	}
 
+	this.listPropertyTypesV3 = function(doneCallback) {
+            require([ "openbis", "as/dto/property/search/PropertyTypeSearchCriteria", "as/dto/property/fetchoptions/PropertyTypeFetchOptions" ],
+            function(openbis, PropertyTypeSearchCriteria, PropertyTypeFetchOptions) {
+                var ptsc = new PropertyTypeSearchCriteria();
+                var ptfo = new PropertyTypeFetchOptions();
+                ptfo.withVocabulary();
+                mainController.openbisV3.searchPropertyTypes(ptsc, ptfo).done(function(searchResult) {
+                    doneCallback(searchResult.objects);
+                });
+            });
+        }
+
 
 	this.generateCode = function(sampleType, action) {
 	    if(IdentifierUtil.createContinuousSampleCodes) {
-- 
GitLab