Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 2f89a707c -> 5e2fe569d


AMBARI-16729. When selecting cluster capacity to 100% for llap queue, user is 
not shown warning (alexantonenko)


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

Branch: refs/heads/branch-2.4
Commit: 5e2fe569d600fec611f4a4e89b422f3fcf67dc94
Parents: 2f89a70
Author: Alex Antonenko <[email protected]>
Authored: Wed May 18 14:53:36 2016 +0300
Committer: Alex Antonenko <[email protected]>
Committed: Wed May 18 16:32:50 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/messages.js                      |  1 +
 .../configs/objects/service_config_property.js  |  7 ++++++
 .../widgets/slider_config_widget_view.js        |  6 ++++-
 .../widgets/slider_config_widget_view_test.js   | 25 +++++++++++++++++++-
 4 files changed, 37 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5e2fe569/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 74f918d..bcb7ca3 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -3004,6 +3004,7 @@ Em.I18n.translations = {
   'config.infoMessage.wrong.value.for.widget': 'Configuration value cannot be 
converted into UI control value',
   'config.warnMessage.outOfBoundaries.greater': 'Values greater than {0} are 
not recommended',
   'config.warnMessage.outOfBoundaries.less': 'Values smaller than {0} are not 
recommended',
+  'config.warnMessage.llap_queue_capacity.max': 'LLAP will consume entire Yarn 
queue',
 
   'errorMessage.config.required': 'This is required',
   'errorMessage.config.number.integer': 'Must contain digits only',

http://git-wip-us.apache.org/repos/asf/ambari/blob/5e2fe569/ambari-web/app/models/configs/objects/service_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_property.js 
b/ambari-web/app/models/configs/objects/service_config_property.js
index f8a1e48..8d5714a 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -318,6 +318,13 @@ App.ServiceConfigProperty = Em.Object.extend({
       this.set('errorMessage', ''); // do not perform validation for not 
editable configs
     } else if ((typeof this.get('value') != 'object') && ((this.get('value') + 
'').length === 0)) {
       this.set('errorMessage', (this.get('isRequired') && 
this.get('widgetType') != 'test-db-connection') ? 
Em.I18n.t('errorMessage.config.required') : '');
+    } else if (this.get('name') === 'llap_queue_capacity') {
+      if (!isNaN(parseInt(this.get('value'), 10)) && 
parseInt(this.get('value'), 10) === 100) {
+        this.set('warnMessage', 
Em.I18n.t('config.warnMessage.llap_queue_capacity.max'));
+      } else {
+        this.set('warnMessage', '');
+        this.set('errorMessage', this.validator(this.get('value'), 
this.get('name'), this.get('retypedPassword')));
+      }
     } else {
       this.set('errorMessage', this.validator(this.get('value'), 
this.get('name'), this.get('retypedPassword')));
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5e2fe569/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js 
b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
index f3e80a3..71156f4 100644
--- a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
@@ -645,7 +645,11 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
           return false;
         }
       }
-      this.updateWarningsForCompatibilityWithWidget('');
+      if (this.get('config.name') === 'llap_queue_capacity') {
+        this.get('config').validate();
+      } else {
+        this.updateWarningsForCompatibilityWithWidget('');
+      }
       return true;
     }
     return false;

http://git-wip-us.apache.org/repos/asf/ambari/blob/5e2fe569/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
 
b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
index f038d3d..d757b2e 100644
--- 
a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
+++ 
b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
@@ -581,7 +581,7 @@ describe('App.SliderConfigWidgetView', function () {
     var stackConfigProperty = null;
 
     beforeEach(function() {
-      viewInt.set('config', {});
+      viewInt.set('config', App.ServiceConfigProperty.create({}));
       stackConfigProperty = {name: 'p1', widget: { units: [ { 'unit-name': 
"int"}]}, valueAttributes: {minimum: 1, maximum: 10, increment_step: 4, type: 
'int'}};
       viewInt.set('config.stackConfigProperty', stackConfigProperty);
       viewInt.set('config.isValid', true);
@@ -634,6 +634,29 @@ describe('App.SliderConfigWidgetView', function () {
       expect(viewInt.get('warnMessage')).to.equal('');
       expect(viewInt.get('issueMessage')).to.equal('');
     });
+
+    describe('llap_queue_capacity property', function() {
+      beforeEach(function() {
+        viewInt.set('config.name', 'llap_queue_capacity');
+      });
+      it('should validate and warn about llap issue when value is 100%', 
function() {
+        viewInt.set('config.stackConfigProperty.valueAttributes.maximum', 100);
+        viewInt.set('config.value', '100');
+        viewInt.set('config.errorMessage', '');
+        viewInt.set('config.warnMessage', '');
+        assert.isTrue(viewInt.isValueCompatibleWithWidget(), 'value should be 
compatible with widget');
+        assert.equal(viewInt.get('config.warnMessage'), 
Em.I18n.t('config.warnMessage.llap_queue_capacity.max'), 'warn message 
validation');
+      });
+
+      it('should pass validation because llap < 100', function() {
+        viewInt.set('config.stackConfigProperty.valueAttributes.maximum', 100);
+        viewInt.set('config.value', '99');
+        viewInt.set('config.errorMessage', '');
+        viewInt.set('config.warnMessage', '');
+        assert.isTrue(viewInt.isValueCompatibleWithWidget(), 'value should be 
compatible with widget');
+        assert.equal(viewInt.get('config.warnMessage'), '', 'warn message 
validation');
+      });
+    });
   });
 
   describe('#formatTickLabel', function () {

Reply via email to