You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by wu...@apache.org on 2022/11/10 17:57:30 UTC
[ambari] branch trunk updated: AMBARI-25305: Ambari UI gets into corrupt state after installing a cluster (#3479)
This is an automated email from the ASF dual-hosted git repository.
wuzhiguo pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new 7bf8e3bf3b AMBARI-25305: Ambari UI gets into corrupt state after installing a cluster (#3479)
7bf8e3bf3b is described below
commit 7bf8e3bf3bee9d75c6e35323bf02793ffbabbc5f
Author: Zhiguo Wu <wu...@apache.org>
AuthorDate: Fri Nov 11 01:57:25 2022 +0800
AMBARI-25305: Ambari UI gets into corrupt state after installing a cluster (#3479)
---
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 e2b42e80b8..3a145f1db6 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 1037ae8545..e82e88b704 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 38eccf34c6..d05724d4d4 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 88b4b43ab9..dfaafde007 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 () {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ambari.apache.org
For additional commands, e-mail: commits-help@ambari.apache.org