ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-7074 Config History: unable to display a service config version in non-default group. (atkach)
Date Fri, 29 Aug 2014 11:31:29 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 60c0d169b -> ccdb670c8


AMBARI-7074 Config History: unable to display a service config version in non-default group.
(atkach)


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

Branch: refs/heads/trunk
Commit: ccdb670c8b739fb604ec04cec941d6e146f41577
Parents: 60c0d16
Author: atkach <atkach@hortonworks.com>
Authored: Fri Aug 29 14:28:02 2014 +0300
Committer: atkach <atkach@hortonworks.com>
Committed: Fri Aug 29 14:28:02 2014 +0300

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    | 52 ++++++--------------
 .../views/common/configs/config_history_flow.js | 44 ++++++-----------
 2 files changed, 29 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ccdb670c/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 22e3aac..36d56dd 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -271,41 +271,9 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
    */
   loadServiceConfigVersionsSuccess: function (data, opt, params) {
     var self = this;
-    this.loadCurrentVersions().complete(function () {
-      App.serviceConfigVersionsMapper.map(data);
-      self.loadSelectedVersion();
-    });
-  },
-
-  loadCurrentVersions: function () {
-    return App.ajax.send({
-      name: 'service.serviceConfigVersions.get.current',
-      sender: this,
-      data: {},
-      success: 'loadCurrentVersionsSuccess'
-    })
-  },
-
-  /**
-   * load current service config version number
-   * set currentVersion (current version for default group)
-   * @param data
-   * @param opt
-   * @param params
-   */
-  loadCurrentVersionsSuccess: function (data, opt, params) {
-    var self = this;
-    for (var service in data.Clusters.desired_service_config_versions) {
-      if (self.get('content.serviceName') == service) {
-        //current version of default config group
-        data.Clusters.desired_service_config_versions[service].forEach (function(version)
{
-          if (version.group_id == null) {
-            self.set('currentVersion', version.service_config_version);
-          }
-        });
-      }
-    }
-
+    App.serviceConfigVersionsMapper.map(data);
+    self.set('currentVersion', data.items.filterProperty('group_id', null).findProperty('is_current').service_config_version);
+    self.loadSelectedVersion();
   },
 
   /**
@@ -316,6 +284,11 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
   loadSelectedVersion: function (version) {
     var self = this;
     this.set('versionLoaded', false);
+    var groupName = App.ServiceConfigVersion.find(this.get('content.serviceName') + "_" +
version).get('groupName');
+
+    if (self.get('dataIsLoaded') && !(groupName && this.get('selectedConfigGroup.name')
=== groupName)) {
+      this.set('selectedConfigGroup', this.get('configGroups').findProperty('isDefault'));
+    }
 
     App.ajax.send({
       name: 'service.serviceConfigVersion.get',
@@ -326,8 +299,12 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
       },
       success: 'loadSelectedVersionSuccess'
     }).complete(function () {
-        self.loadServiceTagsAndGroups();
-    });
+        if (self.get('dataIsLoaded')) {
+          self.onConfigGroupChange();
+        } else {
+          self.loadServiceTagsAndGroups();
+        }
+      });
   },
 
   /**
@@ -352,7 +329,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
     App.router.get('configurationController').saveToDB(data.items[0].configurations);
     this.loadedClusterSiteToTagMap = siteToTagMap;
     this.set('selectedVersion', params.serviceConfigVersion);
-    this.loadServiceTagsAndGroups();
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/ccdb670c/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 a115223..80797f2 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -47,14 +47,6 @@ App.ConfigHistoryFlowView = Em.View.extend({
     return this.get('controller.selectedService.serviceName');
   }.property('controller.selectedService.serviceName'),
 
-  selectedConfigGroupName: function () {
-    return this.get('controller.selectedConfigGroup.displayName');
-  }.property('controller.selectedConfigGroup.displayName'),
-
-  isDefaultConfigGroupSelected: function () {
-    return this.get('controller.selectedConfigGroup.isDefault');
-  }.property('controller.selectedConfigGroup.isDefault'),
-
   displayedServiceVersion: function () {
     return this.get('serviceVersions').findProperty('isDisplayed');
   }.property('serviceVersions.@each.isDisplayed'),
@@ -79,28 +71,22 @@ App.ConfigHistoryFlowView = Em.View.extend({
   serviceVersions: function () {
     var serviceVersions;
     var allServiceVersions = App.ServiceConfigVersion.find().filterProperty('serviceName',
this.get('serviceName'));
-    if (this.get('isDefaultConfigGroupSelected')) {
-      // filtered all versions which belong to default group
-      serviceVersions = allServiceVersions.filterProperty('groupName', null);
-      serviceVersions.forEach( function (version) {
-        version.set('isDisabled', false);
+    if (this.get('controller.selectedConfigGroup.isDefault')) {
+      allServiceVersions.forEach(function (version) {
+        version.set('isDisabled', !Em.isNone(version.get('groupName')));
       });
-    }else {
+      serviceVersions = allServiceVersions.filterProperty('groupName', null);
+    } else {
       // filter out default group(should be grayedOut) and current selectedGroup versions
-      var defaultServiceVersions = allServiceVersions.filterProperty('groupName', null);
-      defaultServiceVersions.forEach( function (version) {
-        version.set('isDisabled', true);
-      });
-      var selectedServiceVersions = allServiceVersions.filterProperty('groupName', this.get('selectedConfigGroupName'));
-      selectedServiceVersions.forEach( function (version) {
-        version.set('isDisabled', false);
-      });
-      serviceVersions = selectedServiceVersions.concat(defaultServiceVersions) ;
+      allServiceVersions.forEach(function (version) {
+        version.set('isDisabled', !(version.get('groupName') === this.get('controller.selectedConfigGroup.name')));
+      }, this);
+      serviceVersions = allServiceVersions.filterProperty('groupName', null).concat(allServiceVersions.filterProperty('groupName',
this.get('controller.selectedConfigGroup.name')));
     }
     return serviceVersions.sort(function (a, b) {
       return Em.get(a, 'createTime') - Em.get(b, 'createTime');
     });
-  }.property('serviceName', 'selectedConfigGroupName', 'isDefaultConfigGroupSelected'),
+  }.property('serviceName', 'controller.selectedConfigGroup'),
   /**
    * service versions which in viewport and visible to user
    */
