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/19 20:37:01 UTC

[1/2] git commit: AMBARI-6907. Config History: should display new current version after reverting to an old version.(xiwang)

Repository: ambari
Updated Branches:
  refs/heads/trunk 30f8a87a6 -> 933f7f8b2


AMBARI-6907. Config History: should display new current version after reverting to an old version.(xiwang)


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

Branch: refs/heads/trunk
Commit: 933f7f8b26bf2897534ffa67ef257336a08d4c20
Parents: 40dc5b7
Author: Xi Wang <xi...@apache.org>
Authored: Mon Aug 18 17:38:10 2014 -0700
Committer: Xi Wang <xi...@apache.org>
Committed: Tue Aug 19 11:36:34 2014 -0700

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    | 46 +++++++++++++++-----
 ambari-web/app/messages.js                      |  2 +-
 ambari-web/app/models/service_config_version.js |  4 +-
 .../common/configs/config_history_flow.hbs      |  5 +--
 .../views/common/configs/config_history_flow.js | 13 ++----
 .../views/main/dashboard/config_history_view.js |  4 +-
 6 files changed, 43 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/933f7f8b/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 180d352..a856d1e 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -252,9 +252,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
    * get service config versions of current service
    */
   loadServiceConfigVersions: function () {
-    var self = this;
-
-    App.ajax.send({
+    return App.ajax.send({
       name: 'service.serviceConfigVersions.get',
       data: {
         serviceName: this.get('content.serviceName')
@@ -262,9 +260,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
       sender: this,
       success: 'loadServiceConfigVersionsSuccess',
       error: 'loadServiceConfigVersionsError'
-    }).complete(function () {
-        self.loadSelectedVersion();
-      });
+    })
   },
 
   /**
@@ -275,13 +271,39 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
    * @param params
    */
   loadServiceConfigVersionsSuccess: function (data, opt, params) {
-    var currentVersion = Math.max.apply(this, data.items.mapProperty('serviceconfigversion'));
-    var currentVersionObject = data.items.findProperty('serviceconfigversion', currentVersion);
+    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'
+    })
+  },
 
