Author: joyce
Date: Wed May 29 16:58:54 2013
New Revision: 1487542
URL: http://svn.apache.org/r1487542
Log:
Resolves CLIMATE-33 - Add modal for metric selection
- Adds the evaluationSettings service to ParameterSelectCtrl. When
running an evaluation only the first option that the user selected
is used. This will be changed later once we have decided how we're
going to support workflows/multiple runs.
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=1487542&r1=1487541&r2=1487542&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 Wed May 29
16:58:54 2013
@@ -76,7 +76,8 @@ function WorldMapCtrl($rootScope, $scope
};
// Controller for dataset parameter selection/modification
-function ParameterSelectCtrl($rootScope, $scope, $http, $timeout,
selectedDatasetInformation, regionSelectParams) {
+function ParameterSelectCtrl($rootScope, $scope, $http, $timeout,
selectedDatasetInformation,
+ regionSelectParams,
evaluationSettings) {
$scope.datasets = selectedDatasetInformation.getDatasets();
// The min/max lat/lon values from the selected datasets
@@ -210,6 +211,20 @@ function ParameterSelectCtrl($rootScope,
modelIndex = i;
}
+ // TODO At the moment we aren't running all the metrics that
the user selected. We're only
+ // running the first available metric that the user provides.
If the user un-checks all
+ // metrics then the default of 'bias' is used.
+ var metricToRun = 'bias';
+ var settings = evaluationSettings.getSettings().metrics;
+ for (var i = 0; i < settings.length; i++) {
+ var setting = settings[i];
+
+ if (setting.select) {
+ metricToRun = setting.name;
+ break;
+ }
+ };
+
// You might wonder why this is using a jQuery ajax call
instead of a built
// in $http.post call. The reason would be that it wasn't
working with the
// $http.post call but it is with this. So...there you go! This
should be
@@ -233,7 +248,7 @@ function ParameterSelectCtrl($rootScope,
'modelLonVarName' :
$scope.datasets[modelIndex]['lon'],
'regridOption' : 'model',
'timeRegridOption' : 'monthly',
- 'metricOption' : 'bias',
+ 'metricOption' : metricToRun,
},
success: function(data) {
var comp = data['comparisonPath'].split('/');