incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject svn commit: r1418972 - in /incubator/ambari/branches/AMBARI-666/ambari-web/app: ./ assets/ controllers/ controllers/global/ controllers/main/host/ controllers/main/service/info/ controllers/wizard/ mappers/ routes/ templates/main/charts/ templates/main...
Date Sun, 09 Dec 2012 14:25:14 GMT
Author: yusaku
Date: Sun Dec  9 14:25:12 2012
New Revision: 1418972

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

Added:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/service_mapper.js
Removed:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/update_mapper.js
Modified:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/index.html
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/cluster_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/update_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.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/service/info/configs.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/initialize.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/hosts_mapper.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/linear_time.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/summary.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/chart/linear_time.js

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/index.html
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/index.html?rev=1418972&r1=1418971&r2=1418972&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/index.html (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/index.html Sun Dec  9 14:25:12 2012
@@ -26,11 +26,17 @@
   <link rel="stylesheet" href="stylesheets/app.css">
   <script src="javascripts/vendor.js"></script>
   <script src="javascripts/app.js"></script>
-  <script>require('initialize');</script>
+  <script>
+      $(document).ready(function() {
+          require('initialize');
+          $('#loading').remove();
+      });
+  </script>
   <title>Ambari</title>
   <link rel="shortcut icon" href="/img/logo-micro.gif">
 </head>
 <body>
+    <div id="loading">...Loading...</div>
     <div id="wrapper">
     <!-- ApplicationView -->
     </div>

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=1418972&r1=1418971&r2=1418972&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:25:12 2012
@@ -22,24 +22,6 @@ 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;
@@ -220,6 +202,10 @@ App.ClusterController = Em.Controller.ex
         context:this,
         complete:function (jqXHR, textStatus) {
           this.updateLoadStatus('alerts')
+        },
+        error: function(jqXHR, testStatus, error) {
+          this.showMessage(Em.I18n.t('nagios.alerts.unavailable'));
+          console.log('Nagios $.ajax() response:', error);
         }
       };
       if (App.testMode) {
@@ -235,6 +221,20 @@ App.ClusterController = Em.Controller.ex
     }
   }.observes('nagiosUrl'),
 
+  /**
+   * Show message in UI
+   */
+  showMessage: function(message){
+    App.ModalPopup.show({
+      header: 'Message',
+      body: message,
+      onPrimary: function() {
+        this.hide();
+      },
+      secondary : null
+    });
+  },
+
   componentsUpdateInterval: App.componentsUpdateInterval,
 
   /**

Modified: 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=1418972&r1=1418971&r2=1418972&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/update_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/global/update_controller.js Sun Dec  9 14:25:12 2012
@@ -21,127 +21,88 @@ var App = require('app');
 App.UpdateController = Em.Controller.extend({
   name:'updateController',
   isUpdated:false,
+  cluster:null,
+
+  clusterName:function () {
+    return (this.get('cluster')) ? this.get('cluster').Clusters.cluster_name : null;
+  }.property('cluster'),
+
+  loadClusterName:function (reload) {
+    if (this.get('clusterName') && !reload) {
+      return;
+    }
+    var self = this;
+    var url = (App.testMode) ? '/data/clusters/info.json' : App.apiPrefix + '/clusters';
+    $.ajax({
+      async:false,
+      type:"GET",
+      url:url,
+      dataType:'json',
+      timeout:App.timeout,
+      success:function (data) {
+        self.set('cluster', data.items[0]);
+      },
+      error:function (request, ajaxOptions, error) {
+        console.log('failed on loading cluster name');
+      },
+      statusCode:require('data/statusCodes')
+    });
+  },
+
   getUrl:function (testUrl, url) {
     return (App.testMode) ? testUrl : App.apiPrefix + '/clusters/' + this.get('clusterName') + url;
   },
 
-  updateServiceMetric:function(){
+  updateAll:function(){
+    this.updateHost();
+    this.updateServiceMetric();
+    this.graphsUpdate();
+  },
 
-    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');
+  updateHost:function(){
 
+      var hostsUrl = this.getUrl('/data/hosts/hosts.json', '/hosts?fields=*');
+      App.HttpClient.get(hostsUrl, App.hostsMapper, {
+        complete:function (jqXHR, textStatus) {
 
-    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;
-            }
+  },
+  graphs: [],
+  graphsUpdate: function () {
+      var existedGraphs = [];
+      this.get('graphs').forEach(function (_graph) {
+        var view = Em.View.views[_graph.id];
+        if (view) {
+          existedGraphs.push(_graph);
+          console.log('updated graph', _graph.name);
+          view.$(".chart-container").children().each(function (index, value) {
+            $(value).children().remove();
           });
-          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;
-              }
+          view.loadData();
+          //if graph opened as modal popup
+          if($(".modal-graph-line .modal-body #" + _graph.popupId + "-container-popup").length){
+            view.$(".chart-container").children().each(function (index, value) {
+              $(value).children().remove();
             });
-          }
-          if (hbaseSvc2) {
-            hbaseSvc2.components.forEach(function (c) {
-              if (c.ServiceComponentInfo.component_name == "HBASE_MASTER") {
-                hbm2 = c;
-              }
+            $(".modal-graph-line .modal-body #" + _graph.popupId + "-container-popup").children().each(function (index, value) {
+              $(value).children().remove();
             });
+            view.set('isPopup', true);
+            view.loadData();
           }
-          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, {
+      });
+      this.set('graphs', existedGraphs);
+  },
+  updateServiceMetric:function(){
+
+    var servicesUrl = this.getUrl('/data/dashboard/services.json', '/services?ServiceInfo/service_name!=MISCELLANEOUS&ServiceInfo/service_name!=DASHBOARD&fields=*,components/host_components/*');
+
+    App.HttpClient.get(servicesUrl, App.servicesMapper, {
       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/main.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main.js?rev=1418972&r1=1418971&r2=1418972&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:25:12 2012
@@ -31,12 +31,10 @@ App.MainController = Em.Controller.exten
     this.startLoadOperationsPeriodically();
     App.router.get('clusterController').loadClusterData();
     App.router.get('updateController').updateServiceMetric();
-    setInterval(
-      this.updateServiceMetric
-    , App.services_update);
+    setInterval( this.updateAll , App.contentUpdateInterval);
   },
-  updateServiceMetric: function(){
-    App.router.get('updateController').updateServiceMetric();
+  updateAll: function(){
+    App.router.get('updateController').updateAll();
   },
   startLoadOperationsPeriodically: function() {
       App.router.get('backgroundOperationsController').set('isWorking', true);

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=1418972&r1=1418971&r2=1418972&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:25:12 2012
@@ -787,6 +787,7 @@ App.AddHostController = Em.Controller.ex
     App.db.setMasterComponentHosts(undefined);
     App.db.setSlaveComponentHosts(undefined);
     App.db.setClusterStatus(undefined);
+    App.router.get('updateController').updateAll();
   }
 
 });

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=1418972&r1=1418971&r2=1418972&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:25:12 2012
@@ -297,7 +297,7 @@ App.MainServiceInfoConfigsController = E
    * @param _componentConfig
    * @param componentConfig
    */
