Selaa lähdekoodia

AMBARI-15362 Combo Search: use component models instead of host component model to populate dropdown list (Joe Wang via rzang)

Richard Zang 9 vuotta sitten
vanhempi
commit
335ddb1fda

+ 0 - 4
ambari-web/app/controllers/main/host/combo_search_box.js

@@ -56,10 +56,6 @@ App.MainHostComboSearchBoxController = Em.Controller.extend({
     return App.HostComponent.find().filterProperty('componentName', facet).length > 0;
   },
 
-  isClientComponent: function(name) {
-    return name.indexOf('CLIENT') >= 0;
-  },
-
   generateQueryParam: function(param) {
     var expressions = param.key;
     var pHash = this.createComboParamHash(param);

+ 0 - 73
ambari-web/app/templates/main/host/component_filter.hbs

@@ -1,73 +0,0 @@
-{{!
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-}}
-
-<button class="btn single-btn-group filter-btn" id="host-components-filter-button" {{action "clickFilterButton" target="view"}}>{{t common.filter}} <i class="icon-filter"></i></button>
-    <ul class="dropdown-menu filter-components">
-      <li id="title-bar">{{t hosts.filters.filterComponents}}
-        <a class="close" {{action "closeFilter" target="view"}}>X</a>
-      </li>
-      <li id="list-area">
-        <ul>
-          <li>
-            <label class="checkbox">
-            {{view Ember.Checkbox checkedBinding="view.masterComponentsChecked"}} {{t host.host.componentFilter.master}}:
-            </label>
-            <ul>
-            {{#each component in view.masterComponents}}
-              <li>
-                <label class="checkbox">
-                {{view Ember.Checkbox checkedBinding="component.checkedForHostFilter" }} {{unbound component.displayName}}
-                </label>
-              </li>
-            {{/each}}
-            </ul>
-          </li>
-          <li>
-            <label class="checkbox">
-            {{view Ember.Checkbox checkedBinding="view.slaveComponentsChecked"}} {{t host.host.componentFilter.slave}}:
-            </label>
-            <ul>
-            {{#each component in view.slaveComponents}}
-              <li>
-                <label class="checkbox">
-                {{view Ember.Checkbox checkedBinding="component.checkedForHostFilter" }} {{unbound component.displayName}}
-                </label>
-              </li>
-            {{/each}}
-            </ul>
-          </li>
-          <li>
-            <label class="checkbox">
-            {{view Ember.Checkbox checkedBinding="view.clientComponentsChecked"}} {{t host.host.componentFilter.client}}:
-            </label>
-            <ul>
-            {{#each component in view.clientComponents}}
-              <li>
-              <label class="checkbox">
-              {{view Ember.Checkbox checkedBinding="component.checkedForHostFilter" }} {{unbound component.displayName}}
-              </label>
-              </li>
-            {{/each}}
-            </ul>
-          </li>
-        </ul>
-      </li>
-      <li id="button-bar">
-        <button class="btn btn-inverse" {{action "applyFilter" target="view"}}>{{t common.apply}}</button>
-      </li>
-    </ul>

+ 0 - 30
ambari-web/app/templates/main/host/version_filter.hbs

@@ -1,30 +0,0 @@
-{{!
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-}}
-
-
-<button class="btn single-btn-group filter-btn" id="host-version-filter-button" {{action "clickFilterButton" target="view"}}>
-  {{t common.filter}}
-  <i class="icon-filter"></i>
-</button>
-<ul class="dropdown-menu filter-components">
-  <li>{{view view.versionSelectView}}</li>
-  <li>{{view view.statusSelectView}}</li>
-  <li id="button-bar">
-    <button class="btn btn-inverse" {{action "applyFilter" target="view"}}>{{t common.apply}}</button>
-  </li>
-</ul>

+ 6 - 6
ambari-web/app/views/main/host/combo_search_box.js

@@ -33,14 +33,14 @@ App.MainHostComboSearchBoxView = Em.View.extend({
   },
 
   getHostComponentList: function() {
-    var controller = App.router.get('mainHostComboSearchBoxController');
     var hostComponentList = [];
-    App.HostComponent.find().toArray().forEach(function(component) {
+    App.MasterComponent.find().rejectProperty('totalCount', 0).toArray()
+        .concat(App.SlaveComponent.find().rejectProperty('totalCount', 0).toArray())
+        .forEach(function(component) {
       var displayName = component.get('displayName');
-      var name = component.get('componentName');
-      if (displayName != null && !controller.isClientComponent(name)) {
+      if (displayName) {
         hostComponentList.push({label: displayName, category: 'Component'});
-        App.router.get('mainHostController.labelValueMap')[displayName] = name;
+        App.router.get('mainHostController.labelValueMap')[displayName] = component.get('componentName');
       }
     });
     return hostComponentList;
@@ -130,7 +130,7 @@ App.MainHostComboSearchBoxView = Em.View.extend({
             case 'rack':
               callback(App.Host.find().toArray().mapProperty('rack').uniq().reject(function (item) {
                 return visualSearch.searchQuery.values(facet).indexOf(item) >= 0;
-              }), {preserveMatches: true});
+              }));
               break;
             case 'version':
               callback(App.HostStackVersion.find().toArray()