Repository: ambari
Updated Branches:
  refs/heads/branch-1.7.0 0856dda00 -> 00cde11f4


AMBARI-8196. Config History: service/group filtered results should be 
internally sorted by version.(xiwang)


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

Branch: refs/heads/branch-1.7.0
Commit: 00cde11f478911469702e127bd68ab98e69de234
Parents: 0856dda
Author: Xi Wang <xiw...@apache.org>
Authored: Thu Nov 6 18:21:33 2014 -0800
Committer: Xi Wang <xiw...@apache.org>
Committed: Fri Nov 7 12:51:25 2014 -0800

----------------------------------------------------------------------
 .../main/dashboard/config_history_controller.js | 29 ++++++++++++++++++++
 .../app/mixins/common/table_server_mixin.js     |  2 --
 2 files changed, 29 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/00cde11f/ambari-web/app/controllers/main/dashboard/config_history_controller.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/controllers/main/dashboard/config_history_controller.js 
b/ambari-web/app/controllers/main/dashboard/config_history_controller.js
index 4faff54..520fe3e 100644
--- a/ambari-web/app/controllers/main/dashboard/config_history_controller.js
+++ b/ambari-web/app/controllers/main/dashboard/config_history_controller.js
@@ -218,5 +218,34 @@ App.MainConfigHistoryController = 
Em.ArrayController.extend(App.TableServerMixin
         })
       }
     }, App.componentsUpdateInterval));
+  },
+
+  /**
+   * get sort properties from local db. A overridden funtion from parent
+   * @return {Array}
+   */
+  getSortProps: function () {
+    var savedSortConditions = App.db.getSortingStatuses(this.get('name')) || 
[],
+      sortProperties = this.get('sortProps'),
+      sortParams = [];
+
+    savedSortConditions.forEach(function (sort) {
+      var property = sortProperties.findProperty('name', sort.name);
+      if (property && (sort.status === 'sorting_asc' || sort.status === 
'sorting_desc')) {
+        property.value = sort.status.replace('sorting_', '');
+        property.type = 'SORT';
+        if (property.name == 'serviceVersion'){
+          property.key = "service_name." + sort.status.replace('sorting_', '') 
+ ",service_config_version";
+          property.value = "desc";
+        }
+        if (property.name == 'configGroup'){
+          property.key = "group_name." + sort.status.replace('sorting_', '') + 
",service_config_version";
+          property.value = "desc";
+        }
+
+        sortParams.push(property);
+      }
+    });
+    return sortParams;
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/00cde11f/ambari-web/app/mixins/common/table_server_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/table_server_mixin.js 
b/ambari-web/app/mixins/common/table_server_mixin.js
index 33357ea..c0610b0 100644
--- a/ambari-web/app/mixins/common/table_server_mixin.js
+++ b/ambari-web/app/mixins/common/table_server_mixin.js
@@ -78,10 +78,8 @@ App.TableServerMixin = Em.Mixin.create({
     var savedSortConditions = App.db.getSortingStatuses(this.get('name')) || 
[],
       sortProperties = this.get('sortProps'),
       sortParams = [];
-
     savedSortConditions.forEach(function (sort) {
       var property = sortProperties.findProperty('name', sort.name);
-
       if (property && (sort.status === 'sorting_asc' || sort.status === 
'sorting_desc')) {
         property.value = sort.status.replace('sorting_', '');
         property.type = 'SORT';

Reply via email to