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/06/13 01:16:37 UTC
svn commit: r1492472 - in /incubator/climate/trunk/rcmet/src/main/ui/app:
index.html js/controllers.js js/controllers/RcmedSelectionCtrl.js
Author: joyce
Date: Wed Jun 12 23:16:37 2013
New Revision: 1492472
URL: http://svn.apache.org/r1492472
Log:
LIMATE-95 progress - Moves RcmedSelectCtrl
- Moves RcmedSelectCtrl to js/controllers/RcmedSelectCtrl.js
- Adds new include in index.html for the new file.
Added:
incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/RcmedSelectionCtrl.js (contents, props changed)
- copied, changed from r1492471, incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js
Modified:
incubator/climate/trunk/rcmet/src/main/ui/app/index.html
incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js
Modified: incubator/climate/trunk/rcmet/src/main/ui/app/index.html
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/index.html?rev=1492472&r1=1492471&r2=1492472&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/index.html (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/index.html Wed Jun 12 23:16:37 2013
@@ -234,6 +234,7 @@
<script src="js/controllers/ParameterSelectCtrl.js"></script>
<script src="js/controllers/DatasetDisplayCtrl.js"></script>
<script src="js/controllers/ObservationSelectCtrl.js"></script>
+ <script src="js/controllers/RcmedSelectionCtrl.js"></script>
<script src="js/filters.js"></script>
<script src="js/directives.js"></script>
</body>
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=1492472&r1=1492471&r2=1492472&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 Jun 12 23:16:37 2013
@@ -1,93 +1,5 @@
'use strict';
-function RcmedSelectionCtrl($rootScope, $scope, $http, $timeout, selectedDatasetInformation) {
- // Grab a copy of the datasets so we can display a count to the user!
- $scope.datasetCount = selectedDatasetInformation.getDatasets();
- $scope.fileAdded = false;
-
- var getObservations = function() {
- $http.jsonp($rootScope.baseURL + '/getObsDatasets?callback=JSON_CALLBACK').
- success(function(data) {
- $scope.availableObs = data;
- $scope.availableObs.splice(0, 0, {longname: 'Please select an option'});
- $scope.datasetSelection = $scope.availableObs[0];
- }).
- error(function(data) {
- $scope.availableObs = ["Unable to query RCMED"]
- });
- };
-
- var getObservationTimeRange = function(datasetID) {
- var times = {
- '1' : {'start' : '1989-01-01 00:00:00','end' : '2009-12-31 00:00:00'}, // ERA-Interim
- '2' : {'start' : '2002-08-31 00:00:00','end' : '2010-01-01 00:00:00'}, // AIRS
- '3' : {'start' : '1998-01-01 00:00:00','end' : '2010-01-01 00:00:00'}, // TRMM
- '4' : {'start' : '1948-01-01 00:00:00','end' : '2010-01-01 00:00:00'}, // URD
- '5' : {'start' : '2000-02-24 00:00:00','end' : '2010-05-30 00:00:00'}, // MODIS
- '6' : {'start' : '1901-01-01 00:00:00','end' : '2006-12-01 00:00:00'} // CRU
- };
-
- return ((datasetID in times) ? times[datasetID] : false);
- };
-
- $scope.dataSelectUpdated = function() {
- var urlString = $rootScope.baseURL + '/getDatasetParam?dataset=' +
- $scope.datasetSelection["shortname"] +
- "&callback=JSON_CALLBACK";
- $http.jsonp(urlString).
- success(function(data) {
- $scope.retrievedObsParams = data;
- if ($scope.retrievedObsParams.length > 1)
- $scope.retrievedObsParams.splice(0, 0, {shortname: 'Please select a parameter'});
- $scope.parameterSelection = $scope.retrievedObsParams[0];
- });
- };
-
- $scope.addObservation = function() {
- // This is a horrible hack for temporarily getting a valid time range
- // for the selected observation. Eventually we need to handle this more
- // elegantly than indexing into an array...
- var timeRange = getObservationTimeRange($scope.datasetSelection["dataset_id"]);
-
- var newDataset = {};
-
- newDataset['isObs'] = 1;
- // Save the dataset id (the important part) and name (for display purposes)
- newDataset['id'] = $scope.datasetSelection['dataset_id'];
- newDataset['name'] = $scope.datasetSelection['longname'];
- // Save the parameter id (the important part) and name (for display purposes)
- newDataset['param'] = $scope.parameterSelection['parameter_id'];
- newDataset['paramName'] = $scope.parameterSelection['longname'];
- // Save the (fake) lat/lon information. Our datasets cover the entire globe (I think...)
- newDataset['latlonVals'] = {"latMin": -90, "latMax": 90, "lonMin": -180, "lonMax": 180};
- // Set some defaults for lat/lon variable names. This just helps us display stuff later.
- newDataset['lat'] = "N/A";
- newDataset['lon'] = "N/A";
- // Save time range information. If we don't have saved data for this observation then
- // we set the values to extreme values so they'll be ignored when calculating overlaps.
- newDataset['timeVals'] = {"start": (timeRange) ? timeRange['start'] : "1901-01-01 00:00:00",
- "end": (timeRange) ? timeRange['end'] : "2050-01-01 00:00:00"};
- // Set a default for the time variable names for display convenience.
- newDataset['time'] = "N/A";
-
- selectedDatasetInformation.addDataset(newDataset);
-
- // Clear the user selections by requery-ing RCMED. This is really hacky, but it works for now...
- $scope.availableObs = [];
- $scope.retrievedObsParams = [];
- getObservations();
-
- // Display a confirmation message for a little bit
- $scope.fileAdded = true;
- $timeout(function() {
- $scope.fileAdded = false;
- }, 2000);
- };
-
- // Grab the available observations from RCMED
- getObservations();
-}
-
function SettingsCtrl($scope, evaluationSettings) {
$scope.settings = evaluationSettings.getSettings();
}
Copied: incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/RcmedSelectionCtrl.js (from r1492471, 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/RcmedSelectionCtrl.js?p2=incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/RcmedSelectionCtrl.js&p1=incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js&r1=1492471&r2=1492472&rev=1492472&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/RcmedSelectionCtrl.js Wed Jun 12 23:16:37 2013
@@ -1,4 +1,19 @@
-'use strict';
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
function RcmedSelectionCtrl($rootScope, $scope, $http, $timeout, selectedDatasetInformation) {
// Grab a copy of the datasets so we can display a count to the user!
@@ -87,7 +102,3 @@ function RcmedSelectionCtrl($rootScope,
// Grab the available observations from RCMED
getObservations();
}
-
-function SettingsCtrl($scope, evaluationSettings) {
- $scope.settings = evaluationSettings.getSettings();
-}