You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2013/05/16 05:01:32 UTC

svn commit: r1483171 - /incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js

Author: joyce
Date: Thu May 16 03:01:32 2013
New Revision: 1483171

URL: http://svn.apache.org/r1483171
Log:
Resolves CLIMATE-27. Filter out invalid options in selectObservation.

- When displaying the parsed variables from a file the user has
  uploaded, values that are found to be the lat, lon, or time values are
  no longer displayed as valid options for evaluation.

Modified:
    incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js?rev=1483171&r1=1483170&r2=1483171&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js Thu May 16 03:01:32 2013
@@ -373,11 +373,6 @@ function ObservationSelectCtrl($rootScop
 			function(arrayOfResults) {
 				$scope.loadingFile = false;
 
-				// Handle parameter results
-				var data = arrayOfResults[0].data.variables;
-				$scope.params = (data instanceof Array) ? data : [data];
-				$scope.paramSelect = $scope.params[0];
-
 				// Handle lat/lon results
 				var data = arrayOfResults[1].data;
 				$scope.lats = [data.latname];
@@ -390,6 +385,17 @@ function ObservationSelectCtrl($rootScop
 				var data = arrayOfResults[2].data
 				$scope.times = [data.timename];
 				$scope.timeSelect = $scope.times[0];
+
+				// Handle parameter results
+				var data = arrayOfResults[0].data.variables;
+				$scope.params = (data instanceof Array) ? data : [data];
+				$scope.params = $.grep($scope.params, 
+									function(val) {
+										return ($.inArray(val, $scope.lats)  != 0 && 
+											    $.inArray(val, $scope.lons)  != 0 && 
+											    $.inArray(val, $scope.times) != 0);
+									});
+				$scope.paramSelect = $scope.params[0];
 			},
 			// Uh oh! AT LEAST on of our fetches failed
 			function(arrayOfFailure) {