incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject git commit: AMBARI-3295. Clear host filters when landing on hosts page. (onechiporenko)
Date Fri, 20 Sep 2013 13:03:50 GMT
Updated Branches:
  refs/heads/trunk dd3fc740a -> c54753b7d


AMBARI-3295. Clear host filters when landing on hosts page. (onechiporenko)


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

Branch: refs/heads/trunk
Commit: c54753b7d074e4cf11782526942f3bff3f1465f7
Parents: dd3fc74
Author: Oleg Nechiporenko <cv_github@yahoo.com>
Authored: Fri Sep 20 15:25:02 2013 +0300
Committer: Oleg Nechiporenko <cv_github@yahoo.com>
Committed: Fri Sep 20 16:03:41 2013 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host.js |  2 ++
 ambari-web/app/routes/main.js           |  4 ++++
 ambari-web/app/views/main/host.js       | 16 ++++++++++++++++
 3 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c54753b7/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js
index 240930f..9215cf0 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -24,6 +24,8 @@ App.MainHostController = Em.ArrayController.extend({
   name:'mainHostController',
   content: App.Host.find(),
 
+  clearFilters: null,
+
   alerts: function () {
     return App.router.get('clusterController.alerts').filterProperty('isOk', false).filterProperty('ignoredForHosts',
false);
   }.property('App.router.clusterController.alerts.length'),

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c54753b7/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index a978260..138ee42 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -474,6 +474,8 @@ module.exports = Em.Route.extend({
     index: Ember.Route.extend({
       route: '/',
       connectOutlets: function (router, context) {
+        router.set('mainHostController.clearFilters', !router.get('mainHostController.comeWithFilter'));
+        router.set('mainHostController.comeWithFilter', false);
         router.get('mainController').connectOutlet('mainHost');
       }
     }),
@@ -526,6 +528,7 @@ module.exports = Em.Route.extend({
     }),
 
     back: function (router, event) {
+      router.get('mainHostController').set('comeWithFilter', true);
       window.history.back();
     },
 
@@ -993,6 +996,7 @@ module.exports = Em.Route.extend({
     router.transitionTo('hosts.hostDetails.index', event.context);
   },
   filterHosts: function (router, component) {
+    router.get('mainHostController').set('comeWithFilter', true);
     router.get('mainHostController').filterByComponent(component.context);
     router.transitionTo('hosts.index');
   }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c54753b7/ambari-web/app/views/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host.js b/ambari-web/app/views/main/host.js
index 175ab2b..38cf684 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -31,6 +31,22 @@ App.MainHostView = App.TableView.extend({
     this._super();
   },
 
+  clearFiltersObs: function() {
+    var self = this;
+    Em.run.next(function() {
+      if (self.get('controller.clearFilters')) {
+        self.clearFilters();
+        self.clearDisplayLength();
+        self.clearStartIndex();
+      }
+    });
+  },
+
+  didInsertElement: function() {
+    this.addObserver('controller.clearFilters', this, this.clearFiltersObs);
+    this.clearFiltersObs();
+  },
+
   sortView: sort.wrapperView,
   nameSort: sort.fieldView.extend({
     name:'publicHostName',


Mime
View raw message