Browse Source

AMBARI-7131 Configs: under non-default config group, the SCV box does not show the boxes for the currently selected config group. (ababiichuk)

aBabiichuk 10 years ago
parent
commit
b0ef8bfee0
1 changed files with 12 additions and 15 deletions
  1. 12 15
      ambari-web/app/views/common/configs/config_history_flow.js

+ 12 - 15
ambari-web/app/views/common/configs/config_history_flow.js

@@ -84,21 +84,18 @@ App.ConfigHistoryFlowView = Em.View.extend({
   }.property('displayedServiceVersion'),
 
   serviceVersions: function () {
-    var serviceVersions;
     var allServiceVersions = App.ServiceConfigVersion.find().filterProperty('serviceName', this.get('serviceName'));
-    var defaultGroup = Em.I18n.t('dashboard.configHistory.table.configGroup.default');
-    if (this.get('controller.selectedConfigGroup.isDefault')) {
-      allServiceVersions.forEach(function (version) {
-        version.set('isDisabled', ! (version.get('groupName') == defaultGroup));
-      });
-      serviceVersions = allServiceVersions.filterProperty('groupName', defaultGroup);
-    } else {
-      // filter out default group(should be grayedOut) and current selectedGroup versions
-      allServiceVersions.forEach(function (version) {
-        version.set('isDisabled', !(version.get('groupName') === this.get('controller.selectedConfigGroup.name')));
-      }, this);
-      serviceVersions = allServiceVersions.filterProperty('groupName', defaultGroup).concat(allServiceVersions.filterProperty('groupName', this.get('controller.selectedConfigGroup.name')));
-    }
+    var groupName = this.get('controller.selectedConfigGroup.isDefault') ? 'default'
+        : this.get('controller.selectedConfigGroup.name');
+
+    allServiceVersions.forEach(function (version) {
+      version.set('isDisabled', !(version.get('groupName') === groupName));
+    }, this);
+
+    var serviceVersions = allServiceVersions.filter(function(s) {
+      return s.get('groupName') == groupName || s.get('groupName') == 'default';
+    });
+
     return serviceVersions.sort(function (a, b) {
       return Em.get(a, 'createTime') - Em.get(b, 'createTime');
     });
@@ -109,7 +106,7 @@ App.ConfigHistoryFlowView = Em.View.extend({
    */
   visibleServiceVersion: function () {
     return this.get('serviceVersions').slice(this.get('startIndex'), (this.get('startIndex') + this.VERSIONS_IN_FLOW));
-  }.property('startIndex'),
+  }.property('startIndex', 'serviceVersions'),
 
   /**
    * enable actions to manipulate version only after it's loaded