This is an automated email from the ASF dual-hosted git repository.
ishanbha 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 f858525 [AMBARI-24150] Install wizard stuck at Assign Slaves and
Clients page.
f858525 is described below
commit f8585251be9bfe478ae63522829be766456e7e8c
Author: Ishan Bhatt <[email protected]>
AuthorDate: Tue Jun 19 23:12:42 2018 -0700
[AMBARI-24150] Install wizard stuck at Assign Slaves and Clients page.
---
ambari-web/app/mappers/configs/themes_mapper.js | 13 +++++++------
ambari-web/app/mixins/common/configs/enhanced_configs.js | 4 ++--
ambari-web/app/models/configs/theme/theme_condition.js | 5 +++++
ambari-web/test/mappers/configs/themes_mapper_test.js | 16 ++++++++++------
4 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/ambari-web/app/mappers/configs/themes_mapper.js
b/ambari-web/app/mappers/configs/themes_mapper.js
index 3eb72ce..a2519e2 100644
--- a/ambari-web/app/mappers/configs/themes_mapper.js
+++ b/ambari-web/app/mappers/configs/themes_mapper.js
@@ -144,7 +144,7 @@ App.themesMapper = App.QuickDataMapper.create({
parsedSubSection.id = parsedSubSection.name + '_' + serviceName + '_'
+ themeName;
parsedSubSection.theme_name = themeName;
- this.loadSubSectionTabs(subSection, parsedSubSection);
+ this.loadSubSectionTabs(subSection, parsedSubSection, themeName);
if (parsedSubSection['depends_on']) {
subSectionConditions.push(parsedSubSection);
}
@@ -152,7 +152,7 @@ App.themesMapper = App.QuickDataMapper.create({
}, this);
if (subSectionConditions.length) {
var type = 'subsection';
- this.mapThemeConditions(subSectionConditions, type);
+ this.mapThemeConditions(subSectionConditions, type, themeName);
}
App.store.safeLoadMany(this.get("subSectionModel"), subSections);
parsedSection.sub_sections = subSections.mapProperty("id");
@@ -160,7 +160,7 @@ App.themesMapper = App.QuickDataMapper.create({
},
- loadSubSectionTabs: function(subSection, parsedSubSection) {
+ loadSubSectionTabs: function(subSection, parsedSubSection, themeName) {
if (subSection['subsection-tabs']) {
var subSectionTabs = [];
var subSectionTabConditions = [];
@@ -168,7 +168,7 @@ App.themesMapper = App.QuickDataMapper.create({
subSection['subsection-tabs'].forEach(function (subSectionTab) {
var parsedSubSectionTab = this.parseIt(subSectionTab,
this.get("subSectionTabConfig"));
parsedSubSectionTab.sub_section_id = parsedSubSection.id;
- parsedSubSectionTab.theme_name = parsedSubSection.theme_name;
+ parsedSubSectionTab.theme_name = themeName;
if (parsedSubSectionTab['depends_on']) {
subSectionTabConditions.push(parsedSubSectionTab);
}
@@ -177,7 +177,7 @@ App.themesMapper = App.QuickDataMapper.create({
subSectionTabs[0].is_active = true;
if (subSectionTabConditions.length) {
var type = 'subsectionTab';
- this.mapThemeConditions(subSectionTabConditions, type);
+ this.mapThemeConditions(subSectionTabConditions, type, themeName);
}
App.store.safeLoadMany(this.get("subSectionTabModel"), subSectionTabs);
parsedSubSection.sub_section_tabs = subSectionTabs.mapProperty("id");
@@ -299,7 +299,7 @@ App.themesMapper = App.QuickDataMapper.create({
* @param subSections: Array
* @param type: {String} possible values: `subsection` or `subsectionTab`
*/
- mapThemeConditions: function(subSections, type) {
+ mapThemeConditions: function(subSections, type, themeName) {
var subSectionConditionsCopy = [];
subSections.forEach(function(_subSection){
var subSectionConditions = _subSection['depends_on'];
@@ -307,6 +307,7 @@ App.themesMapper = App.QuickDataMapper.create({
var subSectionCondition = $.extend({},_subSectionCondition);
subSectionCondition.id = _subSection.id + '_' + index;
subSectionCondition.name = _subSection.name;
+ subSectionCondition.theme_name = themeName;
if (_subSectionCondition.configs &&
_subSectionCondition.configs.length) {
subSectionCondition.configs =
_subSectionCondition.configs.map(function (item) {
var result = {};
diff --git a/ambari-web/app/mixins/common/configs/enhanced_configs.js
b/ambari-web/app/mixins/common/configs/enhanced_configs.js
index cec9744..e8b0864 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -827,11 +827,11 @@ App.EnhancedConfigsMixin =
Em.Mixin.create(App.ConfigWithOverrideRecommendationP
let themeResource;
if (subsectionCondition.get('type') === 'subsection') {
themeResource = App.SubSection.find().find(function (subsection) {
- return subsection.get('name') === subsectionConditionName &&
subsectionCondition.get('id').toLowerCase().includes(subsection.get('themeName').toLowerCase());
+ return subsection.get('name') === subsectionConditionName &&
subsectionCondition.get('themeName') === subsection.get('themeName');
});
} else if (subsectionCondition.get('type') === 'subsectionTab') {
themeResource = App.SubSectionTab.find().find(function
(subsectionTab) {
- return subsectionTab.get('name') === subsectionConditionName &&
subsectionCondition.get('id').toLowerCase().includes(subsectionTab.get('themeName').toLowerCase());
+ return subsectionTab.get('name') === subsectionConditionName &&
subsectionCondition.get('themeName') === subsectionTab.get('themeName');
});
}
themeResource.set('isHiddenByConfig', !valueAttributes.visible);
diff --git a/ambari-web/app/models/configs/theme/theme_condition.js
b/ambari-web/app/models/configs/theme/theme_condition.js
index a77256a..43a102b 100644
--- a/ambari-web/app/models/configs/theme/theme_condition.js
+++ b/ambari-web/app/models/configs/theme/theme_condition.js
@@ -42,6 +42,11 @@ App.ThemeCondition = DS.Model.extend({
name: DS.attr('string'),
/**
+ * theme from which this is coming from , eg: default, database,
credentials, etc.
+ */
+ themeName: DS.attr('string'),
+
+ /**
* Name of the config that is being affected with the condition
*/
configName: DS.attr('string'),
diff --git a/ambari-web/test/mappers/configs/themes_mapper_test.js
b/ambari-web/test/mappers/configs/themes_mapper_test.js
index a2983f1..a4d9924 100644
--- a/ambari-web/test/mappers/configs/themes_mapper_test.js
+++ b/ambari-web/test/mappers/configs/themes_mapper_test.js
@@ -221,7 +221,8 @@ describe('App.themeMapper', function () {
"row_span": 5,
"section_id": 1,
"theme_name": "t1",
- }
+ },
+ "t1"
]);
});
@@ -243,7 +244,8 @@ describe('App.themeMapper', function () {
"section_id": 1,
"theme_name": "t1"
}],
- 'subsection'
+ 'subsection',
+ "t1"
]);
});
@@ -296,7 +298,7 @@ describe('App.themeMapper', function () {
});
it('mapThemeConditions should be called', function() {
- App.themesMapper.loadSubSectionTabs(subSection, {id: 2, theme_name:
"t1"});
+ App.themesMapper.loadSubSectionTabs(subSection, {id: 2}, "t1");
expect(App.themesMapper.mapThemeConditions.getCall(0).args).to.be.eql([
[{
"depends_on": [],
@@ -307,12 +309,13 @@ describe('App.themeMapper', function () {
"sub_section_id": 2,
"theme_name": "t1"
}],
- 'subsectionTab'
+ 'subsectionTab',
+ "t1"
]);
});
it('App.store.safeLoadMany should be called', function() {
- App.themesMapper.loadSubSectionTabs(subSection, {id: 2, theme_name:
"t1"});
+ App.themesMapper.loadSubSectionTabs(subSection, {id: 2}, "t1");
expect(App.store.safeLoadMany.getCall(0).args[1]).to.be.eql([
{
"depends_on": [],
@@ -457,7 +460,7 @@ describe('App.themeMapper', function () {
}
];
- App.themesMapper.mapThemeConditions(subSections, 'type1');
+ App.themesMapper.mapThemeConditions(subSections, 'type1', "t1");
expect(App.store.safeLoadMany.getCall(0).args[1][0]).to.be.eql({
"id": "ss-1_0",
"name": 'sub-section',
@@ -468,6 +471,7 @@ describe('App.themeMapper', function () {
}
],
"resource": "config",
+ "theme_name": "t1",
"type": "type1"
});
});