From 3afafa29ded5d59b65e65af2353d054cdb707405 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Tue, 3 Jun 2014 13:44:26 +0000
Subject: [PATCH] SSDM-306: Data set viewer no shows when there is no datasets
 on the image view.

SVN: 31644
---
 .../html/js/widgets/DataSetViewer.js          | 53 ++++++++++---------
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DataSetViewer.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DataSetViewer.js
index 16d8124e3be..83112d10e9e 100644
--- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DataSetViewer.js
+++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DataSetViewer.js
@@ -178,10 +178,7 @@ function DataSetViewer(containerId, profile, sample, serverFacade, datastoreDown
 		return passes;
 	}
 	
-	this.repaintImages = function() {
-		var $container = $("#"+this.containerIdContent);
-		$container.empty();
-		
+	this._repaintTestsPassed = function($container) {
 		//
 		// No data store URL
 		//
@@ -189,6 +186,31 @@ function DataSetViewer(containerId, profile, sample, serverFacade, datastoreDown
 			$container.append($("<p>")
 					.append($("<span>", { class: "glyphicon glyphicon-ban-circle" }))
 					.append(" Please configure properly your DSS server properly, looks like is not reachable."));
+			return false;
+		}
+		
+		//
+		// Don't paint data sets for entities that don't have
+		//
+		var numberOfDatasets = 0;
+		for(var datasetCode in this.sampleDataSets) {
+			numberOfDatasets++;
+		}
+		
+		if(numberOfDatasets === 0) {
+			$container.append($("<p>")
+								.append($("<span>", { class: "glyphicon glyphicon-info-sign" }))
+								.append(" No datasets found."));
+			return false;
+		}
+		
+		return true;
+	}
+	this.repaintImages = function() {
+		var $container = $("#"+this.containerIdContent);
+		$container.empty();
+		
+		if(!this._repaintTestsPassed($container)) {
 			return;
 		}
 		
@@ -227,28 +249,7 @@ function DataSetViewer(containerId, profile, sample, serverFacade, datastoreDown
 		var $container = $("#"+this.containerIdContent);
 		$container.empty();
 		
-		//
-		// No data store URL
-		//
-		if(datastoreDownloadURL === null) {
-			$container.append($("<p>")
-					.append($("<span>", { class: "glyphicon glyphicon-ban-circle" }))
-					.append(" Please configure properly your DSS server properly, looks like is not reachable."));
-			return;
-		}
-		
-		//
-		// Don't paint data sets for entities that don't have
-		//
-		var numberOfDatasets = 0;
-		for(var datasetCode in this.sampleDataSets) {
-			numberOfDatasets++;
-		}
-		
-		if(numberOfDatasets === 0) {
-			$container.append($("<p>")
-								.append($("<span>", { class: "glyphicon glyphicon-info-sign" }))
-								.append(" No datasets found."));
+		if(!this._repaintTestsPassed($container)) {
 			return;
 		}
 		
-- 
GitLab