Updated Branches: refs/heads/trunk a9f8f3b69 -> cb0b3d928
AMBARI-3938. JS error when switching config groups in Hive / Oozie service config pages. (yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cb0b3d92 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cb0b3d92 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cb0b3d92 Branch: refs/heads/trunk Commit: cb0b3d928a6c0045697034ef007987d37429babc Parents: a9f8f3b Author: Yusaku Sako <[email protected]> Authored: Sat Nov 30 15:40:22 2013 -0800 Committer: Yusaku Sako <[email protected]> Committed: Sat Nov 30 15:40:22 2013 -0800 ---------------------------------------------------------------------- ambari-web/app/views/wizard/controls_view.js | 42 ++++++++++++++--------- 1 file changed, 26 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/cb0b3d92/ambari-web/app/views/wizard/controls_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/wizard/controls_view.js b/ambari-web/app/views/wizard/controls_view.js index 7f36c15..4e9d9fa 100644 --- a/ambari-web/app/views/wizard/controls_view.js +++ b/ambari-web/app/views/wizard/controls_view.js @@ -315,34 +315,44 @@ App.ServiceConfigRadioButton = Ember.Checkbox.extend({ value: null, didInsertElement: function () { + console.debug('App.ServiceConfigRadioButton.didInsertElement'); if (this.get('parentView.serviceConfig.value') === this.get('value')) { + console.debug(this.get('name') + ":" + this.get('value') + ' is checked'); this.set('checked', true); } }, click: function () { this.set('checked', true); + console.debug('App.ServiceConfigRadioButton.click'); this.onChecked(); }, onChecked: function () { - this.set('parentView.serviceConfig.value', this.get('value')); - var components = this.get('parentView.serviceConfig.options'); - components - .forEach(function (_component) { - if (_component.foreignKeys) { - _component.foreignKeys.forEach(function (_componentName) { - if (this.get('parentView.categoryConfigsAll').someProperty('name', _componentName)) { - var component = this.get('parentView.categoryConfigsAll').findProperty('name', _componentName); - if (_component.displayName === this.get('value')) { - component.set('isVisible', true); - } else { - component.set('isVisible', false); + // Wrapping the call with Ember.run.next prevents a problem where setting isVisible on component + // causes JS error due to re-rendering. For example, this occurs when switching the Config Group + // in Service Config page + Ember.run.next(this, function() { + console.debug('App.ServiceConfigRadioButton.onChecked'); + this.set('parentView.serviceConfig.value', this.get('value')); + var components = this.get('parentView.serviceConfig.options'); + components + .forEach(function (_component) { + if (_component.foreignKeys) { + _component.foreignKeys.forEach(function (_componentName) { + if (this.get('parentView.categoryConfigsAll').someProperty('name', _componentName)) { + var component = this.get('parentView.categoryConfigsAll').findProperty('name', _componentName); + if (_component.displayName === this.get('value')) { + console.debug('setting isVisible on ' + component.get('name')); + component.set('isVisible', true); + } else { + component.set('isVisible', false); + } } - } - }, this); - } - }, this); + }, this); + } + }, this); + }); }.observes('checked'), disabled: function () {
