You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by xi...@apache.org on 2014/08/29 22:57:49 UTC

[1/2] git commit: AMBARI-7089. Config History: User service display name, rather than the ID.(XIWANG)

Repository: ambari
Updated Branches:
  refs/heads/trunk 72fe79c87 -> fa7341fe4


AMBARI-7089. Config History: User service display name, rather than the ID.(XIWANG)


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

Branch: refs/heads/trunk
Commit: fa7341fe4699fac64af861d52f1b6332175c4514
Parents: 7dcdeef
Author: Xi Wang <xi...@apache.org>
Authored: Fri Aug 29 11:20:01 2014 -0700
Committer: Xi Wang <xi...@apache.org>
Committed: Fri Aug 29 13:57:15 2014 -0700

----------------------------------------------------------------------
 ambari-web/app/controllers/wizard/step8_controller.js       | 2 +-
 ambari-web/app/models/service_config_version.js             | 9 ++++++---
 .../app/templates/common/configs/config_history_flow.hbs    | 6 +++---
 ambari-web/app/templates/main/dashboard/config_history.hbs  | 2 +-
 4 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fa7341fe/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index b008f92..8d29d14 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1416,7 +1416,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, {
     selectedServices.forEach(function (service) {
       Object.keys(service.get('configTypes')).forEach(function (type) {
         if (!this.get('serviceConfigTags').someProperty('type', type)) {
-          var serviceVersionNotes = Em.I18n.t('dashboard.configHistory.table.notes.default').format(service.get('serviceName'));
+          var serviceVersionNotes = Em.I18n.t('dashboard.configHistory.table.notes.default').format(service.get('displayName'));
           if (!App.supports.capacitySchedulerUi && service.get('serviceName') === 'MAPREDUCE' && (type === 'capacity-scheduler' || type === 'mapred-queue-acls')) {
             return;
           } else if (type === 'core-site') {

http://git-wip-us.apache.org/repos/asf/ambari/blob/fa7341fe/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 1f34261..43b6026 100644
--- a/ambari-web/app/models/service_config_version.js
+++ b/ambari-web/app/models/service_config_version.js
@@ -23,6 +23,9 @@ var dateUtil = require('utils/date');
 
 App.ServiceConfigVersion = DS.Model.extend({
   serviceName: DS.attr('string'),
+  displayName: function() {
+    return App.format.role(this.get('serviceName'));
+  }.property('serviceName'),
   groupName: DS.attr('string'),
   groupId: DS.attr('string'),
   version: DS.attr('number'),
@@ -33,10 +36,10 @@ App.ServiceConfigVersion = DS.Model.extend({
   index: DS.attr('number'),
   isCurrent: DS.attr('boolean'),
   currentTooltip: function () {
-    return Em.I18n.t('dashboard.configHistory.table.current.tooltip').format(this.get('serviceName'), this.get('configGroupName'));
-  }.property('serviceName', 'configGroupName'),
+    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('serviceName') + ' ' + Em.I18n.t('common.default'));
+    return this.get('groupName') || (this.get('displayName') + ' ' + Em.I18n.t('common.default'));
   }.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/fa7341fe/ambari-web/app/templates/common/configs/config_history_flow.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/config_history_flow.hbs b/ambari-web/app/templates/common/configs/config_history_flow.hbs
index 52846b9..9825fe4 100644
--- a/ambari-web/app/templates/common/configs/config_history_flow.hbs
+++ b/ambari-web/app/templates/common/configs/config_history_flow.hbs
@@ -40,7 +40,7 @@
           </div>
 
           <div class="version-popover">
-            <div class="content"> <strong>{{serviceVersion.serviceName}}</strong> <span class="label label-info">{{serviceVersion.versionText}}</span> &nbsp;
+            <div class="content"> <strong>{{serviceVersion.displayName}}</strong> <span class="label label-info">{{serviceVersion.versionText}}</span> &nbsp;
               <strong>{{t services.service.config.configHistory.configGroup}}:{{serviceVersion.configGroupName}}</strong>
               <div class="notes">{{serviceVersion.briefNotes}}</div>
             </div>
@@ -100,7 +100,7 @@
                                 <div class="pull-right"><i class="icon-caret-right"></i></div>
                             </div>
                             <ul class="dropdown-menu">
-                                <div class="content"> <strong>{{serviceVersion.serviceName}}</strong> <span class="label label-info">{{serviceVersion.versionText}}</span> &nbsp;
+                                <div class="content"> <strong>{{serviceVersion.displayName}}</strong> <span class="label label-info">{{serviceVersion.versionText}}</span> &nbsp;
                                     <strong>{{t services.service.config.configHistory.configGroup}}:{{serviceVersion.configGroupName}}</strong>
                                     <div class="notes">{{serviceVersion.briefNotes}}</div>
                                 </div>
@@ -115,7 +115,7 @@
                     {{#unless view.showFullList}}
                         <li class="align-center pointer" id="show_more">
                             <a {{action openFullList target="view"}}>
-                              {{t dashboard.configHistory.info-bar.showMore}}&nbsp;{{view.serviceName}}
+                              {{t dashboard.configHistory.info-bar.showMore}}&nbsp;{{view.displayName}}
                                 &nbsp;<span class="lowercase ellipsis">{{t dashboard.configHistory.title}}</span>
                             </a>
                         </li>

http://git-wip-us.apache.org/repos/asf/ambari/blob/fa7341fe/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 f0101cc..6c86a24 100644
--- a/ambari-web/app/templates/main/dashboard/config_history.hbs
+++ b/ambari-web/app/templates/main/dashboard/config_history.hbs
@@ -43,7 +43,7 @@
             <td class="first">
               <span class="label label-info">{{item.versionText}}</span>
               <a {{action goToServiceConfigs item.serviceName}}>
-                {{item.serviceName}}
+                {{item.displayName}}
               </a>
               <i {{bindAttr class=":icon-refresh :restart-required-service item.isRestartRequired::hidden"}}
                 rel="Tooltip" {{translateAttr data-original-title="dashboard.configHistory.table.restart.tooltip"}}></i>


[2/2] git commit: AMBARI-7090. Config History: current version should be displayed automatically when switching to another config group.(XIWANG)

Posted by xi...@apache.org.
AMBARI-7090. Config History: current version should be displayed automatically when switching to another config group.(XIWANG)


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

Branch: refs/heads/trunk
Commit: 7dcdeef9b0a8487c92f793b7baa6f52346b1345b
Parents: 72fe79c
Author: Xi Wang <xi...@apache.org>
Authored: Thu Aug 28 15:08:04 2014 -0700
Committer: Xi Wang <xi...@apache.org>
Committed: Fri Aug 29 13:57:15 2014 -0700

----------------------------------------------------------------------
 .../views/common/configs/config_history_flow.js | 85 ++++++++++++++++----
 1 file changed, 68 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7dcdeef9/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 80797f2..adadcc2 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -86,7 +86,8 @@ App.ConfigHistoryFlowView = Em.View.extend({
     return serviceVersions.sort(function (a, b) {
       return Em.get(a, 'createTime') - Em.get(b, 'createTime');
     });
-  }.property('serviceName', 'controller.selectedConfigGroup'),
+  }.property('serviceName', 'controller.selectedConfigGroup.name'),
+
   /**
    * service versions which in viewport and visible to user
    */
@@ -133,28 +134,79 @@ App.ConfigHistoryFlowView = Em.View.extend({
   willInsertElement: function () {
     var serviceVersions = this.get('serviceVersions');
     var startIndex = 0;
+    var currentIndex = 0;
 
     serviceVersions.setEach('isDisplayed', false);
-    //set the correct version to display
-    var allCurrent = serviceVersions.filterProperty('isCurrent');
-    if (this.get('controller.selectedConfigGroup.isDefault')) {
-      // display current in default group
-      allCurrent.findProperty('groupName', null).set('isDisplayed', true);
-    } else {
-      // display current in selected group
-      var current = allCurrent.findProperty('groupName', this.get('controller.selectedConfigGroup.name'));
-      current ? current.set('isDisplayed', true) : allCurrent.findProperty('groupName', null).set('isDisplayed', true);
+    // display current in default group
+    serviceVersions.forEach(function (serviceVersion, index) {
+      // find current in default group
+      if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') == null){
+        serviceVersion.set('isDisplayed', true);
+        currentIndex = index;
+      }
+    });
+
+    // show current version as the last one
+    if (currentIndex + 1 > this.VERSIONS_IN_FLOW) {
+      startIndex = currentIndex + 1 - this.VERSIONS_IN_FLOW;
     }
+    this.set('startIndex', startIndex);
+    this.adjustFlowView();
+    this.keepInfoBarAtTop();
+  },
+
+  onChangeConfigGroup: function () {
+    var serviceVersions = this.get('serviceVersions');
+    var displayedVersionGroupName = this.get('displayedServiceVersion.configGroupName');
+    var selectedGroupName = this.get('controller.selectedConfigGroup.name');
+    var startIndex = 0;
+    var currentIndex = 0;
 
-    if (serviceVersions.length > 0) {
-      if (serviceVersions.length > this.VERSIONS_IN_FLOW) {
-        startIndex = serviceVersions.length - this.VERSIONS_IN_FLOW;
+    // switch to other config group
+    if ( selectedGroupName != displayedVersionGroupName ) {
+      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') == null){
+
+            serviceVersion.set('isDisplayed', true);
+            currentIndex = index;
+          }
+        });
+      }else {
+        // display current in selected group
+        serviceVersions.forEach(function (serviceVersion, index) {
+          // find current in selected group
+          if (serviceVersion.get('isCurrent') && serviceVersion.get('groupName') == selectedGroupName){
+            serviceVersion.set('isDisplayed', true);
+
+            currentIndex = 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') == null){
+              serviceVersion.set('isDisplayed', true);
+
+              currentIndex = index;
+            }
+          });
+        }
+      }
+      // show current version as the last one
+      if (currentIndex + 1 > this.VERSIONS_IN_FLOW) {
+        startIndex = currentIndex + 1 - this.VERSIONS_IN_FLOW;
       }
       this.set('startIndex', startIndex);
       this.adjustFlowView();
+      this.keepInfoBarAtTop();
     }
-    this.keepInfoBarAtTop();
-  },
+  }.observes('controller.selectedConfigGroup.name'),
 
   /**
    * initialize event to keep info bar position at the top of the page
@@ -205,7 +257,7 @@ App.ConfigHistoryFlowView = Em.View.extend({
     });
     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')));
-  }.observes('serviceVersions.length'),
+  },
 
   /**
    * switch configs view version to chosen
@@ -224,7 +276,6 @@ App.ConfigHistoryFlowView = Em.View.extend({
       }
     });
     this.shiftFlowOnSwitch(versionIndex);
-
     this.get('controller').loadSelectedVersion(version);
   },