Repository: ambari Updated Branches: refs/heads/trunk a0dc96edc -> 82d15b57f
AMBARI-19318 Recommended configs changes are displayed twice before adding or deleting Nimbus. (ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/82d15b57 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/82d15b57 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/82d15b57 Branch: refs/heads/trunk Commit: 82d15b57f0639676c820d9b08606f4a265d8801a Parents: a0dc96e Author: ababiichuk <[email protected]> Authored: Thu Dec 29 18:10:17 2016 +0200 Committer: ababiichuk <[email protected]> Committed: Thu Dec 29 18:12:17 2016 +0200 ---------------------------------------------------------------------- ambari-web/app/controllers/main/host/details.js | 25 ++++++++------------ .../test/controllers/main/host/details_test.js | 4 ++-- 2 files changed, 12 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/82d15b57/ambari-web/app/controllers/main/host/details.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js index cb4a2ad..a8f6c75 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -938,9 +938,6 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow } }, this); }, this); - if (this.get('isReconfigureRequired')) { - this.setConfigsChangesForDisplay(); - } }, /** @@ -1005,8 +1002,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow } ]; if (this.get('isReconfigureRequired')) { - this.get('groupedPropertiesToChange').pushObjects(groups); - this.setConfigsChangesForDisplay(); + this.setConfigsChanges(groups); } else { this.saveConfigsBatch(groups, 'NIMBUS', nimbusHost); } @@ -1146,8 +1142,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow } ]; if (this.get('isReconfigureRequired')) { - this.get('groupedPropertiesToChange').pushObjects(groups); - this.setConfigsChangesForDisplay(); + this.setConfigsChanges(groups); } else { var args = [groups]; var componentName = this.get('addHiveServer') ? 'HIVE_SERVER' : (hiveMetastoreHost ? 'HIVE_METASTORE' : 'WEBHCAT_SERVER'); @@ -1337,8 +1332,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow typeConfigs[property.name] = newValue; }, this); if (this.get('isReconfigureRequired')) { - this.get('groupedPropertiesToChange').pushObjects(groups); - this.setConfigsChangesForDisplay(); + this.setConfigsChanges(groups); } else { this.saveConfigsBatch(groups, 'RANGER_KMS_SERVER', hostToInstall); } @@ -1533,7 +1527,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow } }); if (this.get('isReconfigureRequired')) { - this.get('groupedPropertiesToChange').pushObjects(groups); + this.setConfigsChanges(groups); } else { this.saveConfigsBatch(groups, 'ZOOKEEPER_SERVER'); } @@ -2749,7 +2743,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow App.router.get('mainController').isLoading.call(App.router.get('clusterController'), 'isServiceContentFullyLoaded').done(callback); }, - setConfigsChangesForDisplayObserver: function () { + setConfigsChangesForDisplay: function () { if (App.get('router.clusterController.isConfigsPropertiesLoaded')) { this.get('allPropertiesToChange').forEach(function (property) { var stackProperty = App.configsCollection.getConfigByName(property.propertyName, property.propertyFileName); @@ -2761,16 +2755,17 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow } }, this); this.set('isConfigsLoadingInProgress', false); - this.removeObserver('App.router.clusterController.isConfigsPropertiesLoaded', this, 'setConfigsChangesForDisplayObserver'); + this.removeObserver('App.router.clusterController.isConfigsPropertiesLoaded', this, 'setConfigsChangesForDisplay'); } }, - setConfigsChangesForDisplay: function () { + setConfigsChanges: function (groups) { + this.get('groupedPropertiesToChange').pushObjects(groups); if (this.get('allPropertiesToChange.length')) { if (App.get('router.clusterController.isConfigsPropertiesLoaded')) { - this.setConfigsChangesForDisplayObserver(); + this.setConfigsChangesForDisplay(); } else { - this.addObserver('App.router.clusterController.isConfigsPropertiesLoaded', this, 'setConfigsChangesForDisplayObserver'); + this.addObserver('App.router.clusterController.isConfigsPropertiesLoaded', this, 'setConfigsChangesForDisplay'); } } else { this.set('isConfigsLoadingInProgress', false); http://git-wip-us.apache.org/repos/asf/ambari/blob/82d15b57/ambari-web/test/controllers/main/host/details_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js index cb48ae1..2f4376f 100644 --- a/ambari-web/test/controllers/main/host/details_test.js +++ b/ambari-web/test/controllers/main/host/details_test.js @@ -3826,7 +3826,7 @@ describe('App.MainHostDetailsController', function () { }); }); - describe('#setConfigsChangesForDisplayObserver', function () { + describe('#setConfigsChangesForDisplay', function () { var propertiesToChange = [ { @@ -3896,7 +3896,7 @@ describe('App.MainHostDetailsController', function () { }); sinon.stub(App, 'get').withArgs('router.clusterController.isConfigsPropertiesLoaded').returns(true); controller.set('isConfigsLoadingInProgress', true); - controller.setConfigsChangesForDisplayObserver(); + controller.setConfigsChangesForDisplay(); }); afterEach(function () {
