This is an automated email from the ASF dual-hosted git repository. atkach pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push: new 08092ad AMBARI-23571 Hosts page: Combo filter should use hostname as default filter 08092ad is described below commit 08092add65e0e4fe731bc1ad41be3dfffb5fec08 Author: Andrii Tkach <atk...@apache.org> AuthorDate: Fri Apr 13 12:11:20 2018 +0300 AMBARI-23571 Hosts page: Combo filter should use hostname as default filter --- ambari-web/app/views/main/host/combo_search_box.js | 19 +--------- .../test/views/main/host/combo_search_box_test.js | 44 ---------------------- 2 files changed, 1 insertion(+), 62 deletions(-) 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 a582286..41f0b07 100644 --- a/ambari-web/app/views/main/host/combo_search_box.js +++ b/ambari-web/app/views/main/host/combo_search_box.js @@ -34,6 +34,7 @@ App.MainHostComboSearchBoxView = App.SearchBoxView.extend({ unquotable: [ 'text' ], + remainder: 'Host Name', callbacks: { search: this.search.bind(this), facetMatches: this.facetMatches.bind(this), @@ -48,11 +49,6 @@ App.MainHostComboSearchBoxView = App.SearchBoxView.extend({ * @param searchCollection */ search: function (query, searchCollection) { - this.clearErrMsg(); - var invalidFacet = this.findInvalidFacet(searchCollection); - if (invalidFacet) { - this.showErrMsg(invalidFacet); - } var tableView = this.get('parentView'); App.db.setComboSearchQuery(tableView.get('controller.name'), query); var filterConditions = this.createFilterConditions(searchCollection); @@ -252,19 +248,6 @@ App.MainHostComboSearchBoxView = App.SearchBoxView.extend({ callback(list, {preserveOrder: true}); }, - findInvalidFacet: function(searchCollection) { - var result = null; - var map = App.router.get('mainHostController.labelValueMap'); - for (var i = 0; i < searchCollection.models.length; i++) { - var facet = searchCollection.models[i]; - if (!map[facet.attributes.category]) { - result = facet; - break; - } - } - return result; - }, - getHostComponentList: function() { var hostComponentList = []; App.MasterComponent.find().rejectProperty('totalCount', 0).toArray() 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 a59d845..033236e 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 @@ -100,32 +100,15 @@ describe('App.MainHostComboSearchBoxView', function () { })); sinon.stub(view.get('parentView'), 'updateComboFilter'); sinon.stub(view, 'createFilterConditions').returns([{}]); - sinon.stub(view, 'clearErrMsg'); - sinon.stub(view, 'showErrMsg'); sinon.stub(App.db, 'setComboSearchQuery'); - this.mockFacet = sinon.stub(view, 'findInvalidFacet'); }); afterEach(function() { App.db.setComboSearchQuery.restore(); - view.clearErrMsg.restore(); - view.showErrMsg.restore(); - this.mockFacet.restore(); view.createFilterConditions.restore(); view.get('parentView').updateComboFilter.restore(); }); - it("clearErrMsg should be called", function() { - view.search('query', {}); - expect(view.clearErrMsg.calledOnce).to.be.true; - }); - - it("showErrMsg should be called", function() { - this.mockFacet.returns({}); - view.search('query', {}); - expect(view.showErrMsg.calledWith({})).to.be.true; - }); - it("App.db.setComboSearchQuery should be called", function() { view.search('query', {}); expect(App.db.setComboSearchQuery.calledWith('ctrl1', 'query')).to.be.true; @@ -533,33 +516,6 @@ describe('App.MainHostComboSearchBoxView', function () { }); }); - describe("#findInvalidFacet()", function () { - - beforeEach(function() { - sinon.stub(App.router, 'get').returns({}); - }); - - afterEach(function() { - App.router.get.restore(); - }); - - it("empty searchCollection", function() { - expect(view.findInvalidFacet({models: []})).to.be.null; - }); - - it("searchCollection has values", function() { - expect(view.findInvalidFacet({models: [{ - attributes: { - category: 'cat1' - } - }]})).to.be.eql({ - attributes: { - category: 'cat1' - } - }); - }); - }); - describe("#showErrMsg()", function () { it("errMsg should be set", function() { -- To stop receiving notification emails like this one, please contact atk...@apache.org.