Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4418C113E7 for ; Fri, 11 Jul 2014 20:31:23 +0000 (UTC) Received: (qmail 43019 invoked by uid 500); 11 Jul 2014 20:31:23 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 42990 invoked by uid 500); 11 Jul 2014 20:31:23 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 42981 invoked by uid 99); 11 Jul 2014 20:31:23 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2014 20:31:23 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E598383CD22; Fri, 11 Jul 2014 20:31:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: xiwang@apache.org To: commits@ambari.apache.org Message-Id: <315b4148811b4b4383cc65e368d6a8c8@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: AMBARI-6456. Browsing to Hosts page doesn't show default sort order.(xiwang) Date: Fri, 11 Jul 2014 20:31:22 +0000 (UTC) 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 Authored: Thu Jul 10 10:25:51 2014 -0700 Committer: Xi Wang 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')); } },