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 2013/08/09 19:41:25 UTC

git commit: AMBARI-2848. UI display label issues in Heatmaps. (xiwang via yusaku)

Updated Branches:
  refs/heads/trunk e7ac8688d -> 436394607


AMBARI-2848. UI display label issues in Heatmaps. (xiwang via yusaku)


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

Branch: refs/heads/trunk
Commit: 436394607ef5fe283ca822827c70ad152e33724e
Parents: e7ac868
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Fri Aug 9 10:41:17 2013 -0700
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Fri Aug 9 10:41:17 2013 -0700

----------------------------------------------------------------------
 .../controllers/main/charts/heatmap_metrics/heatmap_metric.js    | 4 ++--
 ambari-web/app/utils/date.js                                     | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/43639460/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric.js b/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric.js
index 56d49a8..c24e9dd 100644
--- a/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric.js
+++ b/ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric.js
@@ -126,7 +126,7 @@ App.MainChartHeatmapMetric = Em.Object.extend({
       var from = this.formatLegendNumber(c * delta);
       var to = this.formatLegendNumber((c + 1) * delta);
       if ($.trim(labelSuffix) == 'ms') {
-      	var label = date.timingFormat(from) + " - " + date.timingFormat(to);
+      	var label = date.timingFormat(from, 'zeroValid') + " - " + date.timingFormat(to, 'zeroValid');
       } else {
 	      var label = from + labelSuffix + " - " + to + labelSuffix;
       }
@@ -142,7 +142,7 @@ App.MainChartHeatmapMetric = Em.Object.extend({
     to = this.formatLegendNumber(max);
 
     if ($.trim(labelSuffix) == 'ms') {
-      var label = date.timingFormat(from) + " - " + date.timingFormat(to);
+      var label = date.timingFormat(from, 'zeroValid') + " - " + date.timingFormat(to, 'zeroValid');
     } else {
       var label = from + labelSuffix + " - " + to + labelSuffix;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/43639460/ambari-web/app/utils/date.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/date.js b/ambari-web/app/utils/date.js
index cc07ceb..e65f93e 100644
--- a/ambari-web/app/utils/date.js
+++ b/ambari-web/app/utils/date.js
@@ -65,10 +65,12 @@ module.exports = {
    * 1000000 ms = 16.66 mins
    * 3500000 secs = 58.33 mins
    * @param time
+   * @param zeroValid, for the case to show 0 when time is 0, not null
    * @return string formatted date
    */
-  timingFormat:function (time) {
+  timingFormat:function (time, /* optional */ zeroValid) {
     var intTime  = parseInt(time);
+    if (zeroValid && intTime == 0) return 0 + '';
     if (!intTime) return null;
     var timeStr = intTime.toString();
     var lengthOfNumber = timeStr.length;