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/22 22:26:19 UTC

ambari git commit: AMBARI-15504. Host filter: minor UX edits (rzang)

Repository: ambari
Updated Branches:
  refs/heads/trunk 0f8c24956 -> 127dcf94b


AMBARI-15504. Host filter: minor UX edits (rzang)


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

Branch: refs/heads/trunk
Commit: 127dcf94b3e02ca17c2e2b5fe4bbc13689e7a772
Parents: 0f8c249
Author: Richard Zang <rz...@apache.org>
Authored: Tue Mar 22 14:25:42 2016 -0700
Committer: Richard Zang <rz...@apache.org>
Committed: Tue Mar 22 14:25:42 2016 -0700

----------------------------------------------------------------------
 ambari-web/app/messages.js                              |  2 +-
 ambari-web/app/styles/application.less                  |  5 +++++
 ambari-web/app/templates/main/host/combo_search_box.hbs |  1 -
 ambari-web/app/views/main/host/combo_search_box.js      | 12 ++++++++++++
 .../test/views/main/host/combo_search_box_test.js       |  1 +
 5 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/127dcf94/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 52e3b8e..433834c 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2460,7 +2460,7 @@ Em.I18n.translations = {
   'hosts.passiveMode.popup':'Are you sure you want to <b>Turn {0} Maintenance Mode</b> for {1}?',
   'hosts.passiveMode.popup.version.mismatch': '{0} has components from a stack which is not current. Before bringing this host out of maintenance mode, it is recommended that you upgrade its components to {1}',
   'hosts.passiveMode.popup.version.mismatch.multiple': 'Some hosts have components from a stack which is not current. Before bringing these hosts out of maintenance mode, it is recommended that you upgrade their components to {0}',
-
+  'hosts.combo.search.placebolder': 'Filter by host and component attributes or search by keyword ...',
   'charts.horizon.chart.showText':'show',
   'charts.horizon.chart.hideText':'hide',
   'charts.horizon.chart.attributes.cpu':'CPU',

http://git-wip-us.apache.org/repos/asf/ambari/blob/127dcf94/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 7bf94e2..afca23f 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -6195,3 +6195,8 @@ input[type="radio"].align-checkbox, input[type="checkbox"].align-checkbox {
 .enable-all-link {
   margin-left: -10px;
 }
+
+#combo_search_box .VS-search-box {
+  border-radius: 4px;
+  box-shadow: 0 0 1px #fff inset;
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/127dcf94/ambari-web/app/templates/main/host/combo_search_box.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/combo_search_box.hbs b/ambari-web/app/templates/main/host/combo_search_box.hbs
index ea6e2b4..6ff9640 100644
--- a/ambari-web/app/templates/main/host/combo_search_box.hbs
+++ b/ambari-web/app/templates/main/host/combo_search_box.hbs
@@ -18,5 +18,4 @@
 {{#if App.supports.hostComboSearchBox}}
 <br/>
 <div id="combo_search_box"></div>
-<div id="search_query">&nbsp;</div>
 {{/if}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/127dcf94/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 2f86485..9cc1023 100644
--- a/ambari-web/app/views/main/host/combo_search_box.js
+++ b/ambari-web/app/views/main/host/combo_search_box.js
@@ -23,6 +23,15 @@ App.MainHostComboSearchBoxView = Em.View.extend({
   didInsertElement: function () {
     this.initVS();
     this.restoreComboFilterQuery();
+    this.showHideClearButton();
+  },
+
+  showHideClearButton: function() {
+    if(visualSearch.searchQuery.toJSON().length > 0) {
+      $('.VS-cancel-search-box').removeClass('hide');
+    } else {
+      $('.VS-cancel-search-box').addClass('hide');
+    }
   },
 
   restoreComboFilterQuery: function() {
@@ -68,6 +77,7 @@ App.MainHostComboSearchBoxView = Em.View.extend({
       query: '',
       showFacets: true,
       delay: 1000,
+      placeholder: Em.I18n.t('hosts.combo.search.placebolder'),
       unquotable: [
         'text'
       ],
@@ -79,6 +89,7 @@ App.MainHostComboSearchBoxView = Em.View.extend({
         },
 
         facetMatches: function (callback) {
+          self.showHideClearButton();
           var list = [
             {label: 'Host Name', category: 'Host'},
             {label: 'IP', category: 'Host'},
@@ -113,6 +124,7 @@ App.MainHostComboSearchBoxView = Em.View.extend({
         },
 
         valueMatches: function (facet, searchTerm, callback) {
+          self.showHideClearButton();
           var map = App.router.get('mainHostController.labelValueMap');
           var facetValue = map[facet] || facet;
           if (controller.isComponentStateFacet(facetValue)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/127dcf94/ambari-web/test/views/main/host/combo_search_box_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/combo_search_box_test.js b/ambari-web/test/views/main/host/combo_search_box_test.js
index 9c2e7b6..f6ff040 100644
--- a/ambari-web/test/views/main/host/combo_search_box_test.js
+++ b/ambari-web/test/views/main/host/combo_search_box_test.js
@@ -29,6 +29,7 @@ describe('App.MainHostComboSearchBoxView', function () {
 
     beforeEach(function() {
       sinon.stub(view, 'initVS');
+      sinon.stub(view, 'showHideClearButton');
     });
     afterEach(function() {
       view.initVS.restore();