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/10/18 02:39:04 UTC

svn commit: r1399495 [2/2] - in /incubator/ambari/branches/AMBARI-666: ./ ambari-web/ ambari-web/app/ ambari-web/app/assets/data/services/summary/ ambari-web/app/controllers/installer/ ambari-web/app/models/ ambari-web/app/routes/ ambari-web/app/styles...

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/menu.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/menu.js?rev=1399495&r1=1399494&r2=1399495&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/menu.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/menu.js Thu Oct 18 00:39:02 2012
@@ -23,8 +23,8 @@ var App = require('app');
  * @type {*}
  */
 App.MainMenuView = Em.CollectionView.extend({
-  tagName: 'ul',
-  classNames: ['nav'],
+  tagName:'ul',
+  classNames:['nav'],
   content:[
     { label:'Dashboard', routing:'dashboard', active:'active'},
     { label:'Charts', routing:'charts'},
@@ -33,23 +33,38 @@ App.MainMenuView = Em.CollectionView.ext
     { label:'Admin', routing:'admin'}
   ],
 
-  deactivateChildViews:function (content) {
+  /**
+   *    Adds observer on lastSetURL and calls navigation sync procedure
+   */
+  didInsertElement:function () {
+    App.router.location.addObserver('lastSetURL', this, 'renderOnRoute');
+    this.renderOnRoute();
+  },
+
+  /**
+   *    Syncs navigation menu with requested URL
+   */
+  renderOnRoute:function () {
+    var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/);
+    var reg = /^\/main\/([a-z]+)/g;
+    var sub_url = reg.exec(last_url);
+    var chunk = (null != sub_url) ? sub_url[1] : 'dashboard';
     $.each(this._childViews, function () {
-      this.set('active', this.get('content') == content ? "active" : "");
+      this.set('active', this.get('content.routing') == chunk ? "active" : "");
     });
   },
 
-  itemViewClass: Em.View.extend({
+  itemViewClass:Em.View.extend({
 
-    classNameBindings: ['active', ':span2'],
-    active: '',
+    classNameBindings:['active', ':span2'],
+    active:'',
 
-    alertsCount: function() {
-      if(this.get('content').routing == 'dashboard'){
+    alertsCount:function () {
+      if (this.get('content').routing == 'dashboard') {
         return App.router.get('mainDashboardController.alertsCount');
       }
     }.property(),
 
-    template: Ember.Handlebars.compile('<a {{action navigate view.content}} href="#">{{unbound view.content.label}}{{#if view.alertsCount}}<span class="label label-important alerts-count">{{view.alertsCount}}</span>{{/if}}</a>')
+    template:Ember.Handlebars.compile('<a href="#/main/{{unbound view.content.routing}}">{{unbound view.content.label}}{{#if view.alertsCount}}<span class="label label-important alerts-count">{{view.alertsCount}}</span>{{/if}}</a>')
   })
 });
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js?rev=1399495&r1=1399494&r2=1399495&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/summary.js Thu Oct 18 00:39:02 2012
@@ -22,8 +22,27 @@ App.MainServiceInfoSummaryView = Em.View
   templateName: require('templates/main/service/info/summary'),
   attributes: null,
   serviceStatus: {
-    hdfs: false
+    hdfs: false,
+    mapreduce: false,
+    hbase: false
   },
+  isHide: true,
+  showMoreStats: function() {
+    this.set('isHide', false);
+  },
+  moreStatsView: Em.View.extend({
+    tagName: "a",
+    template: Ember.Handlebars.compile('{{t services.service.summary.moreStats}}'),
+    attributeBindings: ['href'],
+    classNameBindings: ['hide'],
+    classNames: ['more-stats'],
+    hide: false,
+    click: function(event) {
+      this._parentView.set('isHide', false);
+      this.remove();
+    },
+    href: 'javascript:void(null)'
+  }),
   serviceName: function() {
     return App.router.mainServiceInfoSummaryController.get('content.serviceName');
   }.property('App.router.mainServiceInfoSummaryController.content'),
@@ -34,19 +53,39 @@ App.MainServiceInfoSummaryView = Em.View
   },
   loadServiceSummary: function(serviceName) {
     var summaryView = this;
+    var serviceStatus = summaryView.get('serviceStatus');
+    $.each(serviceStatus, function(key, value) {
+      if (key == serviceName) {
+        summaryView.set('serviceStatus.' + key, true);
+      } else {
+        summaryView.set('serviceStatus.' + key, false);
+      }
+    });
     jQuery.getJSON('data/services/summary/' + serviceName + '.json',
       function (data) {
         if (data[serviceName]) {
           var summary = data[serviceName];
           if(serviceName == 'hdfs') {
-            summaryView.set('serviceStatus.hdfs', true);
+            summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
             summary['memory_heap_used'] = summaryView.convertByteToMbyte(summary['memory_heap_used']);
             summary['memory_heap_max'] = summaryView.convertByteToMbyte(summary['memory_heap_max']);
             summary['memory_heap_percent_used'] = summaryView.countPercentageRatio(summary['memory_heap_used'], summary['memory_heap_max']);
             summary['used_bytes'] = summaryView.convertByteToGbyte(summary['dfs_used_bytes'] + summary['nondfs_used_bytes']);
             summary['dfs_total_bytes'] = summaryView.convertByteToGbyte(summary['dfs_total_bytes']);
+            summary['dfs_percent_disk_used'] = parseFloat((100 - summary['dfs_percent_remaining']).toFixed(2));
+          } else if (serviceName == 'mapreduce') {
+            summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
+            summary['memory_heap_used'] = summaryView.convertByteToMbyte(summary['memory_heap_used']);
+            summary['memory_heap_max'] = summaryView.convertByteToMbyte(summary['memory_heap_max']);
+            summary['memory_heap_percent_used'] = summaryView.countPercentageRatio(summary['memory_heap_used'], summary['memory_heap_max']);
+          } else if (serviceName == 'hbase') {
+            summary['memory_heap_used'] = summaryView.convertByteToMbyte(summary['memory_heap_used']);
+            summary['memory_heap_max'] = summaryView.convertByteToMbyte(summary['memory_heap_max']);
+            summary['memory_heap_percent_used'] = summaryView.countPercentageRatio(summary['memory_heap_used'], summary['memory_heap_max']);
+            summary['start_time'] = summary['start_time'].toDaysHoursMinutes();
+            summary['active_time'] = summary['active_time'].toDaysHoursMinutes();
           } else {
-            summaryView.set('serviceStatus.hdfs', false);
+
           }
           summaryView.set('attributes', summary);
         }
@@ -56,7 +95,7 @@ App.MainServiceInfoSummaryView = Em.View
   convertByteToMbyte: function(value) {
     var bytesInMbyte = 1048576;
     var newValue = value/bytesInMbyte;
-    return parseFloat(newValue.toFixed(1));
+    return parseFloat(newValue.toFixed(2));
   },
   convertByteToGbyte: function(value) {
     var bytesInGbyte = 1073741824;

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/config.coffee
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/config.coffee?rev=1399495&r1=1399494&r2=1399495&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/config.coffee (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/config.coffee Thu Oct 18 00:39:02 2012
@@ -35,6 +35,7 @@ exports.config =
         before: [
           'vendor/scripts/console-helper.js',
           'vendor/scripts/jquery-1.7.2.min.js',
+          'vendor/scripts/jquery-ui-1.9.0.custom.js'
           'vendor/scripts/handlebars-1.0.0.beta.6.js',
           'vendor/scripts/ember-latest.js',
           'vendor/scripts/ember-data-latest.js',

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/package.json
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/package.json?rev=1399495&r1=1399494&r2=1399495&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/package.json (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/package.json Thu Oct 18 00:39:02 2012
@@ -19,7 +19,8 @@
     "uglify-js-brunch": ">= 1.0 < 1.5",
     "clean-css-brunch": ">= 1.0 < 1.5",
     "ember-handlebars-brunch": "git://github.com/icholy/ember-handlebars-brunch.git",
-    "less-brunch": "git://github.com/brunch/less-brunch.git"
+    "less-brunch": "git://github.com/brunch/less-brunch.git",
+    "d3": ">=2.10.3"
   },
   "devDependencies": {
     "mocha": "0.14.0",