Author: joyce
Date: Wed Mar  5 19:17:15 2014
New Revision: 1574632

URL: http://svn.apache.org/r1574632
Log:
CLIMATE-356 - Update frontend to pull metric options from backend

Modified:
    climate/trunk/ocw-ui/frontend/app/js/services/EvaluationSettings.js

Modified: climate/trunk/ocw-ui/frontend/app/js/services/EvaluationSettings.js
URL: 
http://svn.apache.org/viewvc/climate/trunk/ocw-ui/frontend/app/js/services/EvaluationSettings.js?rev=1574632&r1=1574631&r2=1574632&view=diff
==============================================================================
--- climate/trunk/ocw-ui/frontend/app/js/services/EvaluationSettings.js 
(original)
+++ climate/trunk/ocw-ui/frontend/app/js/services/EvaluationSettings.js Wed Mar 
 5 19:17:15 2014
@@ -18,11 +18,20 @@
 **/
 
 // EvaluationSettings gives controllers access to the user's selected 
evaluation settings.
-App.Services.service('evaluationSettings', function() {
+App.Services.service('evaluationSettings', function($rootScope, $http) {
+    $http.get($rootScope.baseURL + '/processing/metrics/').then(function(data) 
{
+        metrics_data = data['data']['metrics'];
+        metrics = [];
+
+        for (var i = 0; i < metrics_data.length; ++i) {
+            metrics.push({'name': metrics_data[i], 'select': false});
+        }
+
+        settings['metrics'] = metrics;
+    });
+
        var settings = {
-               'metrics': [ 
-                       {'name': 'bias', 'select': true},
-               ],
+        'metrics': [],
                'temporal': {
                        'options': ['daily', 'monthly', 'yearly'],
                        'selected': 'yearly',


Reply via email to