This is an automated email from the ASF dual-hosted git repository. yusaku pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
commit b72fc2f8bbfd17c340f9c94023a83435d73167c5 Author: Andrii Tkach <[email protected]> AuthorDate: Wed Jun 20 15:11:16 2018 +0300 AMBARI-24153 Customize Service step issues --- .../app/controllers/wizard/step7_controller.js | 11 ++++++-- ambari-web/app/mappers/configs/themes_mapper.js | 4 +-- .../app/views/wizard/step7/databases_tab_view.js | 29 +++++++++++++++++++++- .../test/mappers/configs/themes_mapper_test.js | 6 +++-- 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js index 8acdaf8..0a8e5b2 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -77,6 +77,11 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E credentialsTabNextEnabled: false, /** + * Define state of next button on databases tab + */ + databasesTabNextEnabled: false, + + /** * used in services_config.js view to mark a config with security icon */ secureConfigs: require('data/configs/wizards/secure_mapping'), @@ -2037,12 +2042,14 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E switch (tabName) { case 'credentials': return !this.get('credentialsTabNextEnabled'); + case 'databases': + return !this.get('databasesTabNextEnabled'); case 'all-configurations': return this.get('isSubmitDisabled'); default: return false; } - }.property('[email protected]', 'isSubmitDisabled', 'credentialsTabNextEnabled'), + }.property('[email protected]', 'isSubmitDisabled', 'credentialsTabNextEnabled', 'databasesTabNextEnabled'), /** * Set isDisabled state for tabs @@ -2092,7 +2099,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E if (validations !== this.get('validationsCounter')) { this.ringBell(); } - this.set('hasErrors', !!validations); + this.set('hasErrors', Boolean(validations + configErrorList.get('criticalIssues.length'))); this.set('validationsCounter', validations); }.observes('changedProperties.length', '[email protected]', 'configErrorList.issues.length', 'configErrorList.criticalIssues.length'), diff --git a/ambari-web/app/mappers/configs/themes_mapper.js b/ambari-web/app/mappers/configs/themes_mapper.js index a2519e2..e2b42e8 100644 --- a/ambari-web/app/mappers/configs/themes_mapper.js +++ b/ambari-web/app/mappers/configs/themes_mapper.js @@ -205,11 +205,11 @@ App.themesMapper = App.QuickDataMapper.create({ var subSection = App.SubSection.find(subSectionId); } - if (configProperty && subSection) { + if (configProperty && subSection && subSection.get('isLoaded')) { if (!subSection.get('configProperties').contains(configProperty.id)) { subSection.set('configProperties', subSection.get('configProperties').concat(configProperty.id)); } - } else if (configProperty && subSectionTab) { + } else if (configProperty && subSectionTab && subSectionTab.get('isLoaded')) { if (!subSectionTab.get('configProperties').contains(configProperty.id)) { subSectionTab.set('configProperties', subSectionTab.get('configProperties').concat(configProperty.id)); } diff --git a/ambari-web/app/views/wizard/step7/databases_tab_view.js b/ambari-web/app/views/wizard/step7/databases_tab_view.js index 8ff218f..7ed344f 100644 --- a/ambari-web/app/views/wizard/step7/databases_tab_view.js +++ b/ambari-web/app/views/wizard/step7/databases_tab_view.js @@ -64,6 +64,33 @@ App.DatabasesTabOnStep7View = Em.View.extend({ currentTab.set('isActive', true); } })); - } + this.setProperties(); + }, + + setProperties: function() { + if (this.get('controller.stepConfigsCreated')) { + var properties = []; + this.get('tabs').forEach((tab) => { + if (tab.get('isCategorized')) { + tab.get('sections').forEach((section) => { + section.get('subSections').forEach((row) => { + row.get('configProperties').forEach((id) => { + var config = App.configsCollection.getConfig(id); + var stepConfig = config && this.get('controller.stepConfigs').findProperty('serviceName', Em.get(config, 'serviceName')).get('configs').findProperty('name', Em.get(config, 'name')); + if (stepConfig) { + properties.push(stepConfig); + } + }); + }); + }); + } + }); + this.set('properties', properties); + } + }, + + updateNextDisabled: function () { + this.set('controller.databasesTabNextEnabled', !this.get('properties').someProperty('error')); + }.observes('[email protected]') }); diff --git a/ambari-web/test/mappers/configs/themes_mapper_test.js b/ambari-web/test/mappers/configs/themes_mapper_test.js index a4d9924..43efee3 100644 --- a/ambari-web/test/mappers/configs/themes_mapper_test.js +++ b/ambari-web/test/mappers/configs/themes_mapper_test.js @@ -385,7 +385,8 @@ describe('App.themeMapper', function () { it('should set config to subSection', function() { json.ThemeInfo.theme_data.Theme.configuration.placement.configs[0]["subsection-name"] = 'ss-1'; var subSection = Em.Object.create({ - configProperties: [] + configProperties: [], + isLoaded: true }); this.mockSection.returns(subSection); App.themesMapper.mapThemeConfigs(json); @@ -395,7 +396,8 @@ describe('App.themeMapper', function () { it('should set config to SubSectionTab', function() { json.ThemeInfo.theme_data.Theme.configuration.placement.configs[0]["subsection-tab-name"] = 'sst-1'; var subSectionTab = Em.Object.create({ - configProperties: [] + configProperties: [], + isLoaded: true }); this.mockSectionTab.returns(subSectionTab); App.themesMapper.mapThemeConfigs(json);