-  loadComponentConfigs: function (_componentConfig, componentConfig) {debugger;
+  loadComponentConfigs: function (_componentConfig, componentConfig) {
     _componentConfig.configs.forEach(function (_serviceConfigProperty) {
       console.log("config", _serviceConfigProperty);
       if(!_serviceConfigProperty) return;
@@ -308,7 +308,6 @@ App.MainServiceInfoConfigsController = E
       serviceConfigProperty.validate();
       console.log("config result", serviceConfigProperty);
     }, this);
-    console.log("+++++++++++++++++++++++++++++++++++++++++");
   },
 
   restartServicePopup: function (event) {

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js?rev=1418972&r1=1418971&r2=1418972&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js Sun Dec  9 14:25:12 2012
@@ -318,13 +318,10 @@ App.WizardStep3Controller = Em.Controlle
             _host.cpu = host.Hosts.cpu_count;
             _host.memory = ((parseInt(host.Hosts.total_mem)) / kbPerGb).toFixed(2);
             console.log("The value of memory is: " + _host.memory);
-            alert ("The value of memory is: " + _host.memory);
-            debugger;
           }
         }, this);
         self.set('bootHosts',hosts);
         console.log("The value of hosts: " + JSON.stringify(hosts));
-        debugger;
         self.stopRegistrataion();
       },
 

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=1418972&r1=1418971&r2=1418972&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:25:12 2012
@@ -27,8 +27,7 @@ App.apiPrefix = '/api/v1';
 App.timeout = 20000;
 App.bgOperationsUpdateInterval = 6000;
 App.componentsUpdateInterval = 6000;
-App.graphUpdateInterval = 15000;
-App.services_update = 15000;
+App.contentUpdateInterval = 15000;
 
 require('messages');
 require('utils/data_table');
@@ -48,7 +47,7 @@ require('mappers/runs_mapper');
 require('mappers/racks_mapper');
 require('mappers/alerts_mapper');
 require('mappers/users_mapper');
