ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rz...@apache.org
Subject ambari git commit: AMBARI-13235. Incorrect Hosts table filtering after navigating back from Host Summary (rzang)
Date Fri, 25 Sep 2015 00:45:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1.2 ac6a2555a -> 8b405fae8


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/8b405fae
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8b405fae
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8b405fae

Branch: refs/heads/branch-2.1.2
Commit: 8b405fae8cf6c9c329bc4b309770485f7206d53b
Parents: ac6a255
Author: Richard Zang <rzang@apache.org>
Authored: Thu Sep 24 17:41:31 2015 -0700
Committer: Richard Zang <rzang@apache.org>
Committed: Thu Sep 24 17:44:39 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/8b405fae/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/8b405fae/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'));
+    }
   },
 
   /**


Mime
View raw message