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/23 00:03:48 UTC
svn commit: r1485460 - in /incubator/climate/trunk/rcmet/src/main/ui/app:
index.html js/app.js js/controllers.js js/directives.js
Author: joyce
Date: Wed May 22 22:03:47 2013
New Revision: 1485460
URL: http://svn.apache.org/r1485460
Log:
Resolves CLIMATE-32 - Factor out host component of URLs
- Adds rootScope variable baseURL which can be configured during
deployment to point to the correct host URL for the backend services.
The default points to the (as of the time of this commit) default
bottle location. Namely http://localhost:8082.
- Replaces all instances of the hard coded URLs in index.html with new
baseURL.
- Replaces all instances of hard coded URLs in controllers.js with the
new baseURL.
- Replaces all instances of hard coded URLs in directives.js with the
new baseURL. Adjusts the scope settings for the
predictiveFileBrowserInput directive so rootScope is inherited from.
This gives access to baseURL through the $scope variable that is
accessed in the directive.
- Minor adjustments to quote usage in controllers.js, specifically in
the runEvalution function. Switched from "" to '' so the style is
consistent with the rest of the code.
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
incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.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=1485460&r1=1485459&r2=1485460&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/index.html (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/index.html Wed May 22 22:03:47 2013
@@ -36,20 +36,20 @@
</div>
<div class="modal-body">
<p>
- Comparison: <a href="http://localhost:8082/static/evalResults/{{evalResults.comparisonPath}}">
+ Comparison: <a href="{{baseURL}}/static/evalResults/{{evalResults.comparisonPath}}">
{{evalResults.comparisonPath}}</a>
</p>
<p>
- Model: <a href="http://localhost:8082/static/evalResults/{{evalResults.modelPath}}">
+ Model: <a href="{{baseURL}}/static/evalResults/{{evalResults.modelPath}}">
{{evalResults.modelPath}}</a>
</p>
<p>
- Observation: <a href="http://localhost:8082/static/evalResults/{{evalResults.obsPath}}">
+ Observation: <a href="{{baseURL}}/static/evalResults/{{evalResults.obsPath}}">
{{evalResults.obsPath}}</a>
</p>
- <p><img src="http://localhost:8082/static/evalResults/{{evalResults.comparisonPath}}" alt="" /></p>
- <p><img src="http://localhost:8082/static/evalResults/{{evalResults.modelPath}}" alt="" /></p>
- <p><img src="http://localhost:8082/static/evalResults/{{evalResults.obsPath}}" alt="" /></p>
+ <p><img src="{{baseURL}}/static/evalResults/{{evalResults.comparisonPath}}" alt="" /></p>
+ <p><img src="{{baseURL}}/static/evalResults/{{evalResults.modelPath}}" alt="" /></p>
+ <p><img src="{{baseURL}}/static/evalResults/{{evalResults.obsPath}}" alt="" /></p>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-primary close">Close</a>
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=1485460&r1=1485459&r2=1485460&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 Wed May 22 22:03:47 2013
@@ -11,6 +11,7 @@ angular.module('rcmes', []).
$rootScope.evalResults = "";
$rootScope.fillColors = ['#ff0000', '#00c90d', '#cd0074', '#f3fd00'];
$rootScope.surroundColors = ['#a60000', '#008209', '#8f004b', '#93a400']
+ $rootScope.baseURL = 'http://localhost:8082';
}).
service('selectedDatasetInformation', function() {
var datasets = [];
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=1485460&r1=1485459&r2=1485460&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 22 22:03:47 2013
@@ -209,25 +209,25 @@ function ParameterSelectCtrl($rootScope,
// $http.post call but it is with this. So...there you go! This should be
// changed eventually!!
$.ajax({
- type: "POST",
- url: "http://localhost:8082/rcmes/run/",
+ type: 'POST',
+ url: $rootScope.baseURL + '/rcmes/run/',
data: {
- "obsDatasetId" : $scope.datasets[obsIndex]['id'],
- "obsParameterId" : $scope.datasets[obsIndex]['param'],
- "startTime" : $scope.displayParams.start,
- "endTime" : $scope.displayParams.end,
- "latMin" : $scope.displayParams.latMin,
- "latMax" : $scope.displayParams.latMax,
- "lonMin" : $scope.displayParams.lonMin,
- "lonMax" : $scope.displayParams.lonMax,
- "filelist" : $scope.datasets[modelIndex]['id'],
- "modelVarName" : $scope.datasets[modelIndex]['param'],
- "modelTimeVarName" : $scope.datasets[modelIndex]['time'],
- "modelLatVarName" : $scope.datasets[modelIndex]['lat'],
- "modelLonVarName" : $scope.datasets[modelIndex]['lon'],
- "regridOption" : "model",
- "timeRegridOption" : "monthly",
- "metricOption" : "bias",
+ 'obsDatasetId' : $scope.datasets[obsIndex]['id'],
+ 'obsParameterId' : $scope.datasets[obsIndex]['param'],
+ 'startTime' : $scope.displayParams.start,
+ 'endTime' : $scope.displayParams.end,
+ 'latMin' : $scope.displayParams.latMin,
+ 'latMax' : $scope.displayParams.latMax,
+ 'lonMin' : $scope.displayParams.lonMin,
+ 'lonMax' : $scope.displayParams.lonMax,
+ 'filelist' : $scope.datasets[modelIndex]['id'],
+ 'modelVarName' : $scope.datasets[modelIndex]['param'],
+ 'modelTimeVarName' : $scope.datasets[modelIndex]['time'],
+ 'modelLatVarName' : $scope.datasets[modelIndex]['lat'],
+ 'modelLonVarName' : $scope.datasets[modelIndex]['lon'],
+ 'regridOption' : 'model',
+ 'timeRegridOption' : 'monthly',
+ 'metricOption' : 'bias',
},
success: function(data) {
var comp = data['comparisonPath'].split('/');
@@ -326,7 +326,7 @@ function ObservationSelectCtrl($rootScop
// Grab the path leader information that the webserver is using to limit directory access.
$scope.pathLeader = 'False';
- $http.jsonp('http://localhost:8082/getPathLeader/?callback=JSON_CALLBACK').
+ $http.jsonp($rootScope.baseURL + '/getPathLeader/?callback=JSON_CALLBACK').
success(function(data) {
$scope.pathLeader = data.leader;
});
@@ -362,11 +362,11 @@ function ObservationSelectCtrl($rootScop
// Should check for fails and allow the user to make changes.
//
// Get model variables
- var varsPromise = $http.jsonp('http://localhost:8082/list/vars/"' + input + '"?callback=JSON_CALLBACK');
+ var varsPromise = $http.jsonp($rootScope.baseURL + '/list/vars/"' + input + '"?callback=JSON_CALLBACK');
// Get Lat and Lon variables
- var latlonPromise = $http.jsonp('http://localhost:8082/list/latlon/"' + input + '"?callback=JSON_CALLBACK');
+ var latlonPromise = $http.jsonp($rootScope.baseURL + '/list/latlon/"' + input + '"?callback=JSON_CALLBACK');
// Get Time variables
- var timesPromise = $http.jsonp('http://localhost:8082/list/time/"' + input + '"?callback=JSON_CALLBACK');
+ var timesPromise = $http.jsonp($rootScope.baseURL + '/list/time/"' + input + '"?callback=JSON_CALLBACK');
$q.all([varsPromise, latlonPromise, timesPromise]).then(
// Handle success fetches!
@@ -489,7 +489,7 @@ function RcmedSelectionCtrl($rootScope,
$scope.fileAdded = false;
var getObservations = function() {
- $http.jsonp('http://localhost:8082/getObsDatasets?callback=JSON_CALLBACK').
+ $http.jsonp($rootScope.baseURL + '/getObsDatasets?callback=JSON_CALLBACK').
success(function(data) {
$scope.availableObs = data;
$scope.availableObs.splice(0, 0, {longname: 'Please select an option'});
@@ -514,7 +514,7 @@ function RcmedSelectionCtrl($rootScope,
};
$scope.dataSelectUpdated = function() {
- var urlString = 'http://localhost:8082/getDatasetParam?dataset=' +
+ var urlString = $rootScope.baseURL + '/getDatasetParam?dataset=' +
$scope.datasetSelection["shortname"] +
"&callback=JSON_CALLBACK";
$http.jsonp(urlString).
Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js?rev=1485460&r1=1485459&r2=1485460&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/directives.js Wed May 22 22:03:47 2013
@@ -169,7 +169,7 @@ directive('predictiveFileBrowserInput',
*/
// TODO Make this use $HTTP
$scope.fetchFiles = function(path) {
- $.get('http://localhost:8082/getDirInfo/' + path, {},
+ $.get($scope.baseURL + '/getDirInfo/' + path, {},
function(data) {
$scope.setNewData(data);
$scope.updateAutoComplete();
@@ -189,7 +189,7 @@ directive('predictiveFileBrowserInput',
*/
// TODO Why isn't this using $http?!?!?! Because I copy and pasted!!!!
$scope.fetchFilesAndFilter = function(path) {
- $.get('http://localhost:8082/getDirInfo/' + path, {},
+ $.get($scope.baseURL + '/getDirInfo/' + path, {},
function(data) {
$scope.setNewData(data);
$scope.filterResults();
@@ -368,6 +368,7 @@ directive('predictiveFileBrowserInput',
return {
link: link,
+ scope: true,
restrict: 'A'
};
});