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 2014/07/21 15:25:10 UTC
[34/50] git commit: Indentation and formatting fixes in
RCMEDSelectCtrl
Indentation and formatting fixes in RCMEDSelectCtrl
Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/099f91d9
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/099f91d9
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/099f91d9
Branch: refs/heads/master
Commit: 099f91d96f2243622ddf763961a46603358e081c
Parents: 896e117
Author: Michael Joyce <jo...@apache.org>
Authored: Fri Jul 18 12:01:26 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Fri Jul 18 12:01:26 2014 -0700
----------------------------------------------------------------------
.../app/scripts/controllers/rcmedselection.js | 153 ++++++++++---------
1 file changed, 77 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/climate/blob/099f91d9/ocw-ui/frontend-new/app/scripts/controllers/rcmedselection.js
----------------------------------------------------------------------
diff --git a/ocw-ui/frontend-new/app/scripts/controllers/rcmedselection.js b/ocw-ui/frontend-new/app/scripts/controllers/rcmedselection.js
index 827a249..454fdf7 100644
--- a/ocw-ui/frontend-new/app/scripts/controllers/rcmedselection.js
+++ b/ocw-ui/frontend-new/app/scripts/controllers/rcmedselection.js
@@ -8,29 +8,29 @@
* Controller of the ocwUiApp
*/
angular.module('ocwUiApp')
- .controller('RcmedSelectionCtrl', ['$rootScope', '$scope', '$http', '$timeout', 'selectedDatasetInformation',
- function($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;
+ .controller('RcmedSelectionCtrl', ['$rootScope', '$scope', '$http', '$timeout', 'selectedDatasetInformation',
+ function($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;
- $scope.getObservations = function() {
- $http.jsonp($rootScope.baseURL + '/rcmed/datasets/?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"]
- });
- };
+ $scope.getObservations = function() {
+ $http.jsonp($rootScope.baseURL + '/rcmed/datasets/?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"]
+ });
+ };
$scope.getObservationBounds = function() {
- $scope.observationBounds = {};
+ $scope.observationBounds = {};
- $http.get($rootScope.baseURL + '/rcmed/parameters/bounds/').
- success(function(data) {
+ $http.get($rootScope.baseURL + '/rcmed/parameters/bounds/')
+ .success(function(data) {
$scope.observationBounds = data;
$scope.observationBounds['default'] = {
'start': '1900-01-01 00:00:00',
@@ -40,8 +40,8 @@ angular.module('ocwUiApp')
'lonMin': -180,
'lonMax': 179,
};
- }).
- error(function(data) {
+ })
+ .error(function(data) {
$scope.observationBounds['default'] = {
'start': '1900-01-01 00:00:00',
'end': '2050-01-01 00:00:00',
@@ -54,71 +54,72 @@ angular.module('ocwUiApp')
};
$scope.getBoundsByParameterId = function(parameterId) {
- if (parameterId in $scope.observationBounds) {
- return $scope.observationBounds[parameterId];
- } else {
- return $scope.observationBounds['default'];
- }
+ if (parameterId in $scope.observationBounds) {
+ return $scope.observationBounds[parameterId];
+ } else {
+ return $scope.observationBounds['default'];
+ }
};
- $scope.dataSelectUpdated = function() {
- var urlString = $rootScope.baseURL + '/rcmed/parameters/?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.dataSelectUpdated = function() {
+ var urlString = $rootScope.baseURL + '/rcmed/parameters/?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() {
- var newDataset = {};
+ $scope.addObservation = function() {
+ var newDataset = {};
- newDataset['isObs'] = 1;
- // Save the dataset id (the important part) and name (for display purposes)
- newDataset['datasetId'] = $scope.datasetSelection['dataset_id'];
- newDataset['name'] = $scope.datasetSelection['longname'];
- // Save the parameter id (the important part) and name (for display purposes)
- newDataset['id'] = $scope.parameterSelection['parameter_id'];
- newDataset['param'] = $scope.parameterSelection['parameter_id'];
- newDataset['paramName'] = $scope.parameterSelection['longname'];
+ newDataset['isObs'] = 1;
+ // Save the dataset id (the important part) and name (for display purposes)
+ newDataset['datasetId'] = $scope.datasetSelection['dataset_id'];
+ newDataset['name'] = $scope.datasetSelection['longname'];
+ // Save the parameter id (the important part) and name (for display purposes)
+ newDataset['id'] = $scope.parameterSelection['parameter_id'];
+ newDataset['param'] = $scope.parameterSelection['parameter_id'];
+ newDataset['paramName'] = $scope.parameterSelection['longname'];
- bounds = $scope.getBoundsByParameterId(newDataset['id']);
- newDataset['latlonVals'] = {
- 'latMin': bounds['lat_min'],
- 'latMax': bounds['lat_max'],
- 'lonMin': bounds['lon_min'],
- 'lonMax': bounds['lon_max'],
- };
- newDataset['timeVals'] = {
- 'start': bounds['start_date'],
- 'end': bounds['end_date'],
- };
+ var bounds = $scope.getBoundsByParameterId(newDataset['id']);
+ newDataset['latlonVals'] = {
+ 'latMin': bounds['lat_min'],
+ 'latMax': bounds['lat_max'],
+ 'lonMin': bounds['lon_min'],
+ 'lonMax': bounds['lon_max'],
+ };
+ newDataset['timeVals'] = {
+ 'start': bounds['start_date'],
+ 'end': bounds['end_date'],
+ };
- // Set some defaults for lat/lon/time variable names. This just helps
- // us display stuff later.
- newDataset['lat'] = "N/A";
- newDataset['lon'] = "N/A";
- newDataset['time'] = "N/A";
+ // Set some defaults for lat/lon/time variable names. This just helps
+ // us display stuff later.
+ newDataset['lat'] = "N/A";
+ newDataset['lon'] = "N/A";
+ newDataset['time'] = "N/A";
- selectedDatasetInformation.addDataset(newDataset);
+ selectedDatasetInformation.addDataset(newDataset);
- // Clear the user selections by requery-ing RCMED. This is really hacky, but it works for now...
- $scope.availableObs = [];
- $scope.retrievedObsParams = [];
- $scope.getObservations();
+ // Clear the user selections by requery-ing RCMED. This is really hacky, but it works for now...
+ $scope.availableObs = [];
+ $scope.retrievedObsParams = [];
+ $scope.getObservations();
- // Display a confirmation message for a little bit
- $scope.fileAdded = true;
- $timeout(function() {
- $scope.fileAdded = false;
- }, 2000);
- };
+ // Display a confirmation message for a little bit
+ $scope.fileAdded = true;
+ $timeout(function() {
+ $scope.fileAdded = false;
+ }, 2000);
+ };
// Grab the available observations from RCMED
$scope.getObservations();
$scope.getObservationBounds();
- }]);
+ }
+ ]);