Repository: ambari Updated Branches: refs/heads/trunk 892f423c8 -> 760d9894d
AMBARI-7366 On switching config group config version stays the same. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/760d9894 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/760d9894 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/760d9894 Branch: refs/heads/trunk Commit: 760d9894d3939dfd4b4d343ddbbeef05f48f9208 Parents: 892f423 Author: atkach <[email protected]> Authored: Wed Sep 17 18:27:55 2014 +0300 Committer: atkach <[email protected]> Committed: Wed Sep 17 18:27:55 2014 +0300 ---------------------------------------------------------------------- .../controllers/main/service/info/configs.js | 21 +++++++++++++++----- ambari-web/app/models/service_config_version.js | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/760d9894/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index 32343ff..3112d40 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -324,17 +324,18 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM * get selected service config version * In case selected version is undefined then take currentDefaultVersion * @param version + * @param switchToGroup */ - loadSelectedVersion: function (version) { + loadSelectedVersion: function (version, switchToGroup) { var self = this; this.set('versionLoaded', false); version = version || this.get('currentDefaultVersion'); //version of non-default group require properties from current version of default group to correctly display page var versions = (this.isVersionDefault(version)) ? [version] : [this.get('currentDefaultVersion'), version]; + switchToGroup = this.isVersionDefault(version) ? this.get('configGroups').findProperty('isDefault') : switchToGroup; - //if version from default group selected then switch to default group - if (self.get('dataIsLoaded') && this.isVersionDefault(version)) { - this.set('selectedConfigGroup', this.get('configGroups').findProperty('isDefault')); + if (self.get('dataIsLoaded') && switchToGroup) { + this.set('selectedConfigGroup', switchToGroup); } App.ajax.send({ @@ -2708,7 +2709,17 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM } //clean when switch config group this.loadedGroupToOverrideSiteToTagMap = {}; - this.set('selectedConfigGroup', event.context); + if (App.supports.configHistory) { + var configGroupVersions = App.ServiceConfigVersion.find().filterProperty('groupId', event.context.get('id')); + //check whether config group has config versions + if (configGroupVersions.length > 0) { + this.loadSelectedVersion(configGroupVersions.findProperty('isCurrent').get('version'), event.context); + } else { + this.loadSelectedVersion(null, event.context); + } + } else { + this.set('selectedConfigGroup', event.context); + } }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/760d9894/ambari-web/app/models/service_config_version.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/service_config_version.js b/ambari-web/app/models/service_config_version.js index 4a65ac2..61703ad 100644 --- a/ambari-web/app/models/service_config_version.js +++ b/ambari-web/app/models/service_config_version.js @@ -27,7 +27,7 @@ App.ServiceConfigVersion = DS.Model.extend({ return App.format.role(this.get('serviceName')); }.property('serviceName'), groupName: DS.attr('string'), - groupId: DS.attr('string'), + groupId: DS.attr('number'), version: DS.attr('number'), createTime: DS.attr('number'), author: DS.attr('string'),
