You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2012/12/09 15:21:45 UTC

svn commit: r1418969 [1/4] - in /incubator/ambari/branches/AMBARI-666/ambari-web: app/ app/controllers/ app/controllers/global/ app/controllers/main/ app/controllers/main/host/ app/controllers/main/service/ app/controllers/main/service/info/ app/contro...

Author: yusaku
Date: Sun Dec  9 14:21:37 2012
New Revision: 1418969

URL: http://svn.apache.org/viewvc?rev=1418969&view=rev
Log:
AMBARI-1059. Refactor cluster management. (yusaku)

Added:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/update_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/update_mapper.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/string_utils.js
Removed:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/services_mapper.js
Modified:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/background_operations_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/cluster_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/login_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/details.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/info/configs.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/item.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/initialize.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/jobs_mapper.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/status_mapper.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/models/host.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/models/hosts.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/models/user.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/router.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_host_routes.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_service_routes.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less
    incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/apps.less
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/linear_time.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/hdfs.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/add.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/details.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/configs.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/item.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/graph.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/chart/linear_time.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/quick_view_link_view.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps/item/bar_view.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/cluster_metrics/network.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/hbase.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/hdfs.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/mapreduce.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/menu.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/configs.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/item.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/menu.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/wizard/step5_view.js
    incubator/ambari/branches/AMBARI-666/ambari-web/vendor/scripts/jquery-ui-timepicker-addon.js

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js Sun Dec  9 14:21:37 2012
@@ -64,3 +64,4 @@ require('controllers/wizard/step8_contro
 require('controllers/wizard/step9_controller');
 require('controllers/wizard/step10_controller');
 require('controllers/global/cluster_controller');
+require('controllers/global/update_controller');
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/background_operations_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/background_operations_controller.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/background_operations_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/background_operations_controller.js Sun Dec  9 14:21:37 2012
@@ -29,54 +29,11 @@ App.BackgroundOperationsController = Em.
   allOperations: [],
   allOperationsCount : 0,
 
-  /**
-   * Update it every time when background operations for services are changed
-   */
-  serviceOperationsChangeTime: function(){
-    return (new Date().getTime());
-  }.property('hdfsOperations', 'mapReduceOperations'),
-
-  hdfsOperations : function(){
-    var all = this.get('allOperations');
-    var result = [];
-
-    all.forEach(function(item){
-      if( ['NAMENODE', 'SECONDARY_NAMENODE', 'DATANODE', 'HDFS_CLIENT', 'HDFS_SERVICE_CHECK'].contains(item.role)){
-        result.push(item);
-      }
-    })
-    return result;
-  }.property('allOperations.@each'),
-
-  mapReduceOperations : function(){
-    var all = this.get('allOperations');
-    var result = [];
-
-    all.forEach(function(item){
-      if( ['MAPREDUCE_CLIENT', 'JOBTRACKER', 'TASKTRACKER', 'MAPREDUCE_SERVICE_CHECK'].contains(item.role)){
-        result.push(item);
-      }
-    })
-    return result;
-
-  }.property('allOperations.@each'),
-
-  getOperationsFor: function(serviceName){
-    switch(serviceName.toUpperCase()){
-      case 'HDFS':
-        return this.get('hdfsOperations');
-      case 'MAPREDUCE':
-        return this.get('mapReduceOperations');
-      default:
-        return [];
-    }
-  },
-
   getOperationsForRequestId: function(requestId){
     return this.get('allOperations').filterProperty('request_id', requestId);
   },
 
-  updateInterval: 6000,
+  updateInterval: App.bgOperationsUpdateInterval,
   url : '',
 
   generateUrl: function(){
@@ -88,6 +45,40 @@ App.BackgroundOperationsController = Em.
     return url;
   },
 
+  timeoutId : null,
+
+  /**
+   * Background operations will not be working if receive <code>attemptsCount</code> response with errors
+   */
+  attemptsCount: 20,
+
+  errorsCount: 0,
+
+  /**
+   * Call this.loadOperations with delay
+   * @param delay time in milliseconds (updateInterval by default)
+   * @param reason reason why we call it(used to calculate count of errors)
+   */
+  loadOperationsDelayed: function(delay, reason){
+    delay = delay || this.get('updateInterval');
+    var self = this;
+
+    if(reason && reason.indexOf('error:clusterName:') === 0){
+      var errors = this.get('errorsCount') + 1;
+      this.set('errorsCount', errors);
+      if(errors > this.get('attemptsCount')){
+        console.log('Stop loading background operations: clusterName is undefined');
+        return;
+      }
+    }
+
+    this.set('timeoutId',
+      setTimeout(function(){
+        self.loadOperations();
+      }, delay)
+    );
+  },
+
   /**
    * Reload operations
    * We can call it manually <code>controller.loadOperations();</code>
@@ -95,16 +86,19 @@ App.BackgroundOperationsController = Em.
    */
   loadOperations : function(){
 
+    var timeoutId = this.get('timeoutId');
+    if(timeoutId){
+      clearTimeout(timeoutId);
+      this.set('timeoutId', null);
+    }
+
     if(!this.get('isWorking')){
       return;
     }
     var self = this;
 
     if(!App.router.getClusterName()){
-      console.log('clusterName is undefined')
-      setTimeout(function(){
-        self.loadOperations();
-      },1000);
+      this.loadOperationsDelayed(this.get('updateInterval')/2, 'error:clusterName');
       return;
     }
 
@@ -122,23 +116,11 @@ App.BackgroundOperationsController = Em.
         //refresh model
         self.updateBackgroundOperations(data);
 
-        //load data again if isWorking = true
-        if(self.get('isWorking')){
-          setTimeout(function(){
-            self.loadOperations();
-          }, self.get('updateInterval'));
-        }
+        self.loadOperationsDelayed();
       },
 
       error: function (request, ajaxOptions, error) {
-        console.log('cannot load background operations array');
-
-        //load data again if isWorking = true
-        if(self.get('isWorking')){
-          setTimeout(function(){
-            self.loadOperations();
-          }, self.get('updateInterval'));
-        }
+        self.loadOperationsDelayed(null, 'error:response error');
       },
 
       statusCode: require('data/statusCodes')
@@ -160,6 +142,10 @@ App.BackgroundOperationsController = Em.
       });
     });
 