-    this.set('currentVersion', currentVersion);
-    App.cache['currentConfigVersions'] = {};
-    App.cache['currentConfigVersions'][currentVersionObject.service_name + '_' + currentVersionObject.serviceconfigversion] = true;
-    App.serviceConfigVersionsMapper.map(data);
+  /**
+   * load current service config version number
+   * set currentVersion
+   * @param data
+   * @param opt
+   * @param params
+   */
+  loadCurrentVersionsSuccess: function (data, opt, params) {
+    var currentConfigVersions = {};
+    var self = this;
+    for (var service in data.Clusters.desired_serviceconfigversions) {
+      currentConfigVersions[service + '_' + data.Clusters.desired_serviceconfigversions[service].serviceconfigversion] = true;
+      if (self.get('content.serviceName') == service) {
+        self.set('currentVersion', data.Clusters.desired_serviceconfigversions[service].serviceconfigversion);
+      }
+    }
+    App.cache['currentConfigVersions'] = currentConfigVersions;
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/933f7f8b/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 6e118ba..cd25878 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1987,7 +1987,7 @@ Em.I18n.translations = {
   'dashboard.configHistory.title': 'Config History',
   'dashboard.configHistory.table.version.title' : 'Service',
   'dashboard.configHistory.table.configGroup.title' : 'Config Group',
-  'dashboard.configHistory.table.modified.title' : 'Modified',
+  'dashboard.configHistory.table.created.title' : 'Created',
   'dashboard.configHistory.table.empty' : 'No history to display',
   'dashboard.configHistory.table.version.versionText' : 'V{0}',
   'dashboard.configHistory.table.filteredHostsInfo': '{0} of {1} versions showing',

http://git-wip-us.apache.org/repos/asf/ambari/blob/933f7f8b/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 6900492..000ad49 100644
--- a/ambari-web/app/models/service_config_version.js
+++ b/ambari-web/app/models/service_config_version.js
@@ -38,10 +38,10 @@ App.ServiceConfigVersion = DS.Model.extend({
     return Em.I18n.t('dashboard.configHistory.table.version.versionText').format(this.get('version'));
   }.property('version'),
   modifiedDate: function () {
-    return dateUtil.dateFormat(this.get('appliedTime'));
+    return dateUtil.dateFormat(this.get('createTime'));
   }.property('createTime'),
   shortModifiedDate: function () {
-    return dateUtil.dateFormat(this.get('appliedTime'), 'MMM DD, YYYY');
+    return dateUtil.dateFormat(this.get('createTime'), 'MMM DD, YYYY');
   }.property('createTime'),
   /**
    * determine whether ServiceConfigVersion is requested from server

http://git-wip-us.apache.org/repos/asf/ambari/blob/933f7f8b/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 71485f0..a3a39b3 100644
--- a/ambari-web/app/templates/common/configs/config_history_flow.hbs
+++ b/ambari-web/app/templates/common/configs/config_history_flow.hbs
@@ -91,11 +91,8 @@
             <button class="btn" {{action doCancel target="controller"}} {{bindAttr disabled="view.versionActionsDisabled"}}>{{t common.cancel}}</button>
             <button class="btn btn-success" {{action save target="view"}} {{bindAttr disabled="view.isSaveDisabled"}}>{{t common.save}}</button>
           </div>
-          <button class="btn btn-success"  {{action revert view.displayedServiceVersion target="view"}} {{bindAttr disabled="view.versionActionsDisabled" class="view.displayedServiceVersion.isCurrent:hidden"}}>{{t dashboard.configHistory.info-bar.revert.button}}</button>
+          <button class="btn btn-success"  {{action revert target="view"}} {{bindAttr disabled="view.versionActionsDisabled" class="view.displayedServiceVersion.isCurrent:hidden"}}>{{t dashboard.configHistory.info-bar.revert.button}}</button>
         </div>
     </div>
-    <div class="label-wrapper">
-      {{view.shortNotes}} {{#if view.showMoreLink}}<a class="pointer" {{bindAttr title="view.displayedServiceVersion.notes"}}>{{t jobs.hive.more}}</a>{{/if}}
-    </div>
   </div>
 </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/933f7f8b/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 1dcb0e0..892c778 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -231,16 +231,9 @@ App.ConfigHistoryFlowView = Em.View.extend({
   },
 
   sendRevertCallSuccess: function (data, opt, params) {
-    var version = params.data.Clusters.desired_serviceconfigversions.serviceconfigversion;
-
-    this.get('serviceVersions').forEach(function (serviceVersion) {
-      serviceVersion.set('isCurrent', serviceVersion.get('version') === version);
-    });
-    this.set('controller.currentVersion', version);
-
-    this.switchVersion({context: Em.Object.create({
-      version: version
-    })});
+    // revert to an old version would generate a new version with latest version number,
+    // so, need to loadStep to update
+     this.get('controller').loadStep();
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/933f7f8b/ambari-web/app/views/main/dashboard/config_history_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/config_history_view.js b/ambari-web/app/views/main/dashboard/config_history_view.js
index d45ed9e..cf395ba 100644
--- a/ambari-web/app/views/main/dashboard/config_history_view.js
+++ b/ambari-web/app/views/main/dashboard/config_history_view.js
@@ -100,9 +100,9 @@ App.MainConfigHistoryView = App.TableView.extend({
   }),
   modifiedSort: sort.fieldView.extend({
     column: 3,
-    name: 'appliedTime',
+    name: 'createTime',
     status: 'sorting_desc',
-    displayName: Em.I18n.t('dashboard.configHistory.table.modified.title')
+    displayName: Em.I18n.t('dashboard.configHistory.table.created.title')
   }),
   authorSort: sort.fieldView.extend({
     column: 4,


[2/2] git commit: AMBARI-6898. Config History: the version history box are in wrong sorting sequence sometimes.(xiwang)

Posted by xi...@apache.org.
AMBARI-6898. Config History: the version history box are in wrong sorting sequence sometimes.(xiwang)


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

Branch: refs/heads/trunk
Commit: 40dc5b75ee63358765d52a60d5751c6152100704
Parents: 30f8a87
Author: Xi Wang <xi...@apache.org>
Authored: Mon Aug 18 11:15:16 2014 -0700
Committer: Xi Wang <xi...@apache.org>
Committed: Tue Aug 19 11:36:34 2014 -0700

----------------------------------------------------------------------
 ambari-web/app/views/common/configs/config_history_flow.js | 5 ++++-
 ambari-web/app/views/main/dashboard/config_history_view.js | 1 -
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/40dc5b75/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 5f7bfad..1dcb0e0 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -281,7 +281,10 @@ App.ConfigHistoryFlowView = Em.View.extend({
     });
   },
   serviceVersions: function () {
-    return App.ServiceConfigVersion.find().filterProperty('serviceName', this.get('serviceName'));
+    var allServiceVersions = App.ServiceConfigVersion.find().filterProperty('serviceName', this.get('serviceName'));
+    return allServiceVersions.sort(function (a, b) {
+      return Em.get(a, 'createTime') - Em.get(b, 'createTime');
+    });
   }.property('serviceName'),
   /**
    * move back to the previous service version

http://git-wip-us.apache.org/repos/asf/ambari/blob/40dc5b75/ambari-web/app/views/main/dashboard/config_history_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/config_history_view.js b/ambari-web/app/views/main/dashboard/config_history_view.js
index 5f9a943..d45ed9e 100644
--- a/ambari-web/app/views/main/dashboard/config_history_view.js
+++ b/ambari-web/app/views/main/dashboard/config_history_view.js
@@ -139,7 +139,6 @@ App.MainConfigHistoryView = App.TableView.extend({
     emptyValue: Em.I18n.t('common.all')
   }),
 
-
   modifiedFilterView: filters.createSelectView({
     column: 3,
     fieldType: 'filter-input-width',