ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject git commit: AMBARI-4949. Storm: When Nimbus is down, the graphs are shown with spinners that spin forever (page refresh shows "Loading..." bar). (Denys Buzhor via onechiporenko)
Date Wed, 05 Mar 2014 12:53:01 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 6f0059881 -> c9466c7c0


AMBARI-4949. Storm: When Nimbus is down, the graphs are shown with spinners that spin forever
(page refresh shows "Loading..." bar). (Denys Buzhor via onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c9466c7c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c9466c7c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c9466c7c

Branch: refs/heads/trunk
Commit: c9466c7c013f7a445e6d60d99e60598a64f4b6af
Parents: 6f00598
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Wed Mar 5 14:52:46 2014 +0200
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Wed Mar 5 14:52:46 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/messages.js                      |  2 ++
 .../mixins/common/chart/storm_linear_time.js    |  5 ++--
 .../templates/main/dashboard/service/storm.hbs  |  8 +++---
 ambari-web/app/utils/helper.js                  | 30 ++++++++++++++++++--
 4 files changed, 37 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c9466c7c/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 0f205ec..5189006 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -193,6 +193,8 @@ Em.I18n.translations = {
   'common.hostLog.popup.outputLog.value': 'output-{0}.txt',
   'common.hostLog.popup.errorLog.value': 'errors-{0}.txt',
   'common.maintenance.task': ' Toggle Maintenance Mode',
+  'common.used': 'used',
+  'common.free': 'free',
   'passiveState.turnOn':'Turn On Maintenance Mode',
   'passiveState.turnOff':'Turn Off Maintenance Mode',
   'passiveState.turnOnFor':'Turn On Maintenance Mode for {0}',

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9466c7c/ambari-web/app/mixins/common/chart/storm_linear_time.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/chart/storm_linear_time.js b/ambari-web/app/mixins/common/chart/storm_linear_time.js
index 78a5e60..49d7fb1 100644
--- a/ambari-web/app/mixins/common/chart/storm_linear_time.js
+++ b/ambari-web/app/mixins/common/chart/storm_linear_time.js
@@ -44,8 +44,9 @@ App.StormLinearTimeChartMixin = Em.Mixin.create({
   getMappedStormData: function() {
     var seriesData = [];
     this.get('stormChartDefinition').forEach(function(item) {
-      seriesData.push(this.transformData(this.get('chartStormModel.' + item.value), item.name));
+      if (this.get('chartStormModel.' + item.value) || this.get('chartStormModel.' + item.value)
== 0)
+        seriesData.push(this.transformData(this.get('chartStormModel.' + item.value), item.name));
     }, this);
-    return seriesData
+    return seriesData;
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9466c7c/ambari-web/app/templates/main/dashboard/service/storm.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/service/storm.hbs b/ambari-web/app/templates/main/dashboard/service/storm.hbs
index 298e0fe..eaa2afe 100644
--- a/ambari-web/app/templates/main/dashboard/service/storm.hbs
+++ b/ambari-web/app/templates/main/dashboard/service/storm.hbs
@@ -36,7 +36,7 @@
     {{t services.service.summary.storm.freeslots}}
   </td>
   <td>
-    {{view.service.freeSlots}} / {{view.service.totalSlots}} ({{view.freeSlotsPercentage}}%
free)
+    {{formatNull view.service.freeSlots}} / {{formatNull view.service.totalSlots}} ({{formatNull
view.freeSlotsPercentage empty="0"}}% {{t common.free}})
   </td>
 </tr>
 <tr>
@@ -44,7 +44,7 @@
     {{t services.service.summary.storm.tasks}}
   </td>
   <td>
-    {{view.service.totalTasks}}
+    {{formatNull view.service.totalTasks}}
   </td>
 </tr>
 <tr>
@@ -52,7 +52,7 @@
     {{t services.service.summary.storm.executors}}
   </td>
   <td>
-    {{view.service.totalExecutors}}
+    {{formatNull view.service.totalExecutors}}
   </td>
 </tr>
 <tr>
@@ -60,7 +60,7 @@
     {{t services.service.summary.storm.topologies}}
   </td>
   <td>
-    {{view.service.topologies}}
+    {{formatNull view.service.topologies}}
   </td>
 </tr>
 <tr>

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9466c7c/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index 17958f1..09a2f1c 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -370,7 +370,6 @@ App.registerBoundHelper('pluralize', Em.View.extend({
     }
     return '';
   },
-
   /*
    * Detect for Em.I18n.t reference call
    * @params word {String}
@@ -386,7 +385,34 @@ App.registerBoundHelper('pluralize', Em.View.extend({
   }
   })
 );
-
+/**
+ * Return defined string instead of empty if value is null/undefined
+ * by default is `n/a`.
+ *
+ * @param empty {String} - value instead of empty string (not required)
+ *  can be used with Em.I18n pass value started with't:'
+ *
+ * Examples:
+ *
+ * default value will be returned
+ * {{formatNull service.someValue}}
+ *
+ * <code>empty<code> will be returned
+ * {{formatNull service.someValue empty="I'm empty"}}
+ *
+ * Em.I18n translation will be returned
+ * {{formatNull service.someValue empty="t:my.key.to.translate"
+ */
+App.registerBoundHelper('formatNull', Em.View.extend({
+  tagName: 'span',
+  template: Em.Handlebars.compile('{{view.result}}'),
+
+  result: function() {
+    var emptyValue = this.get('empty') ? this.get('empty') : Em.I18n.t('services.service.summary.notAvailable');
+    emptyValue = emptyValue.startsWith('t:') ? Em.I18n.t(emptyValue.substr(2, emptyValue.length))
: emptyValue;
+    return (this.get('content') || this.get('content') == 0) ? this.get('content') : emptyValue;
+  }.property('content')
+}));
 
 /**
  * Ambari overrides the default date transformer.


Mime
View raw message