From bda5121a78be4c7b29ea528a0a207d2b32c09669 Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Wed, 25 Mar 2015 14:31:55 +0000 Subject: [PATCH] SSDM-1614 : YEASTLAB - ELN UI - Show Names (Polishments) SVN: 33734 --- .../html/js/views/legacy/SampleLinksWidget.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/legacy/SampleLinksWidget.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/legacy/SampleLinksWidget.js index e3522aab070..2eb630bba06 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/legacy/SampleLinksWidget.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/legacy/SampleLinksWidget.js @@ -55,8 +55,15 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType } this._readState = function() { - var stateField = mainController.currentView._sampleFormModel.sample.properties["ANNOTATIONS_STATE"]; - if(!this.isDisabled && stateField.length === 0) { + var isStateFieldAvailable = false; + + if(mainController.currentView._sampleFormModel.sample) { + var availableFields = profile.getAllPropertiCodesForTypeCode(mainController.currentView._sampleFormModel.sample.sampleTypeCode); + var pos = $.inArray("ANNOTATIONS_STATE", availableFields); + isStateFieldAvailable = (pos !== -1); + } + + if(!isStateFieldAvailable) { if(this.sampleTypeHints && this.sampleTypeHints.length !== 0) { //Indicates annotations are needed Util.showError("You need a property with code ANNOTATIONS_STATE on this entity to store the state of the annotations."); } @@ -66,6 +73,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType fieldset.hide(); //Update Values + var stateField = mainController.currentView._sampleFormModel.sample.properties["ANNOTATIONS_STATE"]; this.stateObj = FormUtil.getAnnotationsFromField(stateField); } } -- GitLab