From 10acde46eee5bed1c1066f0e1ee0e03559833002 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Fri, 21 Aug 2015 13:48:26 +0000
Subject: [PATCH] SSDM-2358 : Automatically select dataset type makes
 properties fields disappear

SVN: 34507
---
 .../webapps/eln-lims/html/js/config/StandardProfile.js |  8 ++++++++
 .../html/js/views/DataSetForm/DataSetFormView.js       | 10 ++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js
index 9c59bd19882..87ce82a446c 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js
+++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js
@@ -373,5 +373,13 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, {
 				freeFormTableController.init($("#" + containerId));
 			}
 		}
+		
+		this.getDataSetTypeForFileName = function(allDatasetFiles, fileName) {
+			if(fileName.endsWith("fasta")) {
+				return "SEQ_FILE";
+			} else {
+				return null;
+			}
+		}
 }
 });
\ No newline at end of file
diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js
index 714f94ba347..7a27acf3fdf 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js
+++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js
@@ -177,11 +177,13 @@ function DataSetFormView(dataSetFormController, dataSetFormModel) {
 			var onComplete = function(data) {
 				_this._dataSetFormModel.files.push(data.name);
 				_this._updateFileOptions();
-				var dataSetType = profile.getDataSetTypeForFileName(_this._dataSetFormModel.files, data.name);
-				if(dataSetType != null) {
-					$("#DATASET_TYPE").val(dataSetType);
+				var dataSetTypeCode = profile.getDataSetTypeForFileName(_this._dataSetFormModel.files, data.name);
+				if(dataSetTypeCode != null) {
+					$("#DATASET_TYPE").val(dataSetTypeCode);
 					$("#DATASET_TYPE").prop('disabled', true);
-					_this._repaintMetadata($('#DATASET_TYPE').val())
+					_this._repaintMetadata(
+							_this._dataSetFormController._getDataSetType(dataSetTypeCode)
+					);
 				}
 			}
 			
-- 
GitLab