From 2c03bb33c024278b22d50cb28277b066e7988494 Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Mon, 12 May 2014 08:17:20 +0000 Subject: [PATCH] SSDM-278: ELN UI - If Annotations are not configured is not necessary to have a property ANNOTATIONS_STATE SVN: 31478 --- .../html/js/widgets/SampleLinksWidget.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SampleLinksWidget.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SampleLinksWidget.js index 00fa290f0fc..98f1f2b74f4 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SampleLinksWidget.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SampleLinksWidget.js @@ -35,12 +35,26 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType this.samplesToEdit = (samplesToEdit)?samplesToEdit:new Array(); //Only used to populate the widget this.samples = {}; this.samplesRemoved = {}; - this.stateObj = null; + this.stateObj = {}; this._lastUsedId = null; this._lastIndex = 0; + this._enableAnnotations = function() { + var enableAnnotations = false; + for(var i = 0; i < this.sampleTypeHints.length; i++) { + var sampleTypeHint = this.sampleTypeHints[i]; + if(sampleTypeHint["ANNOTATION_PROPERTIES"].length > 0) { + enableAnnotations = true; + } + } + return enableAnnotations; + } + this._writeState = function(permId, propertyTypeCode, propertyTypeValue) { + if(!this._enableAnnotations()) { + return; + } this._readState(); var sampleTypeAnnotations = this.stateObj[permId]; @@ -72,6 +86,9 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType } this._readState = function() { + if(!this._enableAnnotations()) { + return; + } var stateField = $("#ANNOTATIONS_STATE"); if(stateField.length === 0) { Util.showError("You need a property with code ANNOTATIONS_STATE on this entity to store the state of the annotations."); -- GitLab