From c91fe46dbec6878ff9eec2c9794eca9c41dd5306 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Mon, 12 Jun 2017 12:39:25 +0000
Subject: [PATCH] SSDM-5079 : Show owner of the position on the grid

SVN: 38327
---
 .../1/as/webapps/eln-lims/html/css/style.css  | 94 +++++++++++++++++++
 .../eln-lims/html/js/server/ServerFacade.js   |  3 +-
 .../eln-lims/html/js/util/PrintUtil.js        | 25 ++---
 .../as/webapps/eln-lims/html/js/util/Util.js  |  7 ++
 .../views/StorageManager/widgets/GridView.js  | 27 +++++-
 .../StorageManager/widgets/StorageView.js     |  2 +-
 6 files changed, 140 insertions(+), 18 deletions(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css
index 6cb795d003f..c67fef219c8 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css
@@ -367,6 +367,100 @@ body,
 	border : none;
 }
 
+/*
+ * Inspector
+ */
+.inspectorsContainer {
+	width:100%;
+	margin-top: 20px;
+	margin-left: 20px;
+}
+
+.inspectorsContainer div {
+	float:left;
+}
+
+.inspectorLabel {
+	white-space: nowrap;
+}
+.inspectorLineBreak {
+	word-wrap: break-word;
+	overflow: hidden;
+	overflow-x: auto;
+	width:300px;
+}
+
+div.inspectorWhiteFont {
+	color: white !important;	
+}
+
+div.inspector {
+	width: 500px;
+	text-decoration: none;
+	color: #000;
+	display: block;
+	overflow: hidden;
+	padding: 20px;
+	border-radius: 10px;
+}
+
+div.inspector > .table th,
+div.inspector > .table td {
+	border-top: none;
+	line-height: 12px;
+}
+
+.inspectorExtra {
+	margin-left: 0px !important;
+}
+
+.inspectorExtra svg {
+	margin-left: auto;
+	margin-right: auto;
+}
+
+.property {
+  font-size: 12px;
+  font-weight: normal;
+}
+
+.properties {
+  padding-top:10px;
+  width: 100%;	
+}
+
+.properties td:nth-child(odd) {
+  /* background-color:#DDDDDD; */
+  width:25%;
+}
+
+.properties td:nth-child(even) {
+  /* background-color:#fbfbfb; */
+  width:75%;
+}
+
+.inspectorToolbar {
+opacity: 0.5;
+}
+
+.inspectorToolbar:hover {
+opacity: 0.8;
+}
+
+.downloads {
+	color: black;
+	background-color:#DDDDDD;;
+}
+
+table.downloads {
+  font-family: "Trebuchet MS", sans-serif;
+	font-size: 14px;
+	table-layout: fixed;
+	border-collapse: collapse;
+	margin: 0px;
+	padding: 0px;
+}
+
 /* 
  * Inspector - Glow Effect
  */
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 6d13a7cefda..69d69c262bb 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
@@ -1455,7 +1455,7 @@ function ServerFacade(openbisServer) {
 		}, callbackFunction);
 	}
 	
