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/04 02:29:45 UTC

svn commit: r1489252 - in /incubator/climate/trunk/rcmet/src/main/ui/app: index.html js/app.js js/controllers.js

Author: joyce
Date: Tue Jun  4 00:29:45 2013
New Revision: 1489252

URL: http://svn.apache.org/r1489252
Log:
Resolves CLIMATE-70 - Adds start and end datepickers

- Updates module instantiation to include new ui.date dependency.
- Adds new input boxes in index.html. This adds the new ui-date and
  ui-date-format directives to use the AngularUI datepicker component.
- Adds new scope variable in ParameterSelectCtrl for defaulting the date
  pickers to sane settings.
- Updates the start and end time calculations when new datasets are
  added. The time component is now removed so only the date component is
  passed to the datepickers.
- Updates the backend call for evaluation to adjust formatting of the
  passed start and end times. The new boxes don't allow the user to
  select the time (it defaults to midnight) so the backend calls need to
  include the time component manually.

Modified:
    incubator/climate/trunk/rcmet/src/main/ui/app/index.html
    incubator/climate/trunk/rcmet/src/main/ui/app/js/app.js
    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=1489252&r1=1489251&r2=1489252&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/index.html (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/index.html Tue Jun  4 00:29:45 2013
@@ -86,13 +86,13 @@
       <div class="span1 offset2 text-center">Start Date:</div>
       <div class="span2">
         <form>
-      <input ng-model="displayParams.start" type="text" class="span2" />
+          <input type="text" class="text-center span2" ng-model="displayParams.start" ui-date="datepickerSettings" ui-date-format="yy-mm-dd" />
         </form>
       </div>
       <div class="span1 text-center">End Date:</div>
       <div class="span2">
         <form>
-		  <input ng-model="displayParams.end" type="text" class="span2" />
+          <input type="text" class="text-center span2" ng-model="displayParams.end" ui-date="datepickerSettings" ui-date-format="yy-mm-dd" />
         </form>
       </div>
       <div class="span1">
@@ -156,6 +156,7 @@
       </div>
     </div>
   </div>
+
   <!--Dataset display-->
   <div ng-controller="DatasetDisplayCtrl">
     <div ng-repeat="dataset in datasets">

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/app.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/app.js?rev=1489252&r1=1489251&r2=1489252&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/app.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/app.js Tue Jun  4 00:29:45 2013
@@ -1,6 +1,6 @@
 'use strict';
 
-angular.module('rcmes', []).
+angular.module('rcmes', ['ui.date']).
 	config(['$routeProvider', function($routeProvider) {
 		$routeProvider.
 			when('/obs', {templateUrl: 'partials/selectObservation.html',   controller: ObservationSelectCtrl}).

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=1489252&r1=1489251&r2=1489252&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 Tue Jun  4 00:29:45 2013
@@ -140,7 +140,13 @@ function ParameterSelectCtrl($rootScope,
 		$scope.lonSliderVal = value;
 		$scope.$apply();
 	}
-	
+
+	// Settings for jQuery datepicker directives!
+	$scope.datepickerSettings = {
+		changeMonth: true,
+		changeYear: true,
+	};
+
 	var updateDisplayValues = function() {
 		// Update the displayed lat/lon values. We give precedence to users entered values assuming
 		// they're valid given the current set of datasets selected.
@@ -275,8 +281,8 @@ function ParameterSelectCtrl($rootScope,
 			data: { 
 				'obsDatasetId'     : $scope.datasets[obsIndex]['id'],
 				'obsParameterId'   : $scope.datasets[obsIndex]['param'],
-				'startTime'        : $scope.displayParams.start,
-				'endTime'          : $scope.displayParams.end,
+				'startTime'        : $scope.displayParams.start + " 00:00:00",
+				'endTime'          : $scope.displayParams.end + " 00:00:00",
 				'latMin'           : $scope.displayParams.latMin,
 				'latMax'           : $scope.displayParams.latMax,
 				'lonMin'           : $scope.displayParams.lonMin,
@@ -360,8 +366,8 @@ function ParameterSelectCtrl($rootScope,
 			$scope.latMax = latMax;
 			$scope.lonMin = lonMin;
 			$scope.lonMax = lonMax;
-			$scope.start = start;
-			$scope.end = end;
+			$scope.start = start.split(" ")[0];
+			$scope.end = end.split(" ")[0];
 
 			updateDisplayValues();
 		}, true);