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 2016/03/03 22:43:34 UTC

ambari git commit: AMBARI-15276. Combo Search: Create filter for service page and version page jump links (rzang)

Repository: ambari
Updated Branches:
  refs/heads/trunk ec94842e2 -> f1c2b3da0


AMBARI-15276. Combo Search: Create filter for service page and version page jump links (rzang)


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

Branch: refs/heads/trunk
Commit: f1c2b3da0248ea706fd9d7ccff9300b1689f7aa4
Parents: ec94842
Author: Richard Zang <rz...@apache.org>
Authored: Thu Mar 3 13:31:19 2016 -0800
Committer: Richard Zang <rz...@apache.org>
Committed: Thu Mar 3 13:42:00 2016 -0800

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host.js         | 31 ++++++++++----------
 ambari-web/app/views/common/table_view.js       |  2 ++
 .../app/views/main/host/combo_search_box.js     |  2 +-
 ambari-web/test/controllers/main/host_test.js   | 23 +++++++--------
 4 files changed, 29 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c2b3da/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 bfed1ba..27f0b41 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -497,6 +497,7 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
     if (!component) return;
     var id = component.get('componentName');
     var column = 6;
+    var colPropAssoc = this.get('colPropAssoc');
 
     var filterForComponent = {
       iColumn: column,
@@ -504,6 +505,7 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
       type: 'multiple'
     };
     App.db.setFilterConditions(this.get('name'), [filterForComponent]);
+    App.db.setComboSearchQuery(this.get('name'), colPropAssoc[column] + ': ' + '"' + id + '"');
   },
 
   /**
@@ -513,23 +515,22 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
    */
   filterByStack: function (displayName, state) {
     if (!displayName || !state) return;
-    var column = 11;
+    var colPropAssoc = this.get('colPropAssoc');
 
-    var filterForStack = {
-      iColumn: column,
-      value: [
-        {
-          property: 'repository_versions/RepositoryVersions/display_name',
-          value: displayName
-        },
-        {
-          property: 'HostStackVersions/state',
-          value: state.toUpperCase()
-        }
-      ],
-      type: 'sub-resource'
+    var versionFilter = {
+      iColumn: 16,
+      value: displayName,
+      type: 'string'
+    };
+    var stateFilter = {
+      iColumn: 17,
+      value: state.toUpperCase(),
+      type: 'string'
     };
-    App.db.setFilterConditions(this.get('name'), [filterForStack]);
+    var versionFilterStr = colPropAssoc[versionFilter.iColumn] + ': ' + '"' + versionFilter.value + '"';
+    var stateFilterStr = colPropAssoc[stateFilter.iColumn] + ': ' + '"' + stateFilter.value + '"';
+    App.db.setFilterConditions(this.get('name'), [versionFilter, stateFilter]);
+    App.db.setComboSearchQuery(this.get('name'), [versionFilterStr, stateFilterStr].join(' '));
   },
 
   goToHostAlerts: function (event) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c2b3da/ambari-web/app/views/common/table_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/table_view.js b/ambari-web/app/views/common/table_view.js
index 24689cd..acd6bac 100644
--- a/ambari-web/app/views/common/table_view.js
+++ b/ambari-web/app/views/common/table_view.js
@@ -127,6 +127,8 @@ App.TableView = Em.View.extend(App.UserPref, {
               self.set('tableFilteringComplete', true);
             }
           });
+        } else {
+          self.set('tableFilteringComplete', true);
         }
       });
     } else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c2b3da/ambari-web/app/views/main/host/combo_search_box.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/combo_search_box.js b/ambari-web/app/views/main/host/combo_search_box.js
index 7305fc8..53650ee 100644
--- a/ambari-web/app/views/main/host/combo_search_box.js
+++ b/ambari-web/app/views/main/host/combo_search_box.js
@@ -55,9 +55,9 @@ App.MainHostComboSearchBoxView = Em.View.extend({
             {label: 'Host Name', value: 'hostName', category: 'Host'},
             {label: 'IP', value: 'ip', category: 'Host'},
             {label: 'Heath Status', value: 'healthClass', category: 'Host'},
-            {label: 'Stack Version', value: 'version', category: 'Host'},
             {label: 'Cores', value: 'cpu', category: 'Host'},
             {label: 'RAM', value: 'memoryFormatted', category: 'Host'},
+            {label: 'Stack Version', value: 'version', category: 'Host'},
             {label: 'Version State', value: 'versionState', category: 'Host'},
             {label: 'Rack', value: 'rack', category: 'Host'},
             {label: 'Service', value: 'services', category: 'Service'},

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c2b3da/ambari-web/test/controllers/main/host_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host_test.js b/ambari-web/test/controllers/main/host_test.js
index fce3c2c..06a4813 100644
--- a/ambari-web/test/controllers/main/host_test.js
+++ b/ambari-web/test/controllers/main/host_test.js
@@ -399,19 +399,16 @@ describe('MainHostController', function () {
     it("stack and displayName exist", function() {
       hostController.set('name', 'ctrl1');
       hostController.filterByStack('stack1', 'INSTALLED');
-      expect(App.db.setFilterConditions.calledWith('ctrl1', [{
-        iColumn: 11,
-        value: [
-          {
-            property: 'repository_versions/RepositoryVersions/display_name',
-            value: 'stack1'
-          },
-          {
-            property: 'HostStackVersions/state',
-            value: 'INSTALLED'
-          }
-        ],
-        type: 'sub-resource'
+      expect(App.db.setFilterConditions.calledWith('ctrl1', [
+      {
+        iColumn: 16,
+        value: 'stack1',
+        type: 'string'
+      },
+      {
+        iColumn: 17,
+        value: 'INSTALLED',
+        type: 'string'
       }])).to.be.true;
     });
   });