ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiw...@apache.org
Subject ambari git commit: AMBARI-11987. Create Gauge widget: Preview show 0% if the value is more than 1.(XIWANG)
Date Thu, 18 Jun 2015 17:38:05 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 7092b53db -> 316f34181


AMBARI-11987. Create Gauge widget: Preview show 0% if the value is more than 1.(XIWANG)


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

Branch: refs/heads/trunk
Commit: 316f341813b17ed24c2c166d02607b7c3afa3247
Parents: 7092b53
Author: Xi Wang <xiwang@apache.org>
Authored: Wed Jun 17 17:55:38 2015 -0700
Committer: Xi Wang <xiwang@apache.org>
Committed: Thu Jun 18 10:34:00 2015 -0700

----------------------------------------------------------------------
 ambari-web/app/messages.js                      |  1 +
 .../app/styles/enhanced_service_dashboard.less  |  5 +++++
 .../templates/common/widget/gauge_widget.hbs    | 12 ++++++++---
 .../views/common/widget/gauge_widget_view.js    | 22 +++++++++++++++++++-
 4 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/316f3418/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 955ef80..1ea4bf2 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2572,6 +2572,7 @@ Em.I18n.translations = {
   'widget.create.wizard.step2.body.template.invalid.msg':'Invalid expression name existed.
Should use name "Expression#" with double curly braces.',
   'widget.create.wizard.step2.addExpression': 'Add Expression',
   'widget.create.wizard.step2.addDataset': 'Add data set',
+  'widget.create.wizard.step2.body.gauge.overflow.warning':'Overflowed! Gauge can only display
number between 0 and 1.',
   'widget.create.wizard.step2.allComponents': 'All {0}s',
   'widget.create.wizard.step2.activeComponents': 'Active {0}',
   'widget.create.wizard.step2.noMetricFound': 'No metric found',

http://git-wip-us.apache.org/repos/asf/ambari/blob/316f3418/ambari-web/app/styles/enhanced_service_dashboard.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/enhanced_service_dashboard.less b/ambari-web/app/styles/enhanced_service_dashboard.less
index 71c99d7..8745604 100644
--- a/ambari-web/app/styles/enhanced_service_dashboard.less
+++ b/ambari-web/app/styles/enhanced_service_dashboard.less
@@ -150,6 +150,11 @@
         .unavailable {
           padding-top: 30px;
         }
+        .overflow-warning {
+          font-size: 14px;
+          margin-left: 10px;
+          padding: 10px 20px;
+        }
       }
     }
     .red {

http://git-wip-us.apache.org/repos/asf/ambari/blob/316f3418/ambari-web/app/templates/common/widget/gauge_widget.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/widget/gauge_widget.hbs b/ambari-web/app/templates/common/widget/gauge_widget.hbs
index 9463c87..0bfb22f 100644
--- a/ambari-web/app/templates/common/widget/gauge_widget.hbs
+++ b/ambari-web/app/templates/common/widget/gauge_widget.hbs
@@ -32,9 +32,15 @@
     {{/isAccessible}}
     <div class="content">
       {{#if view.isUnavailable}}
-        <div class="grey unavailable">
-          {{t common.na}}
-        </div>
+        {{#if view.isOverflowed}}
+          <div class="alert alert-warning overflow-warning">
+            {{t widget.create.wizard.step2.body.gauge.overflow.warning}}
+          </div>
+        {{else}}
+          <div class="grey unavailable">
+            {{t common.na}}
+          </div>
+        {{/if}}
       {{else}}
         {{view view.chartView}}
       {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/316f3418/ambari-web/app/views/common/widget/gauge_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/widget/gauge_widget_view.js b/ambari-web/app/views/common/widget/gauge_widget_view.js
index a1cd24b..60d636d 100644
--- a/ambari-web/app/views/common/widget/gauge_widget_view.js
+++ b/ambari-web/app/views/common/widget/gauge_widget_view.js
@@ -33,10 +33,30 @@ App.GaugeWidgetView = Em.View.extend(App.WidgetMixin, {
   metrics: [],
 
   /**
+   * 1 - is maximum value of a gauge
+   * @type {number}
+   * @const
+   */
+  MAX_VALUE: 1,
+  /**
+   * 0 - is minimum value of a gauge
+   * @type {number}
+   * @const
+   */
+  MIN_VALUE: 0,
+
+  /**
    * @type {boolean}
    */
   isUnavailable: function () {
-    return isNaN(parseFloat(this.get('value')));
+    return isNaN(parseFloat(this.get('value'))) || this.get('isOverflowed');
+  }.property('value', 'isOverflowed'),
+
+  /**
+   * @type {boolean}
+   */
+  isOverflowed: function () {
+    return parseFloat(this.get('value')) > this.get('MAX_VALUE') || parseFloat(this.get('value'))
< this.get('MIN_VALUE');
   }.property('value'),
 
   chartView: App.ChartPieView.extend({


Mime
View raw message