You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2016/02/19 14:26:19 UTC

[02/21] ambari git commit: AMBARI-15086. SCRIPT alert params should tooltip the description (onechiporenko)

AMBARI-15086. SCRIPT alert params should tooltip the description (onechiporenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 2926a4ecd3526c3d15291633c287cb6cfcc75b50
Parents: f927149
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Thu Feb 18 13:16:36 2016 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Thu Feb 18 17:32:28 2016 +0200

----------------------------------------------------------------------
 .../alerts/definition_configs_controller.js     |  1 +
 .../alerts/configs/alert_config_parameter.hbs   |  2 +-
 .../main/alerts/definition_configs_view.js      | 10 +++++-
 .../test/controllers/wizard/step4_test.js       | 36 +++++++++++++-------
 ambari-web/test/utils/config_test.js            |  4 ---
 .../views/main/service/info/summary_test.js     |  4 +--
 6 files changed, 36 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2926a4ec/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/definition_configs_controller.js b/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
index 130434f..1b7fecf 100644
--- a/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
+++ b/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
@@ -330,6 +330,7 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
       result.push(App.AlertConfigProperties.Parameter.create(mixin, {
         value: isWizard ? '' : parameter.get('value'),
         apiProperty: parameter.get('name'),
+        description: parameter.get('description'),
         label: isWizard ? '' : parameter.get('displayName'),
         threshold: isWizard ? '' : parameter.get('threshold'),
         units: isWizard ? '' : parameter.get('units'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/2926a4ec/ambari-web/app/templates/main/alerts/configs/alert_config_parameter.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/configs/alert_config_parameter.hbs b/ambari-web/app/templates/main/alerts/configs/alert_config_parameter.hbs
index fffa7bd..608dc59 100644
--- a/ambari-web/app/templates/main/alerts/configs/alert_config_parameter.hbs
+++ b/ambari-web/app/templates/main/alerts/configs/alert_config_parameter.hbs
@@ -24,7 +24,7 @@
         </span>&nbsp;
     </div>
   {{/if}}
-  <div {{bindAttr class="view.bigInput:span12:span3 view.property.units:input-append view.property.thresholdNotExists:stuck-left"}}>
+  <div rel="parameter-tooltip" {{bindAttr data-original-title="view.property.description" class="view.bigInput:span12:span3 view.property.units:input-append view.property.thresholdNotExists:stuck-left"}}>
     {{view Em.TextField valueBinding="view.property.value" disabledBinding="view.property.isDisabled" class ="view.bigInput:span12:span7"}}
     {{#if view.property.units}}
       <span class="add-on">{{view.property.units}}</span>

http://git-wip-us.apache.org/repos/asf/ambari/blob/2926a4ec/ambari-web/app/views/main/alerts/definition_configs_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/definition_configs_view.js b/ambari-web/app/views/main/alerts/definition_configs_view.js
index 00e26d4..f3c77df 100644
--- a/ambari-web/app/views/main/alerts/definition_configs_view.js
+++ b/ambari-web/app/views/main/alerts/definition_configs_view.js
@@ -100,6 +100,14 @@ App.AlertConfigParameterView = Em.View.extend({
 
   bigInput: Em.computed.equal('property.type', 'STRING'),
 
-  classNameBindings: ['property.classNames', 'parentView.basicClass']
+  classNameBindings: ['property.classNames', 'parentView.basicClass'],
+
+  didInsertElement: function () {
+    App.tooltip($("[rel='parameter-tooltip']"));
+  },
+
+  willDestroyElement: function () {
+    $("[rel='parameter-tooltip']").tooltip('destroy');
+  }
 
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/2926a4ec/ambari-web/test/controllers/wizard/step4_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step4_test.js b/ambari-web/test/controllers/wizard/step4_test.js
index 7796d61..e88f4c3 100644
--- a/ambari-web/test/controllers/wizard/step4_test.js
+++ b/ambari-web/test/controllers/wizard/step4_test.js
@@ -646,19 +646,29 @@ describe('App.WizardStep4Controller', function () {
     });
 
     cases.forEach(function (item) {
-      it(item.title, function () {
-        controller.set('content', generateSelectedServicesContent(item.services));        
-        controller.serviceDependencyValidation();   
-        expect(controller.get('errorStack').mapProperty('id').contains("serviceCheck_"+item.dependentServices[0])).to.equal(true);        
-        expect(controller.get('errorStack').mapProperty('id').contains("serviceCheck_"+item.dependentServices[1])).to.equal(true);
-        controller.findProperty('serviceName', item.dependentServices[0]).set('isSelected', true);
-        
-        //simulate situation where user clicks cancel on error for first dependent service and then selects it in which case
-        //serviceDependencyValidation() will be called again
-        controller.serviceDependencyValidation();   
-        //error for first dependent service must be removed from errorStack array
-        expect(controller.get('errorStack').mapProperty('id').contains("serviceCheck_"+item.dependentServices[0])).to.equal(false);        
-        expect(controller.get('errorStack').mapProperty('id').contains("serviceCheck_"+item.dependentServices[1])).to.equal(true);
+      describe(item.title, function () {
+
+        beforeEach(function () {
+          controller.set('content', generateSelectedServicesContent(item.services));
+          controller.serviceDependencyValidation();
+        });
+
+        it('check errors in the stack', function () {
+          var ids = controller.get('errorStack').mapProperty('id');
+          expect(ids.contains("serviceCheck_" + item.dependentServices[0])).to.be.true;
+          expect(ids.contains("serviceCheck_" + item.dependentServices[1])).to.be.true;
+        });
+
+        it('simulate situation where user clicks cancel on error for first dependent service and then selects it in which case', function () {
+          controller.findProperty('serviceName', item.dependentServices[0]).set('isSelected', true);
+          //serviceDependencyValidation() will be called again
+          controller.serviceDependencyValidation();
+          //error for first dependent service must be removed from errorStack array
+          var ids = controller.get('errorStack').mapProperty('id');
+          expect(ids.contains("serviceCheck_" + item.dependentServices[0])).to.be.false;
+          expect(ids.contains("serviceCheck_" + item.dependentServices[1])).to.be.true;
+        });
+
       });
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2926a4ec/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js
index 18471a2..8dda9f6 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -23,10 +23,6 @@ require('utils/config');
 require('models/service/hdfs');
 var setups = require('test/init_model_test');
 
-function dummyCopy(val) {
-  return JSON.parse(JSON.stringify(val));
-}
-
 describe('App.config', function () {
 
   describe('#trimProperty',function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/2926a4ec/ambari-web/test/views/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/summary_test.js b/ambari-web/test/views/main/service/info/summary_test.js
index 6a84bb6..d9fff97 100644
--- a/ambari-web/test/views/main/service/info/summary_test.js
+++ b/ambari-web/test/views/main/service/info/summary_test.js
@@ -667,7 +667,7 @@ describe('App.MainServiceInfoSummaryView', function() {
       });
       view.set('controller.widgets', [widget]);
       view.setTimeRange({context: {value: '0'}});
-      expect(widget.get('properties')['time_range']).to.equal('0')
+      expect(widget.get('properties').time_range).to.be.equal('0')
     });
 
     it("range = 1", function() {
@@ -679,7 +679,7 @@ describe('App.MainServiceInfoSummaryView', function() {
       });
       view.set('controller.widgets', [widget]);
       view.setTimeRange({context: {value: '1'}});
-      expect(widget.get('properties')['time_range']).to.equal('1')
+      expect(widget.get('properties').time_range).to.be.equal('1')
     });
   });