-	this.searchWithProperties = function(propertyTypeCodes, propertyValues, callbackFunction, isComplete)
+	this.searchWithProperties = function(propertyTypeCodes, propertyValues, callbackFunction, isComplete, withParents)
 	{	
 		var properyKeyValueList = [];
 	
@@ -1472,6 +1472,7 @@ function ServerFacade(openbisServer) {
 			"withProperties" : true,
 			"withAncestors" : isComplete,
 			"withDescendants" : isComplete,
+			"withParents" : withParents,
 			"properyKeyValueList" : properyKeyValueList
 		}, callbackFunction);
 	}
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js
index a7a899fd6d7..153c16748c6 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js
@@ -69,24 +69,25 @@ var PrintUtil = new function() {
 		if(customClass) {
 			$newInspector.addClass(customClass);
 		}
-			
+		
 		if(optionalTitle) {
 			$newInspector.append(optionalTitle);
 		} else {
 			var nameLabel = entity.properties[profile.propertyReplacingCode];
 			if(!nameLabel) {
-				if(entity.sampleTypeCode) {
-					var href = Util.getURLFor(mainController.sideMenu.getCurrentNodeId(), "showViewSamplePageFromPermId", entity.permId);
-					var codeLink = $("<a>", { "href" : href, "class" : "browser-compatible-javascript-link" }).append(entity.code);
-					codeLink.click(function() {
-						mainController.changeView("showViewSamplePageFromPermId", entity.permId);
-					});
-					nameLabel = codeLink;
-				} else {
-					nameLabel = entity.code;
-				}
+				nameLabel = entity.code;
+			}
+			
+			if(entity.sampleTypeCode) {
+				var href = Util.getURLFor(mainController.sideMenu.getCurrentNodeId(), "showViewSamplePageFromPermId", entity.permId);
+				var codeLink = $("<a>", { "href" : href, "class" : "browser-compatible-javascript-link" }).append(nameLabel);
+				codeLink.click(function() {
+					mainController.changeView("showViewSamplePageFromPermId", entity.permId);
+				});
+				$newInspector.append($("<strong>").append(codeLink));
+			} else {
+				$newInspector.append($("<strong>").append(nameLabel));
 			}
-			$newInspector.append($("<strong>").append(nameLabel));
 		}
 		
 		var $newInspectorTable = $("<table>", { "class" : "properties table table-condensed" });
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js
index ddb8af3fbee..98ed8d37458 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js
@@ -637,6 +637,13 @@ var Util = new function() {
 		saveAs(blob, fileName);
 	}
 	
+	this.mergeObj = function(obj1, obj2) {
+        var obj3 = {};
+        for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }
+        for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }
+        return obj3;
+    };
+    
 	//
 	// Components Resize events
 	//
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js
index 0bf296131b2..ec722d58c40 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js
@@ -125,11 +125,30 @@ function GridView(gridModel) {
 		if(labels) {
 			for(var i = 0; i < labels.length; i++) {
 				if(!usedLabels[labels[i].displayName]) {
-					var labelContainer = $("<div>", { class: "storageBox", id : Util.guid() }).append(labels[i].displayName);
+					var sample = null;
 					if (labels[i].data && labels[i].data["@type"] && labels[i].data["@type"] === "Sample") {
-						var sample = labels[i].data;
-						var tooltip = PrintUtil.getTable(sample, false, null, 'inspectorWhiteFont',
-								'colorEncodedWellAnnotations-holder-' + sample.permId);
+						sample = jQuery.extend(true, {}, labels[i].data);
+					}
+					
+					if(sample && sample.sampleTypeCode === "STORAGE_POSITION") {
+						if(sample.parents && sample.parents[0]) {
+							if(profile.propertyReplacingCode &&  sample.parents[0].properties &&  sample.parents[0].properties[profile.propertyReplacingCode]) {
+								// Label
+								labels[i].displayName = sample.parents[0].properties[profile.propertyReplacingCode];
+								// Tooltip, show also information from the parent
+								sample.properties[profile.propertyReplacingCode] = sample.parents[0].properties[profile.propertyReplacingCode];
+							} else {
+								//Label
+								labels[i].displayName = sample.parents[0].code;
+								//Tooltip, show also information from the parent
+								sample.code = sample.parents[0].code;
+							}
+						}
+					}
+					
+					var labelContainer = $("<div>", { class: "storageBox", id : Util.guid() }).append(labels[i].displayName);
+					if (sample) {
+						var tooltip = PrintUtil.getTable(sample, false, null, 'inspectorWhiteFont', 'colorEncodedWellAnnotations-holder-' + sample.permId, null, null);
 						labelContainer.tooltipster({
 							content: $(tooltip),
 							interactive: true,
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js
index 50fd52148a3..051f2d7e401 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js
@@ -322,7 +322,7 @@ function StorageView(storageController, storageModel, gridViewRack, gridViewPosi
 						}
 					}
 				}
-			});
+			}, null, true);
 		}
 	}
 	
-- 
GitLab