Repository: ambari
Updated Branches:
  refs/heads/trunk fe55b9c95 -> 1157dac6d


AMBARI-12452. Template widget type should show n/a if no data available.(xiwang)


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

Branch: refs/heads/trunk
Commit: 1157dac6d1f635bb4c46e0fb98e2c8e1ec83f388
Parents: 8225cdb
Author: Xi Wang <xiw...@apache.org>
Authored: Fri Jul 17 15:18:51 2015 -0700
Committer: Xi Wang <xiw...@apache.org>
Committed: Tue Jul 21 11:25:05 2015 -0700

----------------------------------------------------------------------
 ambari-web/app/mixins/common/widgets/widget_mixin.js       | 2 +-
 ambari-web/app/templates/common/widget/template_widget.hbs | 2 +-
 ambari-web/test/mixins/common/widget_mixin_test.js         | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1157dac6/ambari-web/app/mixins/common/widgets/widget_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/widgets/widget_mixin.js 
b/ambari-web/app/mixins/common/widgets/widget_mixin.js
index c96238b..1a92862 100644
--- a/ambari-web/app/mixins/common/widgets/widget_mixin.js
+++ b/ambari-web/app/mixins/common/widgets/widget_mixin.js
@@ -406,7 +406,7 @@ App.WidgetMixin = Ember.Mixin.create({
       value.computedValue = value.value.replace(this.get('EXPRESSION_REGEX'), 
function (match) {
         var float = parseFloat(computeExpression[match]);
         if (isNaN(float)) {
-          return computeExpression[match] || "";
+          return computeExpression[match] || "<span class=\"grey\">n/a</span>";
         } else {
           return String((float % 1 !== 0) ? float.toFixed(2) : float);
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1157dac6/ambari-web/app/templates/common/widget/template_widget.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/widget/template_widget.hbs 
b/ambari-web/app/templates/common/widget/template_widget.hbs
index ba323ca..508c07b 100644
--- a/ambari-web/app/templates/common/widget/template_widget.hbs
+++ b/ambari-web/app/templates/common/widget/template_widget.hbs
@@ -30,7 +30,7 @@
         <i class="icon-edit"></i>
       </a>
     {{/isAccessible}}
-    <div {{bindAttr class="view.contentColor 
:content"}}>{{view.displayValue}}</div>
+    <div {{bindAttr class="view.contentColor 
:content"}}>{{{view.displayValue}}}</div>
     {{#if view.content.description}}
       <div class="hidden-description">
         {{view.content.description}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1157dac6/ambari-web/test/mixins/common/widget_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/widget_mixin_test.js 
b/ambari-web/test/mixins/common/widget_mixin_test.js
index b9885cb..3917dfc 100644
--- a/ambari-web/test/mixins/common/widget_mixin_test.js
+++ b/ambari-web/test/mixins/common/widget_mixin_test.js
@@ -294,7 +294,7 @@ describe('App.WidgetMixin', function () {
         value: '${a}'
       }]);
       mixinObject.calculateValues();
-      expect(mixinObject.get('content.values')[0].computedValue).to.be.empty;
+      
expect(mixinObject.get('content.values')[0].computedValue).to.equal('<span 
class="grey">n/a</span>');
     });
     it("value is null", function () {
       this.mock.returns({'${a}': null});
@@ -302,7 +302,7 @@ describe('App.WidgetMixin', function () {
         value: '${a}'
       }]);
       mixinObject.calculateValues();
-      expect(mixinObject.get('content.values')[0].computedValue).to.be.empty;
+      
expect(mixinObject.get('content.values')[0].computedValue).to.equal('<span 
class="grey">n/a</span>');
     });
   });
 

Reply via email to