+    runningTasks = runningTasks.sort(function(a,b){
+      return a.id - b.id;
+    });
+
     var currentTasks = this.get('allOperations');
 
     runningTasks.forEach(function(item){
@@ -204,6 +190,7 @@ App.BackgroundOperationsController = Em.
    * Onclick handler for background operations number located right to logo
    */
   showPopup: function(){
+    this.loadOperations();
     App.ModalPopup.show({
       headerClass: Ember.View.extend({
         controllerBinding: 'App.router.backgroundOperationsController',

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/cluster_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/cluster_controller.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/cluster_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/cluster_controller.js Sun Dec  9 14:21:37 2012
@@ -22,6 +22,24 @@ App.ClusterController = Em.Controller.ex
   name:'clusterController',
   cluster:null,
   isLoaded:false,
+  graphs: [],
+  graphsUpdate: function () {
+    if (!this.get('isLoaded')) return;
+    var self = this;
+    console.log('graphs updated', self.get('graphs'));
+    var interval = setInterval(function () {
+      self.get('graphs').forEach(function (_graph) {
+        var view = Em.View.views[_graph.id];
+        if (view) {
+          console.log('updated graph', _graph.name);
+          view.$(".chart-container").children().each(function (index, value) {
+            $(value).children().remove();
+          });
+          view.loadData();
+        }
+      })
+    }, App.graphUpdateInterval);
+  }.observes('isLoaded'),
   updateLoadStatus:function (item) {
     var loadList = this.get('dataLoadList');
     var loaded = true;
@@ -82,7 +100,7 @@ App.ClusterController = Em.Controller.ex
    *
    * If null is returned, it means GANGLIA service is not installed.
    */
-  gangliaUrl: function () {
+  gangliaUrl:function () {
     if (App.testMode) {
       return 'http://gangliaserver/ganglia/?t=yes';
     } else {
@@ -103,7 +121,7 @@ App.ClusterController = Em.Controller.ex
       }
       return null;
     }
-  }.property('dataLoadList.services'),
+  }.property('App.router.updateController.isUpdated'),
 
   /**
    * Provides the URL to use for NAGIOS server. This URL
@@ -126,14 +144,14 @@ App.ClusterController = Em.Controller.ex
           if (nagiosSvcComponent) {
             var hostName = nagiosSvcComponent.get('host.hostName');
             if (hostName) {
-              return "http://"+hostName+"/nagios";
+              return "http://" + hostName + "/nagios";
             }
           }
         }
       }
       return null;
     }
-  }.property('dataLoadList.services'),
+  }.property('App.router.updateController.isUpdated'),
 
   isNagiosInstalled:function () {
     if (App.testMode) {
@@ -143,7 +161,7 @@ App.ClusterController = Em.Controller.ex
       var nagiosSvc = svcs.findProperty("serviceName", "NAGIOS");
       return nagiosSvc != null;
     }
-  }.property('dataLoadList.services'),
+  }.property('App.router.updateController.isUpdated'),
 
   /**
    * Sorted list of alerts.
@@ -166,19 +184,19 @@ App.ClusterController = Em.Controller.ex
     return sortedArray;
   }.property('dataLoadList.alerts'),
 
-  loadRuns: function(){
-    if(this.get('postLoadList.runs')){
+  loadRuns:function () {
+    if (this.get('postLoadList.runs')) {
       return;
     }
 
-    var self= this;
+    var self = this;
     var runsUrl = App.testMode ? "/data/apps/runs.json" : App.apiPrefix + "/jobhistory/workflow";
 
     App.HttpClient.get(runsUrl, App.runsMapper, {
       complete:function (jqXHR, textStatus) {
         self.set('postLoadList.runs', true);
       }
-    }, function(){
+    }, function () {
       self.set('postLoadList.runs', true);
     });
   },
@@ -217,19 +235,56 @@ App.ClusterController = Em.Controller.ex
     }
   }.observes('nagiosUrl'),
 
-  updateStatus: function(){
+  componentsUpdateInterval: App.componentsUpdateInterval,
+
+  /**
+   * Whether we need to update statuses automatically or not
+   */
+  updateStatus: false,
+
+  statusTimeoutId: null,
+
+  loadUpdatedStatusDelayed: function(delay){
+    delay = delay || this.get('componentsUpdateInterval');
+    var self = this;
+
+    this.set('statusTimeoutId',
+      setTimeout(function(){
+        self.loadUpdatedStatus();
+      }, delay)
+    );
+  },
+
+  loadUpdatedStatus: function(){
+
+    var timeoutId = this.get('statusTimeoutId');
+    if(timeoutId){
+      clearTimeout(timeoutId);
+      this.set('statusTimeoutId', null);
+    }
+
+    if(!this.get('updateStatus')){
+      return false;
+    }
+
+    if(!this.get('clusterName')){
+      this.loadUpdatedStatusDelayed(this.get('componentsUpdateInterval')/2, 'error:clusterName');
+      return;
+    }
+    
     var servicesUrl1 = this.getUrl('/data/dashboard/services.json', '/services?ServiceInfo/service_name!=MISCELLANEOUS&ServiceInfo/service_name!=DASHBOARD&fields=*,components/host_components/*');
 
     var self = this;
     App.HttpClient.get(servicesUrl1, App.statusMapper, {
       complete:function (jqXHR, textStatus) {
-        console.log('update finished')
-        setTimeout(function(){
-          self.updateStatus();
-        }, 3000);
+        console.log('Cluster Controller: Updated components statuses successfully!!!')
+        self.loadUpdatedStatusDelayed();
       }
-    }, null);
-  },
+    }, function(){
+      self.loadUpdatedStatusDelayed(null, 'error:response error');
+    });
+
+  }.observes('updateStatus'),
 
   /**
    *
@@ -241,10 +296,12 @@ App.ClusterController = Em.Controller.ex
       return;
     }
 
+    if(this.get('isLoaded')) { // do not load data repeatedly
+      return;
+    }
+
     var clusterUrl = this.getUrl('/data/clusters/cluster.json', '?fields=Clusters');
     var hostsUrl = this.getUrl('/data/hosts/hosts.json', '/hosts?fields=*');
-    var servicesUrl1 = this.getUrl('/data/dashboard/services.json', '/services?ServiceInfo/service_name!=MISCELLANEOUS&ServiceInfo/service_name!=DASHBOARD&fields=*,components/host_components/*');
-    var servicesUrl2 = this.getUrl('/data/dashboard/serviceComponents.json', '/services?ServiceInfo/service_name!=MISCELLANEOUS&ServiceInfo/service_name!=DASHBOARD&fields=components/ServiceComponentInfo');
     var usersUrl = App.testMode ? '/data/users/users.json' : App.apiPrefix + '/users/?fields=*';
     var racksUrl = "/data/racks/racks.json";
 
@@ -280,125 +337,12 @@ App.ClusterController = Em.Controller.ex
       self.updateLoadStatus('users');
     });
 
-    //////////////////////////////
-    // Hack for services START  //
-    //////////////////////////////
-    var metricsJson = null;
-    var serviceComponentJson = null;
-    var metricsMapper = {
-      map:function (data) {
-        metricsJson = data;
-      }
-    };
-    var serviceComponentMapper = {
-      map:function (data) {
-        serviceComponentJson = data;
-        if (metricsJson != null && serviceComponentJson != null) {
-          var hdfsSvc1 = null;
-          var hdfsSvc2 = null;
-          var mrSvc1 = null;
-          var mrSvc2 = null;
-          var hbaseSvc1 = null;
-          var hbaseSvc2 = null;
-          metricsJson.items.forEach(function (svc) {
-            if (svc.ServiceInfo.service_name == "HDFS") {
-              hdfsSvc1 = svc;
-            }
-            if (svc.ServiceInfo.service_name == "MAPREDUCE") {
-              mrSvc1 = svc;
-            }
-            if (svc.ServiceInfo.service_name == "HBASE") {
-              hbaseSvc1 = svc;
-            }
-          });
-          serviceComponentJson.items.forEach(function (svc) {
-            if (svc.ServiceInfo.service_name == "HDFS") {
-              hdfsSvc2 = svc;
-            }
-            if (svc.ServiceInfo.service_name == "MAPREDUCE") {
-              mrSvc2 = svc;
-            }
-            if (svc.ServiceInfo.service_name == "HBASE") {
-              hbaseSvc2 = svc;
-            }
-          });
-          var nnC1 = null;
-          var nnC2 = null;
-          var jtC1 = null;
-          var jtC2 = null;
-          var hbm1 = null;
-          var hbm2 = null;
-          if (hdfsSvc1) {
-            hdfsSvc1.components.forEach(function (c) {
-              if (c.ServiceComponentInfo.component_name == "NAMENODE") {
-                nnC1 = c;
-              }
-            });
-          }
-          if (hdfsSvc2) {
-            hdfsSvc2.components.forEach(function (c) {
-              if (c.ServiceComponentInfo.component_name == "NAMENODE") {
-                nnC2 = c;
-              }
-            });
-          }
-          if (mrSvc1) {
-            mrSvc1.components.forEach(function (c) {
-              if (c.ServiceComponentInfo.component_name == "JOBTRACKER") {
-                jtC1 = c;
-              }
-            });
-          }
-          if (mrSvc2) {
-            mrSvc2.components.forEach(function (c) {
-              if (c.ServiceComponentInfo.component_name == "JOBTRACKER") {
-                jtC2 = c;
-              }
-            });
-          }
-          if (hbaseSvc1) {
-            hbaseSvc1.components.forEach(function (c) {
-              if (c.ServiceComponentInfo.component_name == "HBASE_MASTER") {
-                hbm1 = c;
-              }
-            });
-          }
-          if (hbaseSvc2) {
-            hbaseSvc2.components.forEach(function (c) {
-              if (c.ServiceComponentInfo.component_name == "HBASE_MASTER") {
-                hbm2 = c;
-              }
-            });
-          }
-          if (nnC1 && nnC2) {
-            nnC1.ServiceComponentInfo = nnC2.ServiceComponentInfo;
-          }
-          if (jtC1 && jtC2) {
-            jtC1.ServiceComponentInfo = jtC2.ServiceComponentInfo;
-          }
-          if (hbm1 && hbm2) {
-            hbm1.ServiceComponentInfo = hbm2.ServiceComponentInfo;
-          }
-          App.servicesMapper.map(metricsJson);
-          self.updateLoadStatus('services');
-        }
-      }
-    }
-    App.HttpClient.get(servicesUrl1, metricsMapper, {
-      complete:function (jqXHR, textStatus) {
-        App.HttpClient.get(servicesUrl2, serviceComponentMapper, {
-          complete:function (jqXHR, textStatus) {
-          }
-        });
-      }
-    });
-    /////////////////////////////
-    // Hack for services END   //
-    /////////////////////////////
+    //TODO: define dependencies and delete next line
+    self.updateLoadStatus('services');
 
     setTimeout(function(){
-      self.updateStatus();
-    }, 8000);
+      self.set('updateStatus', true);
+    }, this.get('componentsUpdateInterval')*2);
 
   },
 

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/update_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/update_controller.js?rev=1418969&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/update_controller.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/update_controller.js Sun Dec  9 14:21:37 2012
@@ -0,0 +1,150 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.UpdateController = Em.Controller.extend({
+  name:'updateController',
+  isUpdated:false,
+  getUrl:function (testUrl, url) {
+    return (App.testMode) ? testUrl : App.apiPrefix + '/clusters/' + this.get('clusterName') + url;
+  },
+
+  updateServiceMetric:function(){
+
+    var servicesUrl1 = this.getUrl('/data/dashboard/services.json', '/services?ServiceInfo/service_name!=MISCELLANEOUS&ServiceInfo/service_name!=DASHBOARD&fields=*,components/host_components/*');
+    var servicesUrl2 = this.getUrl('/data/dashboard/serviceComponents.json', '/services?ServiceInfo/service_name!=MISCELLANEOUS&ServiceInfo/service_name!=DASHBOARD&fields=components/ServiceComponentInfo');
+
+
+    self = this;
+    this.set("isUpdated", false);
+
+    var metricsJson = null;
+    var serviceComponentJson = null;
+    var metricsMapper = {
+      map:function (data) {
+        metricsJson = data;
+      }
+    };
+    var serviceComponentMapper = {
+      map:function (data) {
+        serviceComponentJson = data;
+        if (metricsJson != null && serviceComponentJson != null) {
+          var hdfsSvc1 = null;
+          var hdfsSvc2 = null;
+          var mrSvc1 = null;
+          var mrSvc2 = null;
+          var hbaseSvc1 = null;
+          var hbaseSvc2 = null;
+          metricsJson.items.forEach(function (svc) {
+            if (svc.ServiceInfo.service_name == "HDFS") {
+              hdfsSvc1 = svc;
+            }
+            if (svc.ServiceInfo.service_name == "MAPREDUCE") {
+              mrSvc1 = svc;
+            }
+            if (svc.ServiceInfo.service_name == "HBASE") {
+              hbaseSvc1 = svc;
+            }
+          });
+          serviceComponentJson.items.forEach(function (svc) {
+            if (svc.ServiceInfo.service_name == "HDFS") {
+              hdfsSvc2 = svc;
+            }
+            if (svc.ServiceInfo.service_name == "MAPREDUCE") {
+              mrSvc2 = svc;
+            }
+            if (svc.ServiceInfo.service_name == "HBASE") {
+              hbaseSvc2 = svc;
+            }
+          });
+          var nnC1 = null;
+          var nnC2 = null;
+          var jtC1 = null;
+          var jtC2 = null;
+          var hbm1 = null;
+          var hbm2 = null;
+          if (hdfsSvc1) {
+            hdfsSvc1.components.forEach(function (c) {
+              if (c.ServiceComponentInfo.component_name == "NAMENODE") {
+                nnC1 = c;
+              }
+            });
+          }
+          if (hdfsSvc2) {
+            hdfsSvc2.components.forEach(function (c) {
+              if (c.ServiceComponentInfo.component_name == "NAMENODE") {
+                nnC2 = c;
+              }
+            });
+          }
+          if (mrSvc1) {
+            mrSvc1.components.forEach(function (c) {
+              if (c.ServiceComponentInfo.component_name == "JOBTRACKER") {
+                jtC1 = c;
+              }
+            });
+          }
+          if (mrSvc2) {
+            mrSvc2.components.forEach(function (c) {
+              if (c.ServiceComponentInfo.component_name == "JOBTRACKER") {
+                jtC2 = c;
+              }
+            });
+          }
+          if (hbaseSvc1) {
+            hbaseSvc1.components.forEach(function (c) {
+              if (c.ServiceComponentInfo.component_name == "HBASE_MASTER") {
+                hbm1 = c;
+              }
+            });
+          }
+          if (hbaseSvc2) {
+            hbaseSvc2.components.forEach(function (c) {
+              if (c.ServiceComponentInfo.component_name == "HBASE_MASTER") {
+                hbm2 = c;
+              }
+            });
+          }
+          if (nnC1 && nnC2) {
+            nnC1.ServiceComponentInfo = nnC2.ServiceComponentInfo;
+          }
+          if (jtC1 && jtC2) {
+            jtC1.ServiceComponentInfo = jtC2.ServiceComponentInfo;
+          }
+          if (hbm1 && hbm2) {
+            hbm1.ServiceComponentInfo = hbm2.ServiceComponentInfo;
+          }
+          App.updateMapper.map(metricsJson);
+
+        }
+      }
+    }
+    App.HttpClient.get(servicesUrl1, metricsMapper, {
+      complete:function (jqXHR, textStatus) {
+        App.HttpClient.get(servicesUrl2, serviceComponentMapper, {
+          complete:function (jqXHR, textStatus) {
+            self.set("isUpdated", true);
+          }
+        });
+      }
+    });
+  }
+
+
+});

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js Sun Dec  9 14:21:37 2012
@@ -842,6 +842,7 @@ App.InstallerController = Em.Controller.
     App.db.setMasterComponentHosts(undefined);
     App.db.setSlaveComponentHosts(undefined);
     App.db.setClusterStatus(undefined);
+    App.db.setAllHostNames(undefined);
   }
 
 });

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/login_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/login_controller.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/login_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/login_controller.js Sun Dec  9 14:21:37 2012
@@ -27,6 +27,7 @@ App.LoginController = Em.Object.extend({
 
   errorMessage: '',
 
+
   submit: function (e) {
     this.set('errorMessage', '');
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.js Sun Dec  9 14:21:37 2012
@@ -30,6 +30,13 @@ App.MainController = Em.Controller.exten
   initialize: function(){
     this.startLoadOperationsPeriodically();
     App.router.get('clusterController').loadClusterData();
+    App.router.get('updateController').updateServiceMetric();
+    setInterval(
+      this.updateServiceMetric
+    , App.services_update);
+  },
+  updateServiceMetric: function(){
+    App.router.get('updateController').updateServiceMetric();
   },
   startLoadOperationsPeriodically: function() {
       App.router.get('backgroundOperationsController').set('isWorking', true);

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host.js Sun Dec  9 14:21:37 2012
@@ -18,9 +18,6 @@
 
 var App = require('app');
 var validator = require('utils/validator');
-require('models/service');
-require('models/cluster');
-require('models/host');
 
 App.MainHostController = Em.ArrayController.extend(App.Pagination, {
   name:'mainHostController',
@@ -28,6 +25,9 @@ App.MainHostController = Em.ArrayControl
   fullContent:App.Host.find(),
   clusters:App.Cluster.find(),
   //componentsForFilter: App.Component.find(),
+  isAdmin: function(){
+    return App.db.getUser().admin;
+  }.property('App.router.loginController.loginName'),
   componentsForFilter:function() {
     var components = App.Component.find();
     ret = new Array();

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js Sun Dec  9 14:21:37 2012
@@ -43,7 +43,8 @@ App.AddHostController = Em.Controller.ex
     masterComponentHosts: null,
     serviceConfigProperties: null,
     advancedServiceConfig: null,
-    controllerName: 'addHostController'
+    controllerName: 'addHostController',
+    isWizard: true
   }),
 
   /**
@@ -127,18 +128,6 @@ App.AddHostController = Em.Controller.ex
     return this.get('currentStep') == 7;
   }.property('currentStep'),
 
-  isStep8: function () {
-    return this.get('currentStep') == 8;
-  }.property('currentStep'),
-
-  isStep9: function () {
-    return this.get('currentStep') == 9;
-  }.property('currentStep'),
-
-  isStep10: function () {
-    return this.get('currentStep') == 10;
-  }.property('currentStep'),
-
   gotoStep: function (step) {
     if (this.get('isStepDisabled').findProperty('step', step).get('value') === false) {
       App.router.send('gotoStep' + step);
@@ -173,27 +162,22 @@ App.AddHostController = Em.Controller.ex
     this.gotoStep(7);
   },
 
-  gotoStep8: function () {
-    this.gotoStep(8);
-  },
-
-  gotoStep9: function () {
-    this.gotoStep(9);
-  },
-
-  gotoStep10: function () {
-    this.gotoStep(10);
-  },
-
   /**
    * Load clusterInfo(step1) to model
    */
   loadClusterInfo: function(){
-    var cluster = {
-      name: App.router.getClusterName(),
-      status: "",
-      isCompleted: true
-    };
+    var cluster = App.db.getClusterStatus();
+    if(!cluster){
+      cluster = {
+        name: App.router.getClusterName(),
+        status: undefined,
+        isCompleted: false,
+        requestId: undefined,
+        installStartTime: undefined,
+        installTime: undefined
+      };
+      App.db.setClusterStatus(cluster);
+    }
     this.set('content.cluster', cluster);
     console.log("AddHostController:loadClusterInfo: loaded data ", cluster);
   },
@@ -306,16 +290,6 @@ App.AddHostController = Em.Controller.ex
   saveConfirmedHosts: function (stepController) {
     var hostInfo = {};
 
-    App.Host.find().forEach(function(_host){
-      hostInfo[_host.get('id')] = {
-        name: _host.get('hostName'),
-        cpu: _host.get('cpu'),
-        memory: _host.get('memory'),
-        bootStatus: 'success',
-        isInstalled: true
-      };
-    });
-
     stepController.get('content.hostsInfo').forEach(function (_host) {
       hostInfo[_host.name] = {
         name: _host.name,
@@ -349,10 +323,11 @@ App.AddHostController = Em.Controller.ex
     var hostInfo = App.db.getHosts();
 
     for (var index in hostInfo) {
-      hostInfo[index].status = "pending";
       var host = hosts.findProperty('name', hostInfo[index].name);
       if (host) {
         hostInfo[index].status = host.status;
+        hostInfo[index].logTasks = host.logTasks;
+        hostInfo[index].tasks = host.tasks;
         hostInfo[index].message = host.message;
         hostInfo[index].progress = host.progress;
       }
@@ -385,48 +360,22 @@ App.AddHostController = Em.Controller.ex
    */
   loadServices: function () {
     var servicesInfo = App.db.getService();
+    if(!servicesInfo || !servicesInfo.length){
+      servicesInfo = require('data/mock/services').slice(0);
+      servicesInfo.forEach(function (item) {
+        item.isSelected = App.Service.find().someProperty('id', item.serviceName)
+        item.isInstalled = item.isSelected;
+        item.isDisabled = item.isSelected;
+      });
+      App.db.setService(servicesInfo);
+    }
+
     servicesInfo.forEach(function (item, index) {
       servicesInfo[index] = Em.Object.create(item);
     });
     this.set('content.services', servicesInfo);
-    console.log('addHostController.loadServices: loaded data ', servicesInfo);
-    console.log('selected services ', servicesInfo.filterProperty('isSelected', true).mapProperty('serviceName'));
-  },
-
-  /**
-   * Save data to model
-   * @param stepController App.WizardStep4Controller
-   */
-  saveServices: function (stepController) {
-    var serviceNames = [];
-    // we can also do it without stepController since all data,
-    // changed at page, automatically changes in model(this.content.services)
-    App.db.setService(stepController.get('content'));
-    stepController.filterProperty('isSelected', true).forEach(function (item) {
-      serviceNames.push(item.serviceName);
-    });
-    App.db.setSelectedServiceNames(serviceNames);
-    console.log('addHostController.saveServices: saved data ', serviceNames);
-  },
-
-  /**
-   * Save Master Component Hosts data to Main Controller
-   * @param stepController App.WizardStep5Controller
-   */
-  saveMasterComponentHosts: function (stepController) {
-    var obj = stepController.get('selectedServicesMasters');
-    var masterComponentHosts = [];
-    obj.forEach(function (_component) {
-      masterComponentHosts.push({
-        display_name: _component.display_name,
-        component: _component.component_name,
-        hostName: _component.selectedHost
-      });
-    });
-
-    console.log("AddHostController.saveComponentHosts: saved hosts ", masterComponentHosts);
-    App.db.setMasterComponentHosts(masterComponentHosts);
-    this.set('content.masterComponentHosts', masterComponentHosts);
+    console.log('AddHostController.loadServices: loaded data ', servicesInfo);
+    console.log('selected services ', servicesInfo.filterProperty('isSelected', true).filterProperty('isDisabled', false).mapProperty('serviceName'));
   },
 
   /**
@@ -434,6 +383,19 @@ App.AddHostController = Em.Controller.ex
    */
   loadMasterComponentHosts: function () {
     var masterComponentHosts = App.db.getMasterComponentHosts();
+    if (!masterComponentHosts) {
+      masterComponentHosts = [];
+      App.Component.find().filterProperty('isMaster', true).forEach(function(item){
+        masterComponentHosts.push({
+          component: item.get('componentName'),
+          hostName: item.get('host.hostName'),
+          isInstalled: true,
+          serviceId: item.get('service.id'),
+          display_name: item.get('displayName')
+        })
+      });
+      App.db.setMasterComponentHosts(masterComponentHosts);
+    }
     this.set("content.masterComponentHosts", masterComponentHosts);
     console.log("AddHostController.loadMasterComponentHosts: loaded hosts ", masterComponentHosts);
   },
@@ -632,17 +594,27 @@ App.AddHostController = Em.Controller.ex
     this.set('content.clients', clients);
     console.log("AddHostController.loadClients: loaded list ", clients);
   },
-
+  dataLoading: function(){
+    var dfd = $.Deferred();
+    this.connectOutlet('loading');
+    var interval = setInterval(function(){
+      if (App.router.get('clusterController.isLoaded')){
+        dfd.resolve();
+        clearInterval(interval);
+      }
+    },50);
+    return dfd.promise();
+  },
   /**
    * Generate clients list for selected services and save it to model
    * @param stepController step4WizardController
    */
-  saveClients: function(stepController){
+  saveClients: function(){
     var clients = [];
     var serviceComponents = require('data/service_components');
     var hostComponents = App.HostComponent.find();
 
-    stepController.get('content').filterProperty('isSelected',true).forEach(function (_service) {
+    this.get('content.services').filterProperty('isSelected',true).forEach(function (_service) {
       var client = serviceComponents.filterProperty('service_name', _service.serviceName).findProperty('isClient', true);
       if (client) {
         clients.pushObject({
@@ -667,17 +639,17 @@ App.AddHostController = Em.Controller.ex
       case '8':
       case '7':
       case '6':
-        this.loadServiceConfigProperties();
       case '5':
-        this.loadClients();
       case '4':
-        this.loadMasterComponentHosts();
-        this.loadSlaveComponentHosts();
-        this.loadConfirmedHosts();
+        this.loadServiceConfigProperties();
       case '3':
         this.loadClients();
         this.loadServices();
+        this.loadMasterComponentHosts();
+        this.loadSlaveComponentHosts();
+        this.loadConfirmedHosts();
       case '2':
+        this.loadServices();
         this.loadConfirmedHosts();
       case '1':
         this.loadInstallOptions();
@@ -687,7 +659,7 @@ App.AddHostController = Em.Controller.ex
   },
 
   loadAdvancedConfigs: function () {
-    App.db.getSelectedServiceNames().forEach(function (_serviceName) {
+    this.get('content.services').filterProperty('isSelected', true).mapProperty('serviceName').forEach(function (_serviceName) {
       this.loadAdvancedConfig(_serviceName);
     }, this);
   },
@@ -814,6 +786,7 @@ App.AddHostController = Em.Controller.ex
     App.db.setHosts(undefined);
     App.db.setMasterComponentHosts(undefined);
     App.db.setSlaveComponentHosts(undefined);
+    App.db.setClusterStatus(undefined);
   }
 
 });

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/details.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/details.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/details.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/details.js Sun Dec  9 14:21:37 2012
@@ -22,7 +22,9 @@ App.MainHostDetailsController = Em.Contr
   name: 'mainHostDetailsController',
   content: null,
   isFromHosts: false,
-
+  isAdmin: function(){
+    return App.db.getUser().admin;
+  }.property('App.router.loginController.loginName'),
   routeHome:function () {
     App.router.transitionTo('main.dashboard');
   },
@@ -89,13 +91,14 @@ App.MainHostDetailsController = Em.Contr
           }
 
           console.log('Send request for STARTING successfully');
-          component.set('workStatus', App.Component.Status.starting);
 
           if(App.testMode){
+            component.set('workStatus', App.Component.Status.starting);
             setTimeout(function(){
               component.set('workStatus', App.Component.Status.started);
             },10000);
           } else{
+            App.router.get('clusterController').loadUpdatedStatus();
             App.router.get('backgroundOperationsController.eventsArray').push({
               "when" : function(controller){
                 var result = (controller.getOperationsForRequestId(requestId).length == 0);
@@ -103,7 +106,7 @@ App.MainHostDetailsController = Em.Contr
                 return result;
               },
               "do" : function(){
-                component.set('workStatus', App.Component.Status.started);
+                App.router.get('clusterController').loadUpdatedStatus();
               }
             });
           }
@@ -140,13 +143,15 @@ App.MainHostDetailsController = Em.Contr
 
           console.log('Send request for STOPPING successfully');
 
-          component.set('workStatus', App.Component.Status.stopping);
+
 
           if(App.testMode){
+            component.set('workStatus', App.Component.Status.stopping);
             setTimeout(function(){
               component.set('workStatus', App.Component.Status.stopped);
             },10000);
           } else{
+            App.router.get('clusterController').loadUpdatedStatus();
             App.router.get('backgroundOperationsController.eventsArray').push({
               "when" : function(controller){
                 var result = (controller.getOperationsForRequestId(requestId).length == 0);
@@ -154,7 +159,7 @@ App.MainHostDetailsController = Em.Contr
                 return result;
               },
               "do" : function(){
-                component.set('workStatus', App.Component.Status.stopped);
+                App.router.get('clusterController').loadUpdatedStatus();
               }
             });
           }

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service.js Sun Dec  9 14:21:37 2012
@@ -21,5 +21,8 @@ var App = require('app');
 App.MainServiceController = Em.ArrayController.extend({
   name:'mainServiceController',
   content: App.Service.find(),
-  additionalMenuItem:Em.Object.create({ id:'Clients', displayName:'Clients', isClients:true })
+  additionalMenuItem:Em.Object.create({ id:'Clients', displayName:'Clients', isClients:true }),
+  isAdmin: function(){
+    return App.db.getUser().admin;
+  }.property('App.router.loginController.loginName')
 })
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js Sun Dec  9 14:21:37 2012
@@ -345,13 +345,13 @@ App.AddServiceController = Em.Controller
     var masterComponentHosts = App.db.getMasterComponentHosts();
     if(!masterComponentHosts){
       masterComponentHosts = [];
-    App.Component.find().filterProperty('isMaster', true).forEach(function(item){
-      masterComponentHosts.push({
-        component: item.get('componentName'),
-        hostName: item.get('host.hostName'),
-        isInstalled: true
-      })
-    });
+      App.Component.find().filterProperty('isMaster', true).forEach(function(item){
+        masterComponentHosts.push({
+          component: item.get('componentName'),
+          hostName: item.get('host.hostName'),
+          isInstalled: true
+        })
+      });
 
     }
     this.set("content.masterComponentHosts", masterComponentHosts);
@@ -756,6 +756,7 @@ App.AddServiceController = Em.Controller
     App.db.setMasterComponentHosts(undefined);
     App.db.setSlaveComponentHosts(undefined);
     App.db.setClusterStatus(undefined);
+    App.db.setAllHostNames(undefined);
   }
 
 });

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/info/configs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/info/configs.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/info/configs.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/info/configs.js Sun Dec  9 14:21:37 2012
@@ -74,7 +74,7 @@ App.MainServiceInfoConfigsController = E
     }, this)
     //STEP 5: Add the advanced configs to the serviceConfigs property
 
-    var advancedConfig = App.router.get('installerController').loadAdvancedConfig(this.get('content.serviceName'));
+    var advancedConfig = App.router.get('installerController').loadAdvancedConfig(this.get('content.serviceName')) || [];
     var service = this.get('serviceConfigs').findProperty('serviceName', this.get('content.serviceName'));
     advancedConfig.forEach(function (_config) {
       if (service) {
@@ -99,6 +99,7 @@ App.MainServiceInfoConfigsController = E
         }
       }
     }, this);
+
     this.loadCustomConfig();
 
     this.renderServiceConfigs(this.get('serviceConfigs'));
@@ -266,6 +267,7 @@ App.MainServiceInfoConfigsController = E
    * @param serviceConfigs
    */
   renderServiceConfigs: function (serviceConfigs) {
+
     serviceConfigs.forEach(function (_serviceConfig) {
       var serviceConfig = App.ServiceConfig.create({
         filename: _serviceConfig.filename,
@@ -276,6 +278,7 @@ App.MainServiceInfoConfigsController = E
       });
 
       if (this.get('content.serviceName') && this.get('content.serviceName').toUpperCase() === serviceConfig.serviceName) {
+
         this.loadComponentConfigs(_serviceConfig, serviceConfig);
 
         console.log('pushing ' + serviceConfig.serviceName);
@@ -294,14 +297,18 @@ App.MainServiceInfoConfigsController = E
    * @param _componentConfig
    * @param componentConfig
    */
-  loadComponentConfigs: function (_componentConfig, componentConfig) {
+  loadComponentConfigs: function (_componentConfig, componentConfig) {debugger;
     _componentConfig.configs.forEach(function (_serviceConfigProperty) {
+      console.log("config", _serviceConfigProperty);
+      if(!_serviceConfigProperty) return;
       var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
       serviceConfigProperty.serviceConfig = componentConfig;
       this.initialValue(serviceConfigProperty);
       componentConfig.configs.pushObject(serviceConfigProperty);
       serviceConfigProperty.validate();
+      console.log("config result", serviceConfigProperty);
     }, this);
+    console.log("+++++++++++++++++++++++++++++++++++++++++");
   },
 
   restartServicePopup: function (event) {

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/item.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/item.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/item.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/item.js Sun Dec  9 14:21:37 2012
@@ -20,7 +20,9 @@ var App = require('app');
 
 App.MainServiceItemController = Em.Controller.extend({
   name: 'mainServiceItemController',
-
+  isAdmin: function(){
+    return App.db.getUser().admin;
+  }.property('App.router.loginController.loginName'),
   /**
    * Send specific command to server
    * @param url
@@ -83,14 +85,15 @@ App.MainServiceItemController = Em.Contr
           if (!requestId) {
             return;
           }
-
-          self.content.set('workStatus', App.Service.Health.starting);
           console.log('Send request for STARTING successfully');
+
           if (App.testMode) {
+            self.content.set('workStatus', App.Service.Health.starting);
             setTimeout(function () {
               self.content.set('workStatus', App.Service.Health.live);
             }, 10000);
           } else {
+            App.router.get('clusterController').loadUpdatedStatus();
             App.router.get('backgroundOperationsController.eventsArray').push({
               "when": function (controller) {
                 var result = (controller.getOperationsForRequestId(requestId).length == 0);
@@ -98,7 +101,7 @@ App.MainServiceItemController = Em.Contr
                 return result;
               },
               "do": function () {
-                self.content.set('workStatus', App.Service.Health.live);
+                App.router.get('clusterController').loadUpdatedStatus();
               }
             });
           }
@@ -137,12 +140,13 @@ App.MainServiceItemController = Em.Contr
             return
           }
           console.log('Send request for STOPPING successfully');
-          self.content.set('workStatus', App.Service.Health.stopping);
           if (App.testMode) {
+            self.content.set('workStatus', App.Service.Health.stopping);
             setTimeout(function () {
               self.content.set('workStatus', App.Service.Health.dead);
             }, 10000);
           } else {
+            App.router.get('clusterController').loadUpdatedStatus();
             App.router.get('backgroundOperationsController.eventsArray').push({
               "when": function (controller) {
                 var result = (controller.getOperationsForRequestId(requestId).length == 0);
@@ -150,7 +154,7 @@ App.MainServiceItemController = Em.Contr
                 return result;
               },
               "do": function () {
-                self.content.set('workStatus', App.Service.Health.dead);
+                App.router.get('clusterController').loadUpdatedStatus();
               }
             });
           }

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js Sun Dec  9 14:21:37 2012
@@ -20,30 +20,30 @@ var App = require('app');
 
 App.WizardStep5Controller = Em.Controller.extend({
 
-  name: "wizardStep5Controller",
+  name:"wizardStep5Controller",
 
-  hosts: [],
+  hosts:[],
 
-  selectedServices: [],
-  selectedServicesMasters: [],
-  zId: 0,
+  selectedServices:[],
+  selectedServicesMasters:[],
+  zId:0,
 
-  components: require('data/service_components'),
+  components:require('data/service_components'),
 
-  clearStep: function () {
+  clearStep:function () {
     this.set('hosts', []);
     this.set('selectedServices', []);
     this.set('selectedServicesMasters', []);
     this.set('zId', 0);
   },
 
-  loadStep: function () {
+  loadStep:function () {
     console.log("WizardStep5Controller: Loading step5: Assign Masters");
     this.clearStep();
     this.renderHostInfo();
     this.renderComponents(this.loadComponents());
 
-    if(!this.get("selectedServicesMasters").filterProperty('isInstalled', false).length){
+    if (!this.get("selectedServicesMasters").filterProperty('isInstalled', false).length) {
       console.log('no master components to add');
       App.router.send('next');
     }
@@ -52,19 +52,32 @@ App.WizardStep5Controller = Em.Controlle
   /**
    * Load active host list to <code>hosts</code> variable
    */
-  renderHostInfo: function () {
+  renderHostInfo:function () {
 
     var hostInfo = this.get('content.hostsInfo');
 
     for (var index in hostInfo) {
       var _host = hostInfo[index];
       if (_host.bootStatus === 'success' || true) {  // TODO: remove "true" after integrating with bootstrap
-
         var hostObj = Ember.Object.create({
-          host_name: _host.name,
-          cpu: _host.cpu,
-          memory: _host.memory,
-          host_info: "%@ (%@, %@ cores)".fmt(_host.name, (_host.memory * 1024).bytesToSize(1, 'parseFloat'), _host.cpu)
+          host_name:_host.name,
+
+          cpu:_host.cpu,
+          memory:_host.memory,
+          host_info:"%@ (%@, %@ cores)".fmt(_host.name, (_host.memory * 1024).bytesToSize(1, 'parseFloat'), _host.cpu)
+
+//          Uncomment to test sorting with random cpu, memory, host_info
+//          cpu:function () {
+//            return parseInt(2 + Math.random() * 4);
+//          }.property(),
+//          memory:function () {
+//            return parseInt((Math.random() * 4000000000) + 4000000000);
+//          }.property(),
+//
+//          host_info:function () {
+//            return "%@ (%@, %@ cores)".fmt(this.get('host_name'), (this.get('memory') * 1024).bytesToSize(1, 'parseFloat'), this.get('cpu'));
+//          }.property('cpu', 'memory')
+
         });
 
         this.get("hosts").pushObject(hostObj);
@@ -76,13 +89,13 @@ App.WizardStep5Controller = Em.Controlle
    * Load services info to appropriate variable and return masterComponentHosts
    * @return {Ember.Set}
    */
-  loadComponents: function () {
+  loadComponents:function () {
 
     var services = this.get('content.services')
       .filterProperty('isSelected', true).mapProperty('serviceName'); //list of shown services
 
     services.forEach(function (item) {
-      this.get("selectedServices").pushObject(Ember.Object.create({service_name: item}));
+      this.get("selectedServices").pushObject(Ember.Object.create({service_name:item}));
     }, this);
 
     var masterHosts = this.get('content.masterComponentHosts'); //saved to local storadge info
@@ -97,11 +110,11 @@ App.WizardStep5Controller = Em.Controlle
 
       componentInfo.forEach(function (_componentInfo) {
 
-        if(_componentInfo.component_name == 'ZOOKEEPER_SERVER'){
+        if (_componentInfo.component_name == 'ZOOKEEPER_SERVER') {
           var savedComponents = masterHosts.filterProperty('component', _componentInfo.component_name);
-          if(savedComponents.length){
+          if (savedComponents.length) {
 
-            savedComponents.forEach(function(item){
+            savedComponents.forEach(function (item) {
               var zooKeeperHost = {};
               zooKeeperHost.display_name = _componentInfo.display_name;
               zooKeeperHost.component_name = _componentInfo.component_name;
@@ -112,7 +125,7 @@ App.WizardStep5Controller = Em.Controlle
               resultComponents.add(zooKeeperHost);
             })
 
-          } else{
+          } else {
 
             var zooHosts = this.selectHost(_componentInfo.component_name);
             zooHosts.forEach(function (_host) {
@@ -148,7 +161,7 @@ App.WizardStep5Controller = Em.Controlle
    * Put master components to <code>selectedServicesMasters</code>, which will be automatically rendered in template
    * @param masterComponents
    */
-  renderComponents: function (masterComponents) {
+  renderComponents:function (masterComponents) {
     var zookeeperComponent = null, componentObj = null;
     var services = this.get('selectedServicesMasters').slice(0);
     if (services.length) {
@@ -180,7 +193,7 @@ App.WizardStep5Controller = Em.Controlle
 
   },
 
-  getKerberosServer: function (noOfHosts) {
+  getKerberosServer:function (noOfHosts) {
     var hosts = this.get('hosts');
     if (noOfHosts === 1) {
       return hosts[0];
@@ -195,12 +208,12 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  getNameNode: function (noOfHosts) {
+  getNameNode:function (noOfHosts) {
     var hosts = this.get('hosts');
     return hosts[0];
   },
 
-  getSNameNode: function (noOfHosts) {
+  getSNameNode:function (noOfHosts) {
     var hosts = this.get('hosts');
     if (noOfHosts === 1) {
       return hosts[0];
@@ -209,7 +222,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  getJobTracker: function (noOfHosts) {
+  getJobTracker:function (noOfHosts) {
     var hosts = this.get('hosts');
     if (noOfHosts === 1) {
       return hosts[0];
@@ -224,7 +237,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  getHBaseMaster: function (noOfHosts) {
+  getHBaseMaster:function (noOfHosts) {
     var hosts = this.get('hosts');
     if (noOfHosts === 1) {
       return hosts[0];
@@ -239,7 +252,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  getOozieServer: function (noOfHosts) {
+  getOozieServer:function (noOfHosts) {
     var hosts = this.get('hosts');
     if (noOfHosts === 1) {
       return hosts[0];
@@ -254,7 +267,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  getOozieServer: function (noOfHosts) {
+  getOozieServer:function (noOfHosts) {
     var hosts = this.get('hosts');
     if (noOfHosts === 1) {
       return hosts[0];
@@ -269,7 +282,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  getHiveServer: function (noOfHosts) {
+  getHiveServer:function (noOfHosts) {
     var hosts = this.get('hosts');
     if (noOfHosts === 1) {
       return hosts[0];
@@ -284,7 +297,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  getTempletonServer: function (noOfHosts) {
+  getTempletonServer:function (noOfHosts) {
     var hosts = this.get('hosts');
     if (noOfHosts === 1) {
       return hosts[0];
@@ -299,7 +312,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  getZooKeeperServer: function (noOfHosts) {
+  getZooKeeperServer:function (noOfHosts) {
     var hosts = this.get('hosts');
     if (noOfHosts < 3) {
       return [hosts[0].host_name];
@@ -308,7 +321,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  getGangliaServer: function (noOfHosts) {
+  getGangliaServer:function (noOfHosts) {
     var hosts = this.get('hosts');
     var hostnames = [];
     var inc = 0;
@@ -324,7 +337,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  getNagiosServer: function (noOfHosts) {
+  getNagiosServer:function (noOfHosts) {
     var hosts = this.get('hosts');
     var hostnames = [];
     var inc = 0;
@@ -346,7 +359,7 @@ App.WizardStep5Controller = Em.Controlle
    * @param componentName
    * @return {*}
    */
-  selectHost: function (componentName) {
+  selectHost:function (componentName) {
     var noOfHosts = this.get('hosts').length;
     if (componentName === 'KERBEROS_SERVER') {
       return this.getKerberosServer(noOfHosts).host_name;
@@ -373,8 +386,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-
-  masterHostMapping: function () {
+  masterHostMapping:function () {
     var mapping = [], mappingObject, self = this, mappedHosts, hostObj, hostInfo;
     //get the unique assigned hosts and find the master services assigned to them
 
@@ -385,9 +397,9 @@ App.WizardStep5Controller = Em.Controlle
       console.log("Name of the host is: " + hostObj.host_name);
 
       mappingObject = Ember.Object.create({
-        host_name: item,
-        hostInfo: hostObj.host_info,
-        masterServices: self.get("selectedServicesMasters").filterProperty("selectedHost", item)
+        host_name:item,
+        hostInfo:hostObj.host_info,
+        masterServices:self.get("selectedServicesMasters").filterProperty("selectedHost", item)
       });
 
       mapping.pushObject(mappingObject);
@@ -399,16 +411,16 @@ App.WizardStep5Controller = Em.Controlle
 
   }.property("selectedServicesMasters.@each.selectedHost"),
 
-  remainingHosts: function () {
+  remainingHosts:function () {
     return (this.get("hosts.length") - this.get("masterHostMapping.length"));
   }.property("selectedServicesMasters.@each.selectedHost"),
 
-  hasZookeeper: function () {
+  hasZookeeper:function () {
     return this.selectedServices.findProperty("service_name", "ZooKeeper");
   }.property("selectedServices"),
 
   //methods
-  getAvailableHosts: function (componentName) {
+  getAvailableHosts:function (componentName) {
     var assignableHosts = [],
       zookeeperHosts = null;
 
@@ -426,7 +438,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  assignHostToMaster: function (masterService, selectedHost, zId) {
+  assignHostToMaster:function (masterService, selectedHost, zId) {
     if (selectedHost && masterService) {
       if ((masterService === "ZooKeeper") && zId) {
         this.get('selectedServicesMasters').findProperty("zId", zId).set("selectedHost", selectedHost);
@@ -439,7 +451,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  lastZooKeeper: function () {
+  lastZooKeeper:function () {
     var currentZooKeepers = this.get("selectedServicesMasters").filterProperty("display_name", "ZooKeeper");
     if (currentZooKeepers) {
       return currentZooKeepers.get("lastObject");
@@ -448,7 +460,7 @@ App.WizardStep5Controller = Em.Controlle
     return null;
   },
 
-  addZookeepers: function () {
+  addZookeepers:function () {
     /*
      *Logic: If ZooKeeper service is selected then there can be
      * minimum 1 ZooKeeper master in total, and
@@ -513,7 +525,7 @@ App.WizardStep5Controller = Em.Controlle
     return false;//if no more zookeepers can be added
   },
 
-  removeZookeepers: function (zId) {
+  removeZookeepers:function (zId) {
     var currentZooKeepers;
 
     //work only if the Zookeeper service is selected in previous step
@@ -544,7 +556,7 @@ App.WizardStep5Controller = Em.Controlle
 
   },
 
-  rebalanceZookeeperHosts: function () {
+  rebalanceZookeeperHosts:function () {
     //for a zookeeper update the available hosts for the other zookeepers
 
     var currentZooKeepers = this.get("selectedServicesMasters").filterProperty("display_name", "ZooKeeper"),
@@ -567,7 +579,7 @@ App.WizardStep5Controller = Em.Controlle
     }, this);
   },
 
-  sortHostsByConfig: function (a, b) {
+  sortHostsByConfig:function (a, b) {
     //currently handling only total memory on the host
     if (a.memory < b.memory) {
       return 1;
@@ -577,7 +589,7 @@ App.WizardStep5Controller = Em.Controlle
     }
   },
 
-  sortHostsByName: function (a, b) {
+  sortHostsByName:function (a, b) {
     if (a.host_name > b.host_name) {
       return 1;
     }

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js Sun Dec  9 14:21:37 2012
@@ -303,6 +303,10 @@ App.WizardStep6Controller = Em.Controlle
       || ( this.get('isMrSelected') && this.get('isNoTaskTrackers'))
       || ( this.get('isHbSelected') && this.get('isNoRegionServers'));
 
+    if(this.get('content.isWizard')){
+      isError = false;
+    }
+
     if (isError) {
       this.set('errorMessage', Ember.I18n.t('installer.step6.error.mustSelectOne'));
     }

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js Sun Dec  9 14:21:37 2012
@@ -651,6 +651,7 @@ App.WizardStep8Controller = Em.Controlle
 
   },
 
+  // TODO: aggregate create calls.  doesn't seem like backend supports creating multiple services at the same time yet.
   createSelectedServices: function () {
     var services = this.get('selectedServices').mapProperty('serviceName');
     services.forEach(function (_service) {
@@ -690,37 +691,39 @@ App.WizardStep8Controller = Em.Controlle
     var services = this.get('selectedServices').mapProperty('serviceName');
     services.forEach(function (_service) {
       var components = serviceComponents.filterProperty('service_name', _service);
-      components.forEach(function (_component) {
-        this.createComponent(_service, _component.component_name);
-      }, this);
-    }, this);
-
-  },
-
-  createComponent: function (service, component) {
-    var clusterName = this.get('clusterInfo').findProperty('config_name', 'cluster').config_value;
-    var url = App.apiPrefix + '/clusters/' + clusterName + '/services/' + service + '/components/' + component;
-    $.ajax({
-      type: 'POST',
-      url: url,
-      async: false,
-      dataType: 'text',
-      timeout: App.timeout,
-      success: function (data) {
-        var jsonData = jQuery.parseJSON(data);
-        console.log("TRACE: STep8 -> In success function for createComponent");
-        console.log("TRACE: STep8 -> value of the url is: " + url);
-        console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
-
-      },
+      var componentsData = components.map(function(_component) {
+        return { "ServiceComponentInfo": { "component_name": _component.component_name } };
+      });
+      var clusterName = this.get('clusterInfo').findProperty('config_name', 'cluster').config_value;
+      // Service must be specified in terms of a query for creating multiple components at the same time.
+      // See AMBARI-1018.
+      var url = App.apiPrefix + '/clusters/' + clusterName + '/services?ServiceInfo/service_name=' + _service;
+      var data = {
+        "components": componentsData
+      }
+      $.ajax({
+        type: 'POST',
+        url: url,
+        async: false,
+        dataType: 'text',
+        data: JSON.stringify(data),
+        timeout: App.timeout,
+        success: function (data) {
+          var jsonData = jQuery.parseJSON(data);
+          console.log("TRACE: STep8 -> In success function for createComponent");
+          console.log("TRACE: STep8 -> value of the url is: " + url);
+          console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
+        },
+
+        error: function (request, ajaxOptions, error) {
+          console.log('Step8: In Error ');
+          console.log('Step8: Error message is: ' + request.responseText);
+        },
 
-      error: function (request, ajaxOptions, error) {
-        console.log('Step8: In Error ');
-        console.log('Step8: Error message is: ' + request.responseText);
-      },
+        statusCode: require('data/statusCodes')
+      });
+    }, this);
 
-      statusCode: require('data/statusCodes')
-    });
   },
 
   registerHostsToCluster: function() {
@@ -765,11 +768,59 @@ App.WizardStep8Controller = Em.Controlle
     var slaveHosts = this.get('content.slaveComponentHosts');
     var clients = this.get('content.clients');
     var allHosts = this.get('content.hostsInfo');
+    var slaveClient = slaveHosts.filterProperty('componentName', "CLIENT").objectAt(0);
 
     masterHosts.forEach(function (_masterHost) {
       this.createHostComponent(_masterHost);
     }, this);
 
+    masterHosts.filterProperty('component', 'HBASE_MASTER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
+      var hosts = slaveClient.hosts.filterProperty("hostName", _masterHost.hostName);
+      if (!hosts.length) {
+        var slaveObj = {};
+        slaveObj.component = "HDFS_CLIENT";
+        slaveObj.hostName = _masterHost.hostName;
+        slaveObj.isInstalled = false;
+        this.createHostComponent(slaveObj);
+      }
+    }, this);
+
+    masterHosts.filterProperty('component', 'HIVE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
+      var hosts = slaveClient.hosts.filterProperty("hostName", _masterHost.hostName);
+      if (!hosts.length) {
+        var slaveObj = {};
+        slaveObj.component = "MAPREDUCE_CLIENT";
+        slaveObj.hostName = _masterHost.hostName;
+        slaveObj.isInstalled = false;
+        this.createHostComponent(slaveObj);
+      }
+    }, this);
+
+    masterHosts.filterProperty('component', 'OOZIE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
+      var hosts = slaveClient.hosts.filterProperty("hostName", _masterHost.hostName);
+      if (!hosts.length) {
+        var slaveObj = {};
+        slaveObj.component = "MAPREDUCE_CLIENT";
+        slaveObj.hostName = _masterHost.hostName;
+        slaveObj.isInstalled = false;
+        this.createHostComponent(slaveObj);
+      }
+    }, this);
+
+
+    slaveHosts.filterProperty('componentName', "HBASE_REGIONSERVER").forEach(function (slave) {
+      slave.hosts.forEach(function(_slaveHost){
+        var hosts = slaveClient.hosts.filterProperty('hostName', _slaveHost.hostName);
+        if (!hosts.length) {
+          var slaveObj = {};
+          slaveObj.component = "HDFS_CLIENT";
+          slaveObj.hostName = _slaveHost.hostName;
+          slaveObj.isInstalled = false;
+          this.createHostComponent(slaveObj);
+        }
+      }, this)
+    }, this);
+
     slaveHosts.forEach(function (_slaveHosts) {
       var slaveObj = {};
       if (_slaveHosts.componentName !== 'CLIENT') {

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/initialize.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/initialize.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/initialize.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/initialize.js Sun Dec  9 14:21:37 2012
@@ -25,6 +25,10 @@ App.alwaysGoToInstaller = false;
 App.apiPrefix = '/api/v1';
 // default AJAX timeout
 App.timeout = 20000;
+App.bgOperationsUpdateInterval = 6000;
+App.componentsUpdateInterval = 6000;
+App.graphUpdateInterval = 15000;
+App.services_update = 15000;
 
 require('messages');
 require('utils/data_table');
@@ -36,7 +40,6 @@ require('views');
 require('router');
 
 require('mappers/server_data_mapper');
-require('mappers/services_mapper');
 require('mappers/status_mapper');
 require('mappers/hosts_mapper');
 require('mappers/cluster_mapper');
@@ -45,6 +48,7 @@ require('mappers/runs_mapper');
 require('mappers/racks_mapper');
 require('mappers/alerts_mapper');
 require('mappers/users_mapper');
+require('mappers/update_mapper');
 
 require('utils/http_client');
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/jobs_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/jobs_mapper.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/jobs_mapper.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/jobs_mapper.js Sun Dec  9 14:21:37 2012
@@ -77,13 +77,12 @@ App.jobTasksMapper = App.QuickDataMapper
     mapRackLocal:'mapRackLocal',
     mapOffSwitch:'mapOffSwitch',
     reduceOffSwitch:'reduceOffSwitch',
-    submitTime:'submitTime',
-    finishTime:'finishTime'
+    submit:'submitTime',
+    finish:'finishTime'
   },
   map:function (json) {
     var job = this.get('model'); // @model App.MainAppsItemBarView
     var parseResult = this.parseIt(json, this.config);
-
     $.each(parseResult, function (field, value) {
       job.set(field, value);
     });

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/status_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/status_mapper.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/status_mapper.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/status_mapper.js Sun Dec  9 14:21:37 2012
@@ -52,7 +52,10 @@ App.statusMapper = App.QuickDataMapper.c
       //console.log(result)
       var services = App.Service.find();
       result.forEach(function(item){
-        services.findProperty('id', item.id).set('workStatus', item.work_status);
+        var service = services.findProperty('id', item.id);
+        if(service){
+          service.set('workStatus', item.work_status);
+        }
       })
 
       result = [];
@@ -65,7 +68,10 @@ App.statusMapper = App.QuickDataMapper.c
       //console.log(result)
       var components = App.Component.find();
       result.forEach(function(item){
-        components.findProperty('id', item.id).set('workStatus', item.work_status);
+        var component = components.findProperty('id', item.id);
+        if(component){
+          component.set('workStatus', item.work_status);
+        }
       })
 
       result = [];
@@ -80,7 +86,10 @@ App.statusMapper = App.QuickDataMapper.c
       //console.log(result)
       var hostComponents = App.HostComponent.find();
       result.forEach(function(item){
-        hostComponents.findProperty('id', item.id).set('workStatus', item.work_status);
+        var hostComponent = hostComponents.findProperty('id', item.id);
+        if(hostComponent){
+          hostComponent.set('workStatus', item.work_status);
+        }
       })
     }
   }