You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rz...@apache.org on 2015/09/25 02:44:19 UTC

ambari git commit: AMBARI-13235. Incorrect Hosts table filtering after navigating back from Host Summary (rzang)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 3815ed073 -> d2b779f1d


AMBARI-13235. Incorrect Hosts table filtering after navigating back from Host Summary (rzang)


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

Branch: refs/heads/branch-2.1
Commit: d2b779f1d17866382f1a93dc3961059114a24cdb
Parents: 3815ed0
Author: Richard Zang <rz...@apache.org>
Authored: Thu Sep 24 17:41:31 2015 -0700
Committer: Richard Zang <rz...@apache.org>
Committed: Thu Sep 24 17:43:30 2015 -0700

----------------------------------------------------------------------
 ambari-web/app/mappers/hosts_mapper.js   |  5 ++++-
 ambari-web/app/views/common/sort_view.js | 30 ++++++++++++++++++---------
 2 files changed, 24 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d2b779f1/ambari-web/app/mappers/hosts_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/hosts_mapper.js b/ambari-web/app/mappers/hosts_mapper.js
index ed9ef26..53f536c 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -153,7 +153,10 @@ App.hostsMapper = App.QuickDataMapper.create({
         var alertsSummary = item.alerts_summary;
         item.critical_warning_alerts_count = alertsSummary ? (alertsSummary.CRITICAL || 0) + (alertsSummary.WARNING || 0) : 0;
         item.cluster_id = clusterName;
-        item.index = index;
+        var existingHost = App.Host.find().findProperty('hostName', component.host_name);
+        var fromHostDetail = App.router.get('currentState.parentState.name') == 'hostDetails';
+        // There is no need to override existing index in host detail view since old model(already have indexes) will not be cleared.
+        item.index = (existingHost && fromHostDetail)? existingHost.get('index'): index;
 
         if (stackUpgradeSupport) {
           this.config = $.extend(this.config, {

http://git-wip-us.apache.org/repos/asf/ambari/blob/d2b779f1/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 7ed4c72..ff46b55 100644
--- a/ambari-web/app/views/common/sort_view.js
+++ b/ambari-web/app/views/common/sort_view.js
@@ -203,18 +203,28 @@ var serverWrapperView = Em.View.extend({
    * Initialize and save sorting statuses: hostName sorting_asc
    */
   loadSortStatuses: function () {
-    var statuses = [];
     var childViews = this.get('childViews');
-    childViews.forEach(function (childView) {
-      var sortStatus = (childView.get('name') == 'hostName' && childView.get('status') == 'sorting') ? 'sorting_asc' : childView.get('status');
-      statuses.push({
-        name: childView.get('name'),
-        status: sortStatus
+    var statuses = App.db.getSortingStatuses(this.get('controller.name'));
+    if (statuses) {
+      var sortingColumn = App.db.getSortingStatuses(this.get('controller.name')).find(function(column){ return column.status != 'sorting'})
+      if (sortingColumn) {
+        var sortingColumnView = childViews.findProperty('name', sortingColumn.name);
+        sortingColumnView.set('status', sortingColumn.status);
+        this.get('controller').set('sortingColumn', sortingColumnView);
+      }
+    } else {
+      statuses = [];
+      childViews.forEach(function (childView) {
+        var sortStatus = (childView.get('name') == 'hostName' && childView.get('status') == 'sorting') ? 'sorting_asc' : childView.get('status');
+        statuses.push({
+          name: childView.get('name'),
+          status: sortStatus
+        });
+        childView.set('status', sortStatus);
       });
-      childView.set('status', sortStatus);
-    });
-    App.db.setSortingStatuses(this.get('controller.name'), statuses);
-    this.get('controller').set('sortingColumn', childViews.findProperty('name', 'hostName'));
+      App.db.setSortingStatuses(this.get('controller.name'), statuses);
+      this.get('controller').set('sortingColumn', childViews.findProperty('name', 'hostName'));
+    }
   },
 
   /**