ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-12722. Final button is absent for Custom core -site properties (alexantonenko)
Date Tue, 11 Aug 2015 15:19:39 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 23609c0bf -> 79f05c4d2


AMBARI-12722. Final button is absent for Custom core -site properties (alexantonenko)


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

Branch: refs/heads/branch-2.1
Commit: 79f05c4d2b3cd1c585c189a459e59df91e856d6e
Parents: 23609c0
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Tue Aug 11 18:08:31 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Tue Aug 11 18:08:31 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/wizard.js       |  2 +-
 ambari-web/app/utils/config.js             | 14 ++++++++------
 ambari-web/test/controllers/wizard_test.js |  2 ++
 ambari-web/test/utils/config_test.js       | 11 ++++++++---
 4 files changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/79f05c4d/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index ce3ed69..f67fd7b 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -857,7 +857,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
       }
 
       _content.get('configs').forEach(function (_configProperties) {
-        var configProperty = App.config.createDefaultConfig(_configProperties.get('name'),
_configProperties.get('filename'), _configProperties.get('isUserProperty'), {value: _configProperties.get('value')});
+        var configProperty = App.config.createDefaultConfig(_configProperties.get('name'),
_configProperties.get('serviceName'), _configProperties.get('filename'), _configProperties.get('isUserProperty'),
{value: _configProperties.get('value')});
         configProperty = App.config.mergeStaticProperties(configProperty, _configProperties,
['name', 'filename']);
 
         if (this.isExcludedConfig(configProperty)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/79f05c4d/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 73ca643..c718d94 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -302,7 +302,7 @@ App.config = Em.Object.create({
         var configsPropertyDef = this.get('preDefinedSitePropertiesMap')[id];
         var advancedConfig = App.StackConfigProperty.find(id);
         var isStackProperty = !!advancedConfig.get('id');
-        var template = this.createDefaultConfig(index, filename, isStackProperty, configsPropertyDef);
+        var template = this.createDefaultConfig(index, serviceName, filename, isStackProperty,
configsPropertyDef);
         var serviceConfigObj = isStackProperty ? this.mergeStaticProperties(template, advancedConfig)
: template;
 
         if (serviceConfigObj.isRequiredByAgent !== false) {
@@ -330,12 +330,13 @@ App.config = Em.Object.create({
    * These property values has the lowest priority and can be overriden be stack/UI
    * config property but is used when such properties are absent in stack/UI configs
    * @param {string} name
+   * @param {string} serviceName
    * @param {string} fileName
    * @param {boolean} definedInStack
    * @param {Object} [coreObject]
    * @returns {Object}
    */
-  createDefaultConfig: function(name, fileName, definedInStack, coreObject) {
+  createDefaultConfig: function(name, serviceName, fileName, definedInStack, coreObject)
{
     return $.extend({
       /** core properties **/
       name: name,
@@ -347,8 +348,8 @@ App.config = Em.Object.create({
       /** UI and Stack properties **/
       recommendedValue: null,
       recommendedIsFinal: null,
-      supportsFinal: false,
-      serviceName: 'MISC',
+      supportsFinal: this.shouldSupportFinal(serviceName, fileName),
+      serviceName: serviceName,
       defaultDirectory: '',
       displayName: this.getDefaultDisplayName(name, fileName),
       displayType: this.getDefaultDisplayType(name, fileName, coreObject ? coreObject.value
: ''),
@@ -593,8 +594,9 @@ App.config = Em.Object.create({
       if (!(uiPersistentProperties.contains(id) || isUIOnly || advanced.get('id')) &&
filename != 'alert_notification') {
         return;
       }
+      var serviceName = preDefined ? preDefined.serviceName : advanced.get('serviceName');
       if (configTypes.contains(this.getConfigTagFromFileName(filename))) {
-        var configData = this.createDefaultConfig(name, filename, true, preDefined || {});
+        var configData = this.createDefaultConfig(name, serviceName, filename, true, preDefined
|| {});
         if (configData.recommendedValue) {
           configData.value = configData.recommendedValue;
         }
@@ -1118,7 +1120,7 @@ App.config = Em.Object.create({
         isVisible: stored.isVisible,
         isFinal: stored.isFinal,
         savedIsFinal: stored.savedIsFinal,
-        supportsFinal: stored.supportsFinal,
+        supportsFinal: this.shouldSupportFinal(stored.serviceName, stored.filename),
         showLabel: stored.showLabel !== false,
         category: stored.category
       };

http://git-wip-us.apache.org/repos/asf/ambari/blob/79f05c4d/ambari-web/test/controllers/wizard_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js
index 9f38134..1ae4cf5 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -916,10 +916,12 @@ describe('App.WizardController', function () {
     beforeEach(function () {
       c.set('content', {});
       sinon.stub(c, 'setDBProperty', Em.K);
+      sinon.stub(App.config, 'shouldSupportFinal').returns(true);
     });
 
     afterEach(function () {
       c.setDBProperty.restore();
+      App.config.shouldSupportFinal.restore();
     });
 
     var kerberosStepController = Em.Object.create({

http://git-wip-us.apache.org/repos/asf/ambari/blob/79f05c4d/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 7cfdb61..0f69b7c 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -1276,6 +1276,9 @@ describe('App.config', function () {
       sinon.stub(App.config, 'getDefaultIsShowLabel', function () {
         return true;
       });
+      sinon.stub(App.config, 'shouldSupportFinal', function () {
+        return true;
+      });
     });
 
     after(function () {
@@ -1284,6 +1287,7 @@ describe('App.config', function () {
       App.config.getDefaultCategory.restore();
       App.config.getIsSecure.restore();
       App.config.getDefaultIsShowLabel.restore();
+      App.config.shouldSupportFinal.restore();
     });
 
     var res = {
@@ -1297,8 +1301,8 @@ describe('App.config', function () {
       /** UI and Stack properties **/
       recommendedValue: null,
       recommendedIsFinal: null,
-      supportsFinal: false,
-      serviceName: 'MISC',
+      supportsFinal: true,
+      serviceName: 'pServiceName',
       defaultDirectory: '',
       displayName: 'pDisplayName',
       displayType: 'pDisplayType',
@@ -1324,7 +1328,7 @@ describe('App.config', function () {
       belongsToService: []
     };
     it('create default config object', function () {
-      expect(App.config.createDefaultConfig('pName', 'pFileName', true)).to.eql(res);
+      expect(App.config.createDefaultConfig('pName', 'pServiceName', 'pFileName', true)).to.eql(res);
     });
     it('runs proper methods', function () {
       expect(App.config.getDefaultDisplayName.calledWith('pName', 'pFileName')).to.be.true;
@@ -1332,6 +1336,7 @@ describe('App.config', function () {
       expect(App.config.getDefaultCategory.calledWith(true, 'pFileName')).to.be.true;
       expect(App.config.getIsSecure.calledWith('pName')).to.be.true;
       expect(App.config.getDefaultIsShowLabel.calledWith('pName', 'pFileName')).to.be.true;
+      expect(App.config.shouldSupportFinal.calledWith('pServiceName', 'pFileName')).to.be.true;
     });
   });
 


Mime
View raw message