Repository: ambari Updated Branches: refs/heads/trunk 6d4a93159 -> 823c3b988
AMBARI-13465. Customize Services opens the "Advanced" tab by default Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/823c3b98 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/823c3b98 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/823c3b98 Branch: refs/heads/trunk Commit: 823c3b988dad59af5d421ae674fee5ec2c939fc8 Parents: 6d4a931 Author: Alex Antonenko <hiv...@gmail.com> Authored: Mon Oct 19 13:05:26 2015 +0300 Committer: Alex Antonenko <hiv...@gmail.com> Committed: Mon Oct 19 13:05:26 2015 +0300 ---------------------------------------------------------------------- ambari-web/app/models/configs/theme/tab.js | 5 +++++ .../configs/service_config_layout_tab_view.js | 2 ++ .../views/common/configs/service_config_view.js | 19 ++++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/823c3b98/ambari-web/app/models/configs/theme/tab.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/configs/theme/tab.js b/ambari-web/app/models/configs/theme/tab.js index 0940022..cb7aeae 100644 --- a/ambari-web/app/models/configs/theme/tab.js +++ b/ambari-web/app/models/configs/theme/tab.js @@ -31,6 +31,11 @@ App.Tab = DS.Model.extend({ isRendered: DS.attr('boolean', {defaultValue: false}), /** + * Determines if all <code>configs</code> were attached to tab. + */ + isConfigsPrepared: DS.attr('boolean', {defaultValue: false}), + + /** * Number of the errors in all sections in the current tab * @type {number} */ http://git-wip-us.apache.org/repos/asf/ambari/blob/823c3b98/ambari-web/app/views/common/configs/service_config_layout_tab_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/service_config_layout_tab_view.js b/ambari-web/app/views/common/configs/service_config_layout_tab_view.js index f7a376d..720dd12 100644 --- a/ambari-web/app/views/common/configs/service_config_layout_tab_view.js +++ b/ambari-web/app/views/common/configs/service_config_layout_tab_view.js @@ -172,11 +172,13 @@ App.ServiceConfigLayoutTabView = Em.View.extend(App.ConfigOverridable, { didInsertElement: function () { this.set('dataIsReady', false); + this.set('content.isConfigsPrepared', false); this._super(); this.prepareConfigProperties(); if (this.get('controller.isCompareMode')) { this.get('parentView').filterEnhancedConfigs(); } + this.set('content.isConfigsPrepared', true); this.set('dataIsReady', true); } http://git-wip-us.apache.org/repos/asf/ambari/blob/823c3b98/ambari-web/app/views/common/configs/service_config_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/service_config_view.js b/ambari-web/app/views/common/configs/service_config_view.js index 5ad5c2e..ad50998 100644 --- a/ambari-web/app/views/common/configs/service_config_view.js +++ b/ambari-web/app/views/common/configs/service_config_view.js @@ -31,6 +31,12 @@ App.ServiceConfigView = Em.View.extend({ filter: '', /** + * Determines that active tab is set during view initialize. + * @type {boolean} + */ + initalActiveTabIsSet: false, + + /** * Bound from parent view in the template * @type {object[]} */ @@ -180,11 +186,22 @@ App.ServiceConfigView = Em.View.extend({ advancedTab.set('isRendered', false); } this.processTabs(tabs); - this.pickActiveTab(tabs); return tabs; }.property('controller.selectedServiceNameTrigger'), /** + * Set active tab when view attached and configs are linked to tabs. + */ + initialActiveTabObserver: function() { + var tabs = this.get('tabs').filterProperty('isAdvanced', false); + if (tabs.everyProperty('isConfigsPrepared', true) && !this.get('initalActiveTabIsSet')) { + this.get('tabs').setEach('isActive', false); + this.pickActiveTab(this.get('tabs')); + this.set('tabsWereSet', true); + } + }.observes('tabs.@each.isConfigsPrepared'), + + /** * Pick the first non hidden tab and make it active when there is no active tab * @method pickActiveTab */