@@ -151,12 +137,12 @@ App.ConfigHistoryFlowView = Em.View.extend({
     serviceVersions.setEach('isDisplayed', false);
     //set the correct version to display
     var allCurrent = serviceVersions.filterProperty('isCurrent');
-    if (this.get('isDefaultConfigGroupSelected')) {
+    if (this.get('controller.selectedConfigGroup.isDefault')) {
       // display current in default group
       allCurrent.findProperty('groupName', null).set('isDisplayed', true);
-    }else {
+    } else {
       // display current in selected group
-      var current = allCurrent.findProperty('groupName', this.get('selectedConfigGroupName'));
+      var current = allCurrent.findProperty('groupName', this.get('controller.selectedConfigGroup.name'));
       current ? current.set('isDisplayed', true) : allCurrent.findProperty('groupName', null).set('isDisplayed',
true);
     }
 
@@ -218,8 +204,8 @@ App.ConfigHistoryFlowView = Em.View.extend({
       serviceVersion.set('first', (index === startIndex));
     });
     this.set('showLeftArrow', (startIndex !== 0));
-    this.set('showRightArrow', (this.get('serviceVersions.length') > this.VERSIONS_IN_FLOW)
&& ((startIndex + this.VERSIONS_IN_FLOW) !== this.get('serviceVersions.length')));
-  },
+    this.set('showRightArrow', (this.get('serviceVersions.length') > this.VERSIONS_IN_FLOW)
&& ((startIndex + this.VERSIONS_IN_FLOW) < this.get('serviceVersions.length')));
+  }.observes('serviceVersions.length'),
 
   /**
    * switch configs view version to chosen


Mime
View raw message