ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-18472 Can't switch to not current version for not default config gorup. (akovalenko)
Date Wed, 01 Mar 2017 19:06:39 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 ae44ad03a -> 56432c651


AMBARI-18472 Can't switch to not current version for not default config gorup. (akovalenko)


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

Branch: refs/heads/branch-2.5
Commit: 56432c6513d5679fc39dcb4d035c94b9dbd2e125
Parents: ae44ad0
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Wed Mar 1 21:02:55 2017 +0200
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Wed Mar 1 21:06:01 2017 +0200

----------------------------------------------------------------------
 .../app/mixins/common/configs/configs_loader.js |  2 +-
 .../views/common/configs/config_history_flow.js | 46 ++++++++++----------
 2 files changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/56432c65/ambari-web/app/mixins/common/configs/configs_loader.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/configs_loader.js b/ambari-web/app/mixins/common/configs/configs_loader.js
index 458c38f..d02ce98 100644
--- a/ambari-web/app/mixins/common/configs/configs_loader.js
+++ b/ambari-web/app/mixins/common/configs/configs_loader.js
@@ -71,6 +71,7 @@ App.ConfigsLoader = Em.Mixin.create(App.GroupsMappingMixin, {
     if (!this.get('preSelectedConfigVersion')) {
       this.set('selectedVersion', this.get('currentDefaultVersion'));
     }
+    this.set('preSelectedConfigVersion', null);
   },
 
   loadPreSelectedConfigVersion: function () {
@@ -88,7 +89,6 @@ App.ConfigsLoader = Em.Mixin.create(App.GroupsMappingMixin, {
       });
       self.set('selectedConfigGroup', selectedGroup);
       self.loadSelectedVersion(preSelectedVersion.get('version'), selectedGroup);
-      self.set('preSelectedConfigVersion', null);
       preSelectedVersion = null;
     });
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/56432c65/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 d0991da..0cd6b7f 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -173,6 +173,7 @@ App.ConfigHistoryFlowView = Em.View.extend({
       placement: 'top'
     });
     this.$(".version-info-bar-wrapper").stick_in_parent({parent: '#serviceConfig', offset_top:
10});
+    this.onChangeConfigGroup();
   },
 
   willDestroyElement: function() {
@@ -211,38 +212,37 @@ App.ConfigHistoryFlowView = Em.View.extend({
   onChangeConfigGroup: function () {
     var serviceVersions = this.get('serviceVersions');
     var selectedGroupName = this.get('controller.selectedConfigGroup.name');
+    var preselectedVersion = this.get('controller.selectedVersion');
     var startIndex = 0;
     var currentIndex = 0;
+    var isCurrentInDefaultGroupIndex = null;
+
 
     serviceVersions.setEach('isDisplayed', false);
-    //display the version belongs to current group
-    if (this.get('controller.selectedConfigGroup.isDefault')) {
-      // display current in default group
-      serviceVersions.forEach(function (serviceVersion, index) {
-        // find current in default group
-        if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') ===
App.ServiceConfigGroup.defaultGroupName) {
-          serviceVersion.set('isDisplayed', true);
-          currentIndex = index + 1;
-        }
-      });
-    } else {
-      // display current in selected group
+    // display selected version from config history
+    serviceVersions.forEach(function (serviceVersion, index) {
+      // find selected version in group
+      if (serviceVersion.get('version') === preselectedVersion && serviceVersion.get('groupName')
=== selectedGroupName) {
+        serviceVersion.set('isDisplayed', true);
+        currentIndex = index + 1;
+      }
+    });
+    // display current in selected group
+    if (!currentIndex) {
       serviceVersions.forEach(function (serviceVersion, index) {
         // find current in selected group
         if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') ===
selectedGroupName) {
           serviceVersion.set('isDisplayed', true);
           currentIndex = index + 1;
         }
+        if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') ===
App.ServiceConfigGroup.defaultGroupName) {
+          isCurrentInDefaultGroupIndex = index;
+        }
       });
-      // no current version for selected group, show default group current version
-      if (currentIndex == 0) {
-        serviceVersions.forEach(function (serviceVersion, index) {
-          // find current in default group
-          if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName')
=== App.ServiceConfigGroup.defaultGroupName) {
-            currentIndex = index + 1;
-            serviceVersion.set('isDisplayed', true);
-          }
-        });
+      // if there is no current version in selected group show current version from default
group
+      if (!currentIndex) {
+        serviceVersions[isCurrentInDefaultGroupIndex].set('isDisplayed', true);
+        currentIndex = isCurrentInDefaultGroupIndex + 1;
       }
     }
     // show current version as the last one
@@ -251,7 +251,7 @@ App.ConfigHistoryFlowView = Em.View.extend({
     }
     this.set('startIndex', startIndex);
     this.adjustFlowView();
-  }.observes('controller.selectedConfigGroup.name'),
+  }.observes('controller.selectedConfigGroup'),
 
   /**
    *  define the first element in viewport
@@ -639,4 +639,4 @@ App.ConfigHistoryDropdownSubMenuView = Em.View.extend({
       $("#config_version_popup").removeAttr('style');
     }
   })
-});
\ No newline at end of file
+});


Mime
View raw message