You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/09/03 17:27:34 UTC

git commit: AMBARI-7134 Configs: clicking on a non-default SCV does not navigate to the selected config group/SCV. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/trunk c76d1ef46 -> f1e26f1c5


AMBARI-7134 Configs: clicking on a non-default SCV does not navigate to the selected config group/SCV. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f1e26f1c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f1e26f1c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f1e26f1c

Branch: refs/heads/trunk
Commit: f1e26f1c59c261d2b5ae3a613ec6dbc3f019298f
Parents: c76d1ef
Author: atkach <at...@hortonworks.com>
Authored: Wed Sep 3 18:25:15 2014 +0300
Committer: atkach <at...@hortonworks.com>
Committed: Wed Sep 3 18:27:28 2014 +0300

----------------------------------------------------------------------
 .../app/controllers/main/service/info/configs.js       | 13 +++++++++----
 ambari-web/app/models/service_config_version.js        |  3 ++-
 ambari-web/app/routes/main.js                          |  3 ++-
 .../app/templates/main/dashboard/config_history.hbs    |  2 +-
 .../app/views/common/configs/config_history_flow.js    |  8 ++++----
 5 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f1e26f1c/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 2c1774e..d104083 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -45,6 +45,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
   saveConfigsFlag: true,
   isCompareMode: false,
   compareServiceVersion: null,
+  preSelectedConfigVersion: null,
   // contain Service Config Property, when user proceed from Select Config Group dialog
   overrideToAdd: null,
   //latest version of service config versions
@@ -286,10 +287,13 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
    * @param params
    */
   loadServiceConfigVersionsSuccess: function (data, opt, params) {
-    var self = this;
     App.serviceConfigVersionsMapper.map(data);
-    self.set('currentVersion', data.items.filterProperty('group_id', -1).findProperty('is_current').service_config_version);
-    self.loadSelectedVersion();
+    if (this.get('preSelectedConfigVersion')) {
+      this.set('currentVersion', this.get('preSelectedConfigVersion.version'));
+    } else {
+      this.set('currentVersion', data.items.filterProperty('group_id', -1).findProperty('is_current').service_config_version);
+    }
+    this.loadSelectedVersion();
   },
 
   /**
@@ -450,7 +454,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
       configSiteTags: []
     });
     if (!selectedConfigGroup) {
-      selectedConfigGroup = defaultConfigGroup;
+      selectedConfigGroup = configGroups.findProperty('name', this.get('preSelectedConfigVersion.groupName')) || defaultConfigGroup;
     }
 
     this.get('configGroups').sort(function (configGroupA, configGroupB) {
@@ -458,6 +462,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
     });
     this.get('configGroups').unshift(defaultConfigGroup);
     this.set('selectedConfigGroup', selectedConfigGroup);
+    this.set('preSelectedConfigVersion', null);
   },
 
   onConfigGroupChange: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1e26f1c/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 0159d35..8d5c6fd 100644
--- a/ambari-web/app/models/service_config_version.js
+++ b/ambari-web/app/models/service_config_version.js
@@ -35,11 +35,12 @@ App.ServiceConfigVersion = DS.Model.extend({
   service: DS.belongsTo('App.Service'),
   index: DS.attr('number'),
   isCurrent: DS.attr('boolean'),
+  isDisplayed: DS.attr('boolean'),
   currentTooltip: function () {
     return Em.I18n.t('dashboard.configHistory.table.current.tooltip').format(this.get('displayName'), this.get('configGroupName'));
   }.property('displayName', 'configGroupName'),
   configGroupName: function () {
-    return this.get('groupName') == Em.I18n.t('dashboard.configHistory.table.configGroup.default') ? (this.get('displayName') + ' ' + Em.I18n.t('common.default')) : this.get('groupName');
+    return (this.get('groupName') === 'default') ? (this.get('displayName') + ' ' + Em.I18n.t('common.default')) : this.get('groupName');
   }.property('groupName'),
   briefNotes: function () {
     return (typeof this.get('notes') === 'string') ? this.get('notes').slice(0, 100) : "";

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1e26f1c/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 4462ccd..31f9afb 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -149,7 +149,8 @@ module.exports = Em.Route.extend({
     }),
     goToServiceConfigs: function (router, event) {
       router.get('mainServiceItemController').set('routeToConfigs', true);
-      router.transitionTo('main.services.service.configs', App.Service.find(event.context));
+      router.get('mainServiceInfoConfigsController').set('preSelectedConfigVersion', event.context);
+      router.transitionTo('main.services.service.configs', App.Service.find(event.context.get('serviceName')));
       router.get('mainServiceItemController').set('routeToConfigs', false);
     }
   }),

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1e26f1c/ambari-web/app/templates/main/dashboard/config_history.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/config_history.hbs b/ambari-web/app/templates/main/dashboard/config_history.hbs
index ac5a2b8..9b2718b 100644
--- a/ambari-web/app/templates/main/dashboard/config_history.hbs
+++ b/ambari-web/app/templates/main/dashboard/config_history.hbs
@@ -42,7 +42,7 @@
           {{#view view.ConfigVersionView contentBinding="item"}}
             <td class="first">
               <span class="label label-info">{{item.versionText}}</span>
-              <a {{action goToServiceConfigs item.serviceName}} class="service-name">
+              <a {{action goToServiceConfigs item}} class="service-name">
                 {{item.displayName}}
               </a>
               <i {{bindAttr class=":icon-refresh :restart-required-service item.isRestartRequired::hidden"}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1e26f1c/ambari-web/app/views/common/configs/config_history_flow.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_history_flow.js b/ambari-web/app/views/common/configs/config_history_flow.js
index 0c2dc33..bbb1ad8 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -154,16 +154,16 @@ App.ConfigHistoryFlowView = Em.View.extend({
     var serviceVersions = this.get('serviceVersions');
     var startIndex = 0;
     var currentIndex = 0;
+    var selectedVersion = this.get('controller.currentVersion');
 
     serviceVersions.setEach('isDisplayed', false);
-    // display current in default group
+
     serviceVersions.forEach(function (serviceVersion, index) {
-      // find current in default group
-      if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') == Em.I18n.t('dashboard.configHistory.table.configGroup.default')){
+      if (selectedVersion === serviceVersion.get('version')) {
         serviceVersion.set('isDisplayed', true);
         currentIndex = index;
       }
-    });
+    }, this);
 
     // show current version as the last one
     if (currentIndex + 1 > this.VERSIONS_IN_FLOW) {