ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-6308 API: filtering by hostname does not work properly. (Buzhor Denys via atkach)
Date Fri, 27 Jun 2014 15:57:17 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 f94893d72 -> b8383779a


AMBARI-6308 API: filtering by hostname does not work properly. (Buzhor Denys via atkach)


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

Branch: refs/heads/branch-1.6.1
Commit: b8383779aca49c504d5c3e758c55c921e8a77a88
Parents: f94893d
Author: atkach <atkach@hortonworks.com>
Authored: Fri Jun 27 18:54:50 2014 +0300
Committer: atkach <atkach@hortonworks.com>
Committed: Fri Jun 27 18:54:50 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host.js | 20 +++++++++++++++++++-
 ambari-web/app/views/main/host.js       |  8 +++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b8383779/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 2a8511c..4d44085 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -28,6 +28,7 @@ App.MainHostController = Em.ArrayController.extend({
   clearFilters: null,
 
   filteredCount: 0,
+  resetStartIndex: false,
   /**
    * flag responsible for updating status counters of hosts
    */
@@ -226,7 +227,9 @@ App.MainHostController = Em.ArrayController.extend({
     var colPropAssoc = this.get('colPropAssoc');
     var filterProperties = this.get('filterProperties');
     var sortProperties = this.get('sortProps');
+    var oldProperties = App.router.get('updateController.queryParams.Hosts');
 
+    this.set('resetStartIndex', false);
     this.get('viewProperties').forEach(function (property) {
       queryParams.push({
         key: property.get('alias'),
@@ -240,7 +243,8 @@ App.MainHostController = Em.ArrayController.extend({
         var result = {
           key: property.alias,
           value: filter.value,
-          type: property.type
+          type: property.type,
+          isFilter: true
         };
         if (filter.type === 'string' && sortProperties.someProperty('key', colPropAssoc[filter.iColumn]))
{
           result.value = this.getRegExp(filter.value);
@@ -257,6 +261,20 @@ App.MainHostController = Em.ArrayController.extend({
         }
       }
     }, this);
+
+    if (queryParams.filterProperty('isFilter').length !== oldProperties.filterProperty('isFilter').length)
{
+      queryParams.findProperty('key', 'from').value = 0;
+      this.set('resetStartIndex', true);
+    } else {
+      queryParams.filterProperty('isFilter').forEach(function (queryParam) {
+        var oldProperty = oldProperties.filterProperty('isFilter').findProperty('key', queryParam.key);
+        if (!oldProperty || JSON.stringify(oldProperty.value) !== JSON.stringify(queryParam.value))
{
+          queryParams.findProperty('key', 'from').value = 0;
+          this.set('resetStartIndex', true);
+        }
+      }, this);
+    }
+
     savedSortConditions.forEach(function (sort) {
       var property = sortProperties.findProperty('key', sort.name);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b8383779/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 78ed0cf..7ee377f 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -849,5 +849,11 @@ App.MainHostView = App.TableView.extend(App.TableServerProvider, {
    */
   colPropAssoc: function () {
     return this.get('controller.colPropAssoc');
-  }.property('controller.colPropAssoc')
+  }.property('controller.colPropAssoc'),
+
+  resetStartIndex: function () {
+    if (this.get('controller.resetStartIndex')) {
+      this.set('startIndex', 1);
+    }
+  }.observes('controller.resetStartIndex')
 });


Mime
View raw message