-require('mappers/update_mapper');
+require('mappers/service_mapper');
 
 require('utils/http_client');
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/hosts_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/hosts_mapper.js?rev=1418972&r1=1418971&r2=1418972&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/hosts_mapper.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/hosts_mapper.js Sun Dec  9 14:25:12 2012
@@ -50,12 +50,15 @@ App.hostsMapper = App.QuickDataMapper.cr
     ip: 'Hosts.ip'
   },
   map: function (json) {
+    var self = this;
     if (!this.get('model')) {
       return;
     }
     if (json.items) {
-      var result = [];
+
       json.items.forEach(function (item) {
+        var result = [];
+
         // Disk Usage
         if (item.metrics && item.metrics.disk && item.metrics.disk.disk_total && item.metrics.disk.disk_free) {
           var diskUsed = item.metrics.disk.disk_total - item.metrics.disk.disk_free;
@@ -73,15 +76,56 @@ App.hostsMapper = App.QuickDataMapper.cr
           var memUsedPercent = (100 * memUsed) / item.metrics.memory.mem_total;
           item.memory_usage = memUsedPercent.toFixed(1);
         }
-        item.host_components.forEach(function (host_component) {
-          host_component.id = host_component.HostRoles.component_name + "_" + host_component.HostRoles.host_name;
-        }, this);
-        result.push(this.parseIt(item, this.config));
+
+        if(App.Host.find(item.Hosts.host_name).get("hostName") == item.Hosts.host_name){ // UPDATE
+
+         /* App.Host.find(item.Hosts.host_name).set("ip", item.Hosts.ip);
+          App.Host.find(item.Hosts.host_name).set("cpu", item.Hosts.cpu_count);
+          App.Host.find(item.Hosts.host_name).set("osArch", item.Hosts.os_arch);
+          App.Host.find(item.Hosts.host_name).set("osType", item.Hosts.os_type);
+          App.Host.find(item.Hosts.host_name).set("memory", item.Hosts.total_mem);
+          if(typeof item.Hosts.load !=="undefined"){
+            App.Host.find(item.Hosts.host_name).set("loadOne", item.Hosts.load.load_one);
+            App.Host.find(item.Hosts.host_name).set("loadFive", item.Hosts.load.load_five);
+            App.Host.find(item.Hosts.host_name).set("loadFifteen", item.Hosts.load.load_fifteen);
+          }
+          App.Host.find(item.Hosts.host_name).set("cpuUsage", item.cpu_usage);
+          App.Host.find(item.Hosts.host_name).set("diskUsage", item.disk_usage);
+          App.Host.find(item.Hosts.host_name).set("memoryUsage", item.memory_usage);*/
+
+          $.map(item.Hosts, function (e,a){
+            if(typeof(e) === "string" || typeof(e) === "number")
+            {
+              var modelName=self.parseName(a);
+              if(typeof(App.Host.find(item.Hosts.host_name).get(modelName)) !== "undefined"){
+                App.Host.find(item.Hosts.host_name).set(modelName, item.Hosts[a]);
+              }
+            }
+          })
+
+        }else{ // ADD
+
+          item.host_components.forEach(function (host_component) {
+            host_component.id = host_component.HostRoles.component_name + "_" + host_component.HostRoles.host_name;
+          }, this);
+          result.push(this.parseIt(item, this.config));
+          App.store.loadMany(this.get('model'), result);
+
+        }
       }, this);
 
       // console.log(this.get('model'), result);
-      App.store.loadMany(this.get('model'), result);
+
+    }
+  },
+
+  parseName:function(name){
+    var new_name = name.replace(/_\w/g,replacer);
+    function replacer(str, p1, p2, offset, s)
+    {
+     return str[1].toUpperCase();
     }
+    return new_name;
   }
 
 });

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/service_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/service_mapper.js?rev=1418972&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/service_mapper.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/service_mapper.js Sun Dec  9 14:25:12 2012
@@ -0,0 +1,528 @@
+/**
+ * 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.
+ */
+
+App.servicesMapper = App.QuickDataMapper.create({
+  model:App.Service,
+  servicesSortOrder: [
+    'HDFS',
+    'MAPREDUCE',
+    'HBASE',
+    'HIVE',
+    'OOZIE',
+    'GANGLIA',
+    'NAGIOS',
+    'ZOOKEEPER',
+    'PIG',
+    'SQOOP'
+  ],
+  sortByOrder: function (sortOrder, array) {
+    var sorted = [];
+    for (var i = 0; i < sortOrder.length; i++)
+      for (var j = 0; j < array.length; j++) {
+        if (sortOrder[i] == array[j].id) {
+          sorted.push(array[j]);
+        }
+      }
+    return sorted;
+  },
+  config:{
+    id:'ServiceInfo.service_name',
+    service_name:'ServiceInfo.service_name',
+    work_status:'ServiceInfo.state',
+    $service_audit:[ 1, 2, 3 ],
+    $alerts:[ 1, 2, 3 ],
+    components_key:'components',
+    components_type:'array',
+    components:{
+      item:'ServiceComponentInfo.component_name'
+    },
+    host_components:'host_components'
+  },
+
+  hdfsConfig:{
+    version:'nameNodeComponent.ServiceComponentInfo.Version',
+    name_node_id:'nameNodeComponent.host_components[0].HostRoles.host_name',
+    sname_node_id:'snameNodeComponent.host_components[0].HostRoles.host_name',
+    data_nodes:'data_nodes',
+    name_node_start_time:'nameNodeComponent.ServiceComponentInfo.StartTime',
+    jvm_memory_heap_used:'nameNodeComponent.host_components[0].metrics.jvm.memHeapUsedM',
+    jvm_memory_heap_committed:'nameNodeComponent.host_components[0].metrics.jvm.memHeapCommittedM',
+    live_data_nodes:'live_data_nodes',
+    dead_data_nodes:'dead_data_nodes',
+    decommision_data_nodes:'decommission_data_nodes',
+    capacity_used:'nameNodeComponent.ServiceComponentInfo.CapacityUsed',
+    capacity_total:'nameNodeComponent.ServiceComponentInfo.CapacityTotal',
+    dfs_total_blocks:'nameNodeComponent.ServiceComponentInfo.BlocksTotal',
+    dfs_corrupt_blocks:'nameNodeComponent.ServiceComponentInfo.CorruptBlocks',
+    dfs_missing_blocks:'nameNodeComponent.ServiceComponentInfo.MissingBlocks',
+    dfs_under_replicated_blocks:'nameNodeComponent.ServiceComponentInfo.UnderReplicatedBlocks',
+    dfs_total_files:'nameNodeComponent.ServiceComponentInfo.TotalFiles',
+    upgrade_status:'nameNodeComponent.ServiceComponentInfo.UpgradeFinalized',
+    safe_mode_status:'nameNodeComponent.ServiceComponentInfo.Safemode'
+  },
+
+  mapReduceConfig:{
+    version:'jobTrackerComponent.ServiceComponentInfo.Version',
+    job_tracker_id:'jobTrackerComponent.host_components[0].HostRoles.host_name',
+    task_trackers:'task_trackers',
+    job_tracker_start_time:'jobTrackerComponent.ServiceComponentInfo.StartTime',
+    job_tracker_heap_used:'jobTrackerComponent.ServiceComponentInfo.HeapMemoryUsed',
+    job_tracker_heap_max:'jobTrackerComponent.ServiceComponentInfo.HeapMemoryMax',
+    alive_trackers:'alive_trackers',
+    black_list_trackers:'black_list_trackers',
+    gray_list_trackers:'gray_list_trackers',
+    map_slots:'map_slots',
+    reduce_slots:'reduce_slots',
+    jobs_submitted:'jobTrackerComponent.ServiceComponentInfo.jobtracker.jobs_submitted',
+    jobs_completed:'jobTrackerComponent.ServiceComponentInfo.jobtracker.jobs_completed',
+    map_slots_occupied:'jobTrackerComponent.ServiceComponentInfo.jobtracker.occupied_map_slots',
+    map_slots_reserved:'jobTrackerComponent.ServiceComponentInfo.jobtracker.reserved_map_slots',
+    reduce_slots_occupied:'jobTrackerComponent.ServiceComponentInfo.jobtracker.occupied_reduce_slots',
+    reduce_slots_reserved:'jobTrackerComponent.ServiceComponentInfo.jobtracker.reserved_reduce_slots',
+    maps_running:'jobTrackerComponent.ServiceComponentInfo.jobtracker.running_maps',
+    maps_waiting:'jobTrackerComponent.ServiceComponentInfo.jobtracker.waiting_maps',
+    reduces_running:'jobTrackerComponent.ServiceComponentInfo.jobtracker.running_reduces',
+    reduces_waiting:'jobTrackerComponent.ServiceComponentInfo.jobtracker.waiting_reduces',
+    trackers_decommisioned:'jobTrackerComponent.host_components[0].metrics.mapred.jobtracker.trackers_decommissioned'
+  },
+
+  hbaseConfig:{
+    version:'masterComponent.ServiceComponentInfo.Version',
+    master_id:'masterComponent.host_components[0].HostRoles.host_name',
+    region_servers:'region_servers',
+    master_start_time:'masterComponent.ServiceComponentInfo.MasterStartTime',
+    master_active_time:'masterComponent.ServiceComponentInfo.MasterActiveTime',
+    average_load:'masterComponent.ServiceComponentInfo.AverageLoad',
+    regions_in_transition:'regions_in_transition',
+    revision:'masterComponent.ServiceComponentInfo.Revision',
+    heap_memory_used:'masterComponent.ServiceComponentInfo.HeapMemoryUsed',
+    heap_memory_max:'masterComponent.ServiceComponentInfo.HeapMemoryMax'
+  },
+
+  model2:App.Component,
+  config2:{
+    id:'ServiceComponentInfo.component_name',
+    component_name:'ServiceComponentInfo.component_name',
+    service_id:'ServiceComponentInfo.service_name',
+    work_status:'host_components[0].HostRoles.state',
+    host_id:'host_components[0].HostRoles.host_name',
+    $decommissioned:false
+  },
+  model3:App.HostComponent,
+  config3:{
+    id:'id',
+    work_status:'HostRoles.state',
+    component_name:'HostRoles.component_name',
+    host_id:'HostRoles.host_name',
+    service_id:'component[0].ServiceComponentInfo.service_name'
+  },
+  update: function(service){
+    switch(service.ServiceInfo.service_name){
+      case 'HDFS':
+        this.hdfsMapper(service);
+        break;
+      case 'MAPREDUCE':
+        this.mapreduceMapper(service);
+        break;
+      case 'HBASE':
+        this.hbaseMapper(service);
+        break;
+      default :
+        this.otherMapper(service);
+    }
+  },
+  otherMapper:function(item){
+    var result=[];
+    if(App.Service.find(item.ServiceInfo.service_name).get("serviceName") == item.ServiceInfo.service_name )
+    {
+      return;
+    }
+    result.push(this.parseIt(item, this.config));
+    App.store.loadMany(App.Service, result);
+  },
+  hdfsMapper:function(item){
+    var result=[];
+    var finalConfig = jQuery.extend({}, this.config);
+    // Change the JSON so that it is easy to map
+    var hdfsConfig = this.hdfsConfig;
+    item.components.forEach(function (component) {
+      if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "NAMENODE") {
+        item.nameNodeComponent = component;
+        finalConfig = jQuery.extend(finalConfig, hdfsConfig);
+        // Get the live, dead & decommision nodes from string json
+        var liveNodesJson = App.parseJSON(component.ServiceComponentInfo.LiveNodes);
+        var deadNodesJson = App.parseJSON(component.ServiceComponentInfo.DeadNodes);
+        var decommisionNodesJson = App.parseJSON(component.ServiceComponentInfo.DecomNodes);
+        item.live_data_nodes = [];
+        item.dead_data_nodes = [];
+        item.decommision_data_nodes = [];
+        for (var ln in liveNodesJson) {
+          item.live_data_nodes.push(ln);
+        }
+        for (var dn in deadNodesJson) {
+          item.dead_data_nodes.push(dn);
+        }
+        for (var dcn in decommisionNodesJson) {
+          item.decommision_data_nodes.push(dcn);
+        }
+      }
+      if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "SECONDARY_NAMENODE") {
+        item.snameNodeComponent = component;
+      }
+      if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "DATANODE") {
+        if (!item.data_nodes) {
+          item.data_nodes = [];
+        }
+        if (component.host_components) {
+          component.host_components.forEach(function (hc) {
+            item.data_nodes.push(hc.HostRoles.host_name);
+          });
+        }
+      }
+    });
+    // Map
+    var finalJson = this.parseIt(item, finalConfig);
+    finalJson.quick_links = [1, 2, 3, 4];
+
+
+      App.HDFSService.find().map(function(e){
+        e.set("version",finalJson.version);
+        e.set("nameNodeStartTime",finalJson.name_node_start_time);
+        e.set("jvmMemoryHeapCommitted",finalJson.jvm_memory_heap_committed);
+        e.set("capacityUsed",finalJson.capacity_used);
+        e.set("capacityTotal",finalJson.capacity_total);
+        e.set("dfsTotalBlocks",finalJson.dfs_total_blocks);
+        e.set("dfsCorruptBlocks",finalJson.dfs_corrupt_blocks);
+        e.set("dfsMissingBlocks",finalJson.dfs_missing_blocks);
+        e.set("dfsUnderReplicatedBlocks",finalJson.dfs_under_replicated_blocks);
+        e.set("dfsTotalFiles",finalJson.dfs_total_files);
+        e.set("upgradeStatus",finalJson.upgrade_status);
+        e.set("safeModeStatus",finalJson.safe_mode_status);
+      })
+
+  },
+  mapreduceMapper:function(item){
+    // Change the JSON so that it is easy to map
+    var result=[];
+    var finalConfig = jQuery.extend({}, this.config);
+    var mapReduceConfig = this.mapReduceConfig;
+    item.components.forEach(function (component) {
+      if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "JOBTRACKER") {
+        item.jobTrackerComponent = component;
+        finalConfig = jQuery.extend(finalConfig, mapReduceConfig);
+        // Get the live, gray & black nodes from string json
+        item.map_slots = 0;
+        item.reduce_slots = 0;
+        var liveNodesJson = App.parseJSON(component.ServiceComponentInfo.AliveNodes);
+        var grayNodesJson = App.parseJSON(component.ServiceComponentInfo.GrayListedNodes);
+        var blackNodesJson = App.parseJSON(component.ServiceComponentInfo.BlackListedNodes);
+        item.alive_trackers = [];
+        item.gray_list_trackers = [];
+        item.black_list_trackers = [];
+        if (liveNodesJson != null) {
+          liveNodesJson.forEach(function (nj) {
+            item.alive_trackers.push(nj.hostname);
+            if (nj.slots && nj.slots.map_slots)
+              item.map_slots += nj.slots.map_slots;
+            if (nj.slots && nj.slots.map_slots_used)
+              item.map_slots_used += nj.slots.map_slots_used;
+            if (nj.slots && nj.slots.reduce_slots)
+              item.reduce_slots += nj.slots.reduce_slots;
+            if (nj.slots && nj.slots.reduce_slots_used)
+              item.reduce_slots_used += nj.slots.reduce_slots_used;
+          });
+        }
+        if (grayNodesJson != null) {
+          grayNodesJson.forEach(function (nj) {
+            item.gray_list_trackers.push(nj.hostname);
+          });
+        }
+        if (blackNodesJson != null) {
+          blackNodesJson.forEach(function (nj) {
+            item.black_list_trackers.push(nj.hostname);
+          });
+        }
+      }
+      if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "TASKTRACKER") {
+        if (!item.task_trackers) {
+          item.task_trackers = [];
+        }
+        if (component.host_components) {
+          component.host_components.forEach(function (hc) {
+            item.task_trackers.push(hc.HostRoles.host_name);
+          });
+        }
+      }
+    });
+    // Map
+    finalJson = this.parseIt(item, finalConfig);
+    finalJson.quick_links = [5, 6, 7, 8, 9, 10, 11, 12];
+
+    if(App.MapReduceService.find().get("content").length<1)
+    {
+      result.push(finalJson);
+      App.store.load(App.MapReduceService, finalJson);
+      App.store.loadMany(App.Service, result);
+    }else
+    {
+      App.MapReduceService.find().map(function(e){
+        e.set("version",finalJson.version);
+        e.set("jobTrackerStartTime",finalJson.job_tracker_start_time);
+        e.set("jobTrackerHeapUsed",finalJson.job_tracker_heap_used);
+        e.set("jobTrackerHeapMax",finalJson.job_tracker_heap_max);
+        e.set("mapSlots",finalJson.map_slots);
+        e.set("reduceSlots",finalJson.reduce_slots);
+        e.set("jobsSubmitted",finalJson.jobs_submitted);
+        e.set("jobsCompleted",finalJson.jobs_completed);
+        e.set("mapSlotsOccupied",finalJson.map_slots_occupied);
+        e.set("mapSlotsReserved",finalJson.map_slots_reserved);
+        e.set("reduceSlotsOccupied",finalJson.reduce_slots_occupied);
+        e.set("reduceSlotsReserved",finalJson.reduce_slots_reserved);
+        e.set("mapsRunning",finalJson.maps_running);
+        e.set("mapsWaiting",finalJson.maps_waiting);
+        e.set("reducesRunning",finalJson.reduces_running);
+        e.set("reducesWaiting",finalJson.reduces_waiting);
+        e.set("trackersDecommisioned",finalJson.trackers_decommisioned);
+      })
+    }
+
+
+  },
+  hbaseMapper:function(item){
+    // Change the JSON so that it is easy to map
+    var result=[];
+    var finalConfig = jQuery.extend({}, this.config);
+    var hbaseConfig = this.hbaseConfig;
+    item.components.forEach(function (component) {
+      if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "HBASE_MASTER") {
+        item.masterComponent = component;
+        finalConfig = jQuery.extend(finalConfig, hbaseConfig);
+        var regionsArray = App.parseJSON(component.ServiceComponentInfo.RegionsInTransition);
+        item.regions_in_transition = regionsArray == null ? 0 : regionsArray.length;
+      }
+      if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "HBASE_REGIONSERVER") {
+        if (!item.region_servers) {
+          item.region_servers = [];
+        }
+        if (component.host_components) {
+          component.host_components.forEach(function (hc) {
+            item.region_servers.push(hc.HostRoles.host_name);
+          });
+        }
+      }
+    });
+    // Map
+    finalJson = this.parseIt(item, finalConfig);
+    finalJson.quick_links = [13, 14, 15, 16, 17, 18];
+
+    if(App.HBaseService.find().get("content").length<1)
+    {
+      result.push(finalJson);
+      App.store.load(App.HBaseService, finalJson);
+      App.store.loadMany(App.Service, result);
+    }else
+    {
+      App.HBaseService.find().map(function(e){
+        e.set("version",finalJson.version);
+        e.set("masterStartTime",finalJson.master_start_time);
+        e.set("masterActiveTime",finalJson.master_active_time);
+        e.set("averageLoad",finalJson.average_load);
+        e.set("regionsInTransition",finalJson.regions_in_transition);
+        e.set("revision",finalJson.revision);
+        e.set("heapMemoryUsed",finalJson.heap_memory_used);
+        e.set("heapMemoryMax",finalJson.heap_memory_max);
+      })
+    }
+  },
+  map:function (json) {
+    if (!this.get('model')) {
+      return;
+    }
+
+    if (json.items) {
+      var result = [];
+      json.items.forEach(function (item) {
+        var finalConfig = jQuery.extend({}, this.config);
+        item.host_components = [];
+        if(this.get('model').find(item.ServiceInfo.service_name).get('isLoaded')){
+          this.update(item);
+          return;
+        }
+        item.components.forEach(function (component) {
+          component.host_components.forEach(function (host_component) {
+            host_component.id = host_component.HostRoles.component_name + "_" + host_component.HostRoles.host_name;
+            item.host_components.push(host_component.id);
+          }, this)
+        }, this);
+
+        if (item && item.ServiceInfo && item.ServiceInfo.service_name == "HDFS") {
+          // Change the JSON so that it is easy to map
+          var hdfsConfig = this.hdfsConfig;
+          item.components.forEach(function (component) {
+            if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "NAMENODE") {
+              item.nameNodeComponent = component;
+              finalConfig = jQuery.extend(finalConfig, hdfsConfig);
+              // Get the live, dead & decommision nodes from string json
+              var liveNodesJson = App.parseJSON(component.ServiceComponentInfo.LiveNodes);
+              var deadNodesJson = App.parseJSON(component.ServiceComponentInfo.DeadNodes);
+              var decommisionNodesJson = App.parseJSON(component.ServiceComponentInfo.DecomNodes);
+              item.live_data_nodes = [];
+              item.dead_data_nodes = [];
+              item.decommision_data_nodes = [];
+              for (var ln in liveNodesJson) {
+                item.live_data_nodes.push(ln);
+              }
+              for (var dn in deadNodesJson) {
+                item.dead_data_nodes.push(dn);
+              }
+              for (var dcn in decommisionNodesJson) {
+                item.decommision_data_nodes.push(dcn);
+              }
+            }
+            if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "SECONDARY_NAMENODE") {
+              item.snameNodeComponent = component;
+            }
+            if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "DATANODE") {
+              if (!item.data_nodes) {
+                item.data_nodes = [];
+              }
+              if (component.host_components) {
+                component.host_components.forEach(function (hc) {
+                  item.data_nodes.push(hc.HostRoles.host_name);
+                });
+              }
+            }
+          });
+          // Map
+          var finalJson = this.parseIt(item, finalConfig);
+          finalJson.quick_links = [1, 2, 3, 4];
+          result.push(finalJson);
+          App.store.load(App.HDFSService, finalJson);
+        } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "MAPREDUCE") {
+          // Change the JSON so that it is easy to map
+          var mapReduceConfig = this.mapReduceConfig;
+          item.components.forEach(function (component) {
+            if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "JOBTRACKER") {
+              item.jobTrackerComponent = component;
+              finalConfig = jQuery.extend(finalConfig, mapReduceConfig);
+              // Get the live, gray & black nodes from string json
+              item.map_slots = 0;
+              item.reduce_slots = 0;
+              var liveNodesJson = App.parseJSON(component.ServiceComponentInfo.AliveNodes);
+              var grayNodesJson = App.parseJSON(component.ServiceComponentInfo.GrayListedNodes);
+              var blackNodesJson = App.parseJSON(component.ServiceComponentInfo.BlackListedNodes);
+              item.alive_trackers = [];
+              item.gray_list_trackers = [];
+              item.black_list_trackers = [];
+              if (liveNodesJson != null) {
+                liveNodesJson.forEach(function (nj) {
+                  item.alive_trackers.push(nj.hostname);
+                  if (nj.slots && nj.slots.map_slots)
+                    item.map_slots += nj.slots.map_slots;
+                  if (nj.slots && nj.slots.map_slots_used)
+                    item.map_slots_used += nj.slots.map_slots_used;
+                  if (nj.slots && nj.slots.reduce_slots)
+                    item.reduce_slots += nj.slots.reduce_slots;
+                  if (nj.slots && nj.slots.reduce_slots_used)
+                    item.reduce_slots_used += nj.slots.reduce_slots_used;
+                });
+              }
+              if (grayNodesJson != null) {
+                grayNodesJson.forEach(function (nj) {
+                  item.gray_list_trackers.push(nj.hostname);
+                });
+              }
+              if (blackNodesJson != null) {
+                blackNodesJson.forEach(function (nj) {
+                  item.black_list_trackers.push(nj.hostname);
+                });
+              }
+            }
+            if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "TASKTRACKER") {
+              if (!item.task_trackers) {
+                item.task_trackers = [];
+              }
+              if (component.host_components) {
+                component.host_components.forEach(function (hc) {
+                  item.task_trackers.push(hc.HostRoles.host_name);
+                });
+              }
+            }
+          });
+          // Map
+          finalJson = this.parseIt(item, finalConfig);
+          finalJson.quick_links = [5, 6, 7, 8, 9, 10, 11, 12];
+          result.push(finalJson);
+          App.store.load(App.MapReduceService, finalJson);
+        } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "HBASE") {
+          // Change the JSON so that it is easy to map
+          var hbaseConfig = this.hbaseConfig;
+          item.components.forEach(function (component) {
+            if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "HBASE_MASTER") {
+              item.masterComponent = component;
+              finalConfig = jQuery.extend(finalConfig, hbaseConfig);
+              var regionsArray = App.parseJSON(component.ServiceComponentInfo.RegionsInTransition);
+              item.regions_in_transition = regionsArray == null ? 0 : regionsArray.length;
+            }
+            if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "HBASE_REGIONSERVER") {
+              if (!item.region_servers) {
+                item.region_servers = [];
+              }
+              if (component.host_components) {
+                component.host_components.forEach(function (hc) {
+                  item.region_servers.push(hc.HostRoles.host_name);
+                });
+              }
+            }
+          });
+          // Map
+          finalJson = this.parseIt(item, finalConfig);
+          finalJson.quick_links = [13, 14, 15, 16, 17, 18];
+          result.push(finalJson);
+          App.store.load(App.HBaseService, finalJson);
+        } else {
+          result.push(this.parseIt(item, this.config));
+        }
+      }, this);
+
+
+
+
+      result = this.sortByOrder(this.get('servicesSortOrder'), result);
+      App.store.loadMany(this.get('model'), result);
+
+      result = [];
+      json.items.forEach(function (item) {
+        item.components.forEach(function (component) {
+          result.push(this.parseIt(component, this.config2));
+        }, this)
+      }, this);
+
+      App.store.loadMany(this.get('model2'), result);
+
+      result = [];
+      json.items.forEach(function (item) {
+        item.components.forEach(function (component) {
+          component.host_components.forEach(function (host_component) {
+            result.push(this.parseIt(host_component, this.config3));
+          }, this)
+        }, this)
+      }, this);
+      App.store.loadMany(this.get('model3'), result);
+    }
+  }
+});
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js?rev=1418972&r1=1418971&r2=1418972&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js Sun Dec  9 14:25:12 2012
@@ -356,5 +356,8 @@ Em.I18n.translations = {
   'timeRange.presets.1year':'1yr',
 
   'apps.filters.customRunDate':'Run Date custom filter',
-  'apps.dagCharts.popup':'DAG/Charts'
+  'apps.dagCharts.popup':'DAG/Charts',
+
+  'nagios.alerts.unavailable':'Alerts Unavailable'
+
 };
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js?rev=1418972&r1=1418971&r2=1418972&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js Sun Dec  9 14:25:12 2012
@@ -22,6 +22,7 @@ module.exports = Em.Route.extend({
     console.log('in /main:enter');
     if (router.getAuthenticated()) {
       var clusterController = App.router.get('clusterController').loadClusterName(false);
+      App.router.get('updateController').loadClusterName(false);
       router.get('mainController').initialize();
       // TODO: redirect to last known state
     } else {

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/linear_time.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/linear_time.hbs?rev=1418972&r1=1418971&r2=1418972&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/linear_time.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/linear_time.hbs Sun Dec  9 14:25:12 2012
@@ -18,10 +18,9 @@
 <div id="{{unbound view.id}}-container" class="chart-container" {{action showGraphInPopup target="view"}}>
   <div id="{{unbound view.id}}-yaxis" class="chart-y-axis"></div>
   <div id="{{unbound view.id}}-xaxis" class="chart-x-axis"></div>
-  <div id="{{unbound view.id}}-timeline" class="timeline"></div>
   <div id="{{unbound view.id}}-legend" class="chart-legend"></div>
-  <div id="{{unbound view.id}}-overlay" class="chart-overlay"></div>
   <div id="{{unbound view.id}}-chart" class="chart"></div>
+  <div id="{{unbound view.id}}-timeline" class="timeline"></div>
 
   <div id="{{unbound view.id}}-title" class="chart-title">{{view.title}}</div>
 </div>
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/summary.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/summary.hbs?rev=1418972&r1=1418971&r2=1418972&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/summary.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/summary.hbs Sun Dec  9 14:25:12 2012
@@ -24,12 +24,12 @@
 		  </div>
 		  <div class="host-summary-content">
 		    <dl class="dl-horizontal">
-		      <dt>IP:</dt><dd>{{view.content.ip}}</dd>
-		      <dt>CPU:</dt><dd>{{view.content.cpu}}</dd>
-          <dt>OS:</dt><dd>{{view.content.osType}}&nbsp;({{view.content.osArch}})</dd>
-          <dt>Disk Usage:</dt><dd>{{view.content.diskUsage}}</dd>
-          <dt>Memory:</dt><dd>{{view.content.memoryFormatted}}</dd>
-		      <dt>Load Avg:</dt><dd>{{view.content.loadAvg}}</dd>
+		      <dt>IP:</dt><dd>&nbsp;{{view.content.ip}}</dd>
+		      <dt>CPU:</dt><dd>&nbsp;{{view.content.cpu}}</dd>
+          <dt>OS:</dt><dd>&nbsp;{{view.content.osType}}&nbsp;({{view.content.osArch}})</dd>
+          <dt>Disk Usage:</dt><dd>&nbsp;{{view.content.diskUsage}}</dd>
+          <dt>Memory:</dt><dd>&nbsp;{{view.content.memoryFormatted}}</dd>
+		      <dt>Load Avg:</dt><dd>&nbsp;{{view.content.loadAvg}}</dd>
 		      <dt>Agent:</dt><dd>running</dd>
 		    </dl>
 		  </div>

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/chart/linear_time.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/chart/linear_time.js?rev=1418972&r1=1418971&r2=1418972&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/chart/linear_time.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/chart/linear_time.js Sun Dec  9 14:25:12 2012
@@ -111,14 +111,15 @@ App.ChartLinearTimeView = Ember.View.ext
       didInsertElement: function () {
         this._super();
         this.loadData();
-        this.registerGraph()
+        this.registerGraph();
       },
       registerGraph: function(){
         var graph = {
           name: this.get('title'),
-          id: this.get('elementId')
+          id: this.get('elementId'),
+          popupId: this.get('id')
         };
-        App.router.get('clusterController.graphs').push(graph);
+        App.router.get('updateController.graphs').push(graph);
       },
 
       loadData: function() {
@@ -166,6 +167,7 @@ App.ChartLinearTimeView = Ember.View.ext
             typeClass = '';
             break;
         }
+        $(chartOverlayId).html('');
         $(chartOverlayId).append('<div class=\"alert '+typeClass+'\"><strong>'+title+'</strong> '+message+'</div>');
       },
 
@@ -306,7 +308,7 @@ App.ChartLinearTimeView = Ember.View.ext
           }
         }.bind(this));
         var chartId = "#" + this.id + "-chart" + p;
-        var chartOverlayId = "#" + this.id + "-overlay" + p;
+        var chartOverlayId = "#" + this.id + "-container" + p;
         var xaxisElementId = "#" + this.id + "-xaxis" + p;
         var yaxisElementId = "#" + this.id + "-yaxis" + p;
         var legendElementId = "#" + this.id + "-legend" + p;
@@ -361,33 +363,35 @@ App.ChartLinearTimeView = Ember.View.ext
 
        var shelving = new Rickshaw.Graph.Behavior.Series.Toggle({
           graph: _graph,
-          legend:legend
+          legend: legend
         });
 
         var order = new Rickshaw.Graph.Behavior.Series.Order({
           graph: _graph,
-          legend:legend
+          legend: legend
         });
 
         var annotator = new Rickshaw.Graph.Annotate({
           graph: _graph,
-          element:timelineElement
+          element: timelineElement
         });
 
         _graph.render();
-
-        var hoverDetail = new Rickshaw.Graph.HoverDetail({
-          graph: _graph,
-          onShow: function() {
-            console.log('show');
-          },
-          onHide: function() {
-            console.log('hide');
-          },
-          onRender: function() {
-            console.log('render');
-          }
-        });
+        if (isPopup) {
+          var self = this;
+          var hoverDetail = new Rickshaw.Graph.HoverDetail({
+            graph: _graph,
+            yFormatter:function (y) {
+              return self.yAxisFormatter(y);
+            },
+            xFormatter:function (x) {
+              return (new Date(x)).toLocaleTimeString();
+            },
+            formatter:function (series, x, y, formattedX, formattedY, d) {
+              return formattedY + '<br />' + formattedX;
+            }
+          });
+        }
 
         if (isPopup) {
           this.set('_popupGraph', _graph);
@@ -402,6 +406,7 @@ App.ChartLinearTimeView = Ember.View.ext
 
       showGraphInPopup: function() {
         this.set('isPopup', true);
+        var self = this;
         App.ModalPopup.show({
           template: Ember.Handlebars.compile([
             '<div class="modal-backdrop"></div><div class="modal modal-graph-line" id="modal" tabindex="-1" role="dialog" aria-labelledby="modal-label" aria-hidden="true">',
@@ -419,7 +424,6 @@ App.ChartLinearTimeView = Ember.View.ext
                 '<div id="'+this.get('id')+'-yaxis'+this.get('popupSuffix')+'" class="'+this.get('id')+'-yaxis chart-y-axis"></div>'+
                 '<div id="'+this.get('id')+'-xaxis'+this.get('popupSuffix')+'" class="'+this.get('id')+'-xaxis chart-x-axis"></div>'+
                 '<div id="'+this.get('id')+'-legend'+this.get('popupSuffix')+'" class="'+this.get('id')+'-legend chart-legend"></div>'+
-                '<div id="'+this.get('id')+'-overlay'+this.get('popupSuffix')+'" class="'+this.get('id')+'-overlay chart-overlay"></div>'+
                 '<div id="'+this.get('id')+'-chart'+this.get('popupSuffix')+'" class="'+this.get('id')+'-chart chart"></div>'+
                 '<div id="'+this.get('id')+'-title'+this.get('popupSuffix')+'" class="'+this.get('id')+'-title chart-title">{{view.title}}</div>'+
                 '<div id="'+this.get('id')+'-timeline'+this.get('popupSuffix')+'" class="'+this.get('id')+'-timeline timeline"></div>'+
@@ -436,9 +440,9 @@ App.ChartLinearTimeView = Ember.View.ext
           primary: 'OK',
           onPrimary: function() {
             this.hide();
+            self.set('isPopup', false);
           }
         });
-        var self = this;
         Ember.run.next(function() {
           self.loadData();
         });



Mime
View raw message