This is an automated email from the ASF dual-hosted git repository. akovalenko pushed a commit to branch branch-2.7 in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.7 by this push: new 0a46ad8 [AMBARI-25305] Ambari UI gets into corrupt state after installing a cluster (#3010) 0a46ad8 is described below commit 0a46ad89a577e2bd1f46388c00f42ca660d033fd Author: Aleksandr Kovalenko <aleksandrkovale...@users.noreply.github.com> AuthorDate: Wed Jun 19 10:03:37 2019 +0300 [AMBARI-25305] Ambari UI gets into corrupt state after installing a cluster (#3010) * AMBARI-24597. Popup shown when Ambari started on a different port other than 8080 (akovalenko) * AMBARI-25249 Ambari UI quicklinks * AMBARI-25305. Ambari UI gets into corrupt state after installing a cluster --- ambari-web/app/mappers/configs/themes_mapper.js | 2 ++ ambari-web/app/mappers/stack_service_mapper.js | 19 ++----------------- ambari-web/app/utils/helper.js | 16 ++++++++++++++++ ambari-web/test/mappers/stack_service_mapper_test.js | 2 +- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/ambari-web/app/mappers/configs/themes_mapper.js b/ambari-web/app/mappers/configs/themes_mapper.js index e2b42e8..3a145f1 100644 --- a/ambari-web/app/mappers/configs/themes_mapper.js +++ b/ambari-web/app/mappers/configs/themes_mapper.js @@ -74,6 +74,8 @@ App.themesMapper = App.QuickDataMapper.create({ this.get('subSectionModel').find().clear(); this.get('subSectionTabModel').find().clear(); this.get('themeConditionModel').find().clear(); + App.clearModels([this.get('tabModel')]); + App.resetDsStoreTypeMap(this.get('tabModel')); }, /** diff --git a/ambari-web/app/mappers/stack_service_mapper.js b/ambari-web/app/mappers/stack_service_mapper.js index dd42e13..a3f17b3 100644 --- a/ambari-web/app/mappers/stack_service_mapper.js +++ b/ambari-web/app/mappers/stack_service_mapper.js @@ -77,7 +77,7 @@ App.stackServiceMapper = App.QuickDataMapper.create({ mapStackServices: function(json) { App.set('isStackServicesLoaded',false); - this.clearStackModels(); + App.clearModels([this.get('model'), this.get('component_model')]); App.resetDsStoreTypeMap(App.StackServiceComponent); App.resetDsStoreTypeMap(App.StackService); this.map(json); @@ -127,22 +127,7 @@ App.stackServiceMapper = App.QuickDataMapper.create({ }, this); App.store.safeLoadMany(this.get('component_model'), stackServiceComponents); App.store.safeLoadMany(model, result); - }, - - /** - * Clean store from already loaded data. - **/ - clearStackModels: function () { - var models = [App.StackServiceComponent, App.StackService]; - models.forEach(function (model) { - var records = App.get('store').findAll(model).filterProperty('id'); - records.forEach(function (rec) { - Ember.run(this, function () { - rec.deleteRecord(); - App.store.fastCommit(); - }); - }, this); - }, this); } + }); diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js index 38eccf3..d05724d 100644 --- a/ambari-web/app/utils/helper.js +++ b/ambari-web/app/utils/helper.js @@ -1058,6 +1058,22 @@ App.resetDsStoreTypeMap = function(type) { } }; +/** + * Clean store from already loaded data. + * @param {DS.Model[]} models to clear + **/ +App.clearModels = function (models) { + models.forEach(function (model) { + var records = App.get('store').findAll(model).filterProperty('id'); + records.forEach(function (rec) { + Ember.run(this, function () { + rec.deleteRecord(); + App.store.fastCommit(); + }); + }, this); + }, this); +}; + App.logger = function() { var timers = {}; diff --git a/ambari-web/test/mappers/stack_service_mapper_test.js b/ambari-web/test/mappers/stack_service_mapper_test.js index 88b4b43..dfaafde 100644 --- a/ambari-web/test/mappers/stack_service_mapper_test.js +++ b/ambari-web/test/mappers/stack_service_mapper_test.js @@ -228,7 +228,7 @@ describe('App.stackServiceMapper', function () { }; beforeEach(function () { - App.stackServiceMapper.clearStackModels(); + App.clearModels([App.StackService, App.StackServiceComponent]); }); it('should sort and map data about services with their components', function () {