ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiw...@apache.org
Subject git commit: AMBARI-6456. Browsing to Hosts page doesn't show default sort order.(xiwang)
Date Fri, 11 Jul 2014 20:31:22 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e8c7e6ba0 -> 959c0d0fe


AMBARI-6456. Browsing to Hosts page doesn't show default sort order.(xiwang)


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

Branch: refs/heads/trunk
Commit: 959c0d0fe6323bdffd7ed8cc34ddff278daf0cb8
Parents: e8c7e6b
Author: Xi Wang <xiwang@apache.org>
Authored: Thu Jul 10 10:25:51 2014 -0700
Committer: Xi Wang <xiwang@apache.org>
Committed: Fri Jul 11 13:30:28 2014 -0700

----------------------------------------------------------------------
 ambari-web/app/views/common/sort_view.js | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/959c0d0f/ambari-web/app/views/common/sort_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/sort_view.js b/ambari-web/app/views/common/sort_view.js
index 79ea140..1fb2cf0 100644
--- a/ambari-web/app/views/common/sort_view.js
+++ b/ambari-web/app/views/common/sort_view.js
@@ -193,10 +193,9 @@ var serverWrapperView = Em.View.extend({
 
   loadSortStatuses: function () {
     var statuses = App.db.getSortingStatuses(this.get('controller.name'));
-
+    var childViews = this.get('childViews');
+    var self = this;
     if (statuses) {
-      var childViews = this.get('childViews');
-      var self = this;
       statuses.forEach(function (st) {
         if (st.status !== 'sorting') {
           self.get('childViews').findProperty('name', childViews.findProperty('name', st.name).get('name')).set('status',
st.status);
@@ -206,6 +205,19 @@ var serverWrapperView = Em.View.extend({
           childViews.findProperty('name', st.name).set('status', st.status);
         }
       });
+    } else {
+      // setup and save initial sort statuses when first login : publicHostName sorting_asc,
used only once
+      var statuses = [];
+      childViews.forEach(function (childView) {
+        var sortStatus = (childView.get('name') == 'publicHostName' && childView.get('status')
== 'sorting') ? 'sorting_asc' : childView.get('status');
+        statuses.push({
+          name: childView.get('name'),
+          status: sortStatus
+        });
+        childView.set('status', sortStatus);
+      });
+      App.db.setSortingStatuses(self.get('controller.name'), statuses);
+      self.get('controller').set('sortingColumn', childViews.findProperty('name', 'publicHostName'));
     }
   },
 


Mime
View raw message