瀏覽代碼

AMBARI-7092. Config Group: FE change to intgrate new default group_id and group_name.(xiwang)

Xi Wang 11 年之前
父節點
當前提交
b6ff023474

+ 1 - 1
ambari-web/app/controllers/main/service/info/configs.js

@@ -272,7 +272,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
   loadServiceConfigVersionsSuccess: function (data, opt, params) {
     var self = this;
     App.serviceConfigVersionsMapper.map(data);
-    self.set('currentVersion', data.items.filterProperty('group_id', null).findProperty('is_current').service_config_version);
+    self.set('currentVersion', data.items.filterProperty('group_id', -1).findProperty('is_current').service_config_version);
     self.loadSelectedVersion();
   },
 

+ 1 - 0
ambari-web/app/messages.js

@@ -2005,6 +2005,7 @@ Em.I18n.translations = {
   'dashboard.configHistory.table.version.title' : 'Service',
   'dashboard.configHistory.table.configGroup.title' : 'Config Group',
   'dashboard.configHistory.table.created.title' : 'Created',
+  'dashboard.configHistory.table.configGroup.default' : 'default',
   'dashboard.configHistory.table.empty' : 'No history to display',
   'dashboard.configHistory.table.notes.default': 'Initial configurations for {0}',
   'dashboard.configHistory.table.version.versionText' : 'V{0}',

+ 1 - 1
ambari-web/app/models/service_config_version.js

@@ -39,7 +39,7 @@ App.ServiceConfigVersion = DS.Model.extend({
     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') || (this.get('displayName') + ' ' + Em.I18n.t('common.default'));
+    return this.get('groupName') == Em.I18n.t('dashboard.configHistory.table.configGroup.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) : "";

+ 7 - 6
ambari-web/app/views/common/configs/config_history_flow.js

@@ -71,17 +71,18 @@ App.ConfigHistoryFlowView = Em.View.extend({
   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', !Em.isNone(version.get('groupName')));
+        version.set('isDisabled', ! (version.get('groupName') == defaultGroup));
       });
-      serviceVersions = allServiceVersions.filterProperty('groupName', null);
+      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', null).concat(allServiceVersions.filterProperty('groupName', this.get('controller.selectedConfigGroup.name')));
+      serviceVersions = allServiceVersions.filterProperty('groupName', defaultGroup).concat(allServiceVersions.filterProperty('groupName', this.get('controller.selectedConfigGroup.name')));
     }
     return serviceVersions.sort(function (a, b) {
       return Em.get(a, 'createTime') - Em.get(b, 'createTime');
@@ -140,7 +141,7 @@ App.ConfigHistoryFlowView = Em.View.extend({
     // display current in default group
     serviceVersions.forEach(function (serviceVersion, index) {
       // find current in default group
-      if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') == null){
+      if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') == Em.I18n.t('dashboard.configHistory.table.configGroup.default')){
         serviceVersion.set('isDisplayed', true);
         currentIndex = index;
       }
@@ -170,7 +171,7 @@ App.ConfigHistoryFlowView = Em.View.extend({
         // display current in default group
         serviceVersions.forEach(function (serviceVersion, index) {
           // find current in default group
-          if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') == null){
+          if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') == Em.I18n.t('dashboard.configHistory.table.configGroup.default')){
 
             serviceVersion.set('isDisplayed', true);
             currentIndex = index;
@@ -190,7 +191,7 @@ App.ConfigHistoryFlowView = Em.View.extend({
         if (currentIndex == 0) {
           serviceVersions.forEach(function (serviceVersion, index) {
             // find current in default group
-            if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') == null){
+            if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') == Em.I18n.t('dashboard.configHistory.table.configGroup.default')){
               serviceVersion.set('isDisplayed', true);
 
               currentIndex = index;