You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2013/12/19 13:01:16 UTC

git commit: AMBARI-4086 Need clear filter action in configs filter textfield. (Mikhail Bayuk via atkach)

Updated Branches:
  refs/heads/trunk b35f7b8e5 -> d64b06e6e


AMBARI-4086 Need clear filter action in configs filter textfield. (Mikhail Bayuk via atkach)


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

Branch: refs/heads/trunk
Commit: d64b06e6ed298c2b3ff298d24d3a894e86f09a84
Parents: b35f7b8
Author: atkach <at...@hortonworks.com>
Authored: Thu Dec 19 14:01:10 2013 +0200
Committer: atkach <at...@hortonworks.com>
Committed: Thu Dec 19 14:01:10 2013 +0200

----------------------------------------------------------------------
 ambari-web/app/styles/application.less          | 14 +++++
 .../templates/common/configs/service_config.hbs |  6 +--
 .../templates/common/filter_combo_cleanable.hbs | 38 ++++++++++++++
 ambari-web/app/views.js                         |  1 +
 .../app/views/common/filter_combo_cleanable.js  | 54 ++++++++++++++++++++
 5 files changed, 110 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d64b06e6/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index c7a15f6..62707b6 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -5039,3 +5039,17 @@ i.icon-asterisks {
   right: 10px;
 }
 
+#cleanerContainer {
+  z-index: 1000;
+  position: absolute;
+  left: -20px;
+  width: 16px;
+  margin-top: 7px;
+  #filterCleaner {
+    opacity: .5;
+
+  }
+  #filterCleaner:hover {
+    opacity: .9;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d64b06e6/ambari-web/app/templates/common/configs/service_config.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config.hbs b/ambari-web/app/templates/common/configs/service_config.hbs
index b7c093e..171a936 100644
--- a/ambari-web/app/templates/common/configs/service_config.hbs
+++ b/ambari-web/app/templates/common/configs/service_config.hbs
@@ -68,9 +68,9 @@
       &nbsp;<a href="#" {{action "switchHostGroup" target="controller"}}>{{t common.change}}</a>
     {{/if}}
      <a href="#" class="link" {{action "manageConfigurationGroup" target="controller"}}>{{t services.service.actions.manage_configuration_groups.short}}</a>
-     <div class="pull-right">
-       {{view App.FilterComboboxView filterBinding="view.filter" columnsBinding="view.columns" }}
-     </div>
+    <div class="pull-right">
+      {{view App.FilterComboCleanableView filterBinding="view.filter" columnsBinding="view.columns" }}
+    </div>
 	</div>
 {{/if}}
 <div class="accordion">

http://git-wip-us.apache.org/repos/asf/ambari/blob/d64b06e6/ambari-web/app/templates/common/filter_combo_cleanable.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/filter_combo_cleanable.hbs b/ambari-web/app/templates/common/filter_combo_cleanable.hbs
new file mode 100644
index 0000000..36e3efb
--- /dev/null
+++ b/ambari-web/app/templates/common/filter_combo_cleanable.hbs
@@ -0,0 +1,38 @@
+{{!
+* 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.
+}}
+
+  {{view Ember.TextField valueBinding="view.filter" placeholderBinding="view.placeHolder"}}
+  <div class="btn-group">
+    <div id="cleanerContainer" class="pull-left">
+      <a href="#" id="filterCleaner" {{action "clearFilter" target="view"}}
+        {{bindAttr class="view.filterNotEmpty::hidden :ui-icon :ui-icon-circle-close"}}></a>
+    </div>
+      <button class="btn dropdown-toggle" data-toggle="dropdown">
+          <span class="caret"></span>
+      </button>
+      <ul class="dropdown-menu">
+        {{#each column in view.columns}}
+            <li>
+                <a href="#" {{action selectFilterColumn column target="view"}}>
+                  <i {{bindAttr class="column.selected:icon-ok-sign:icon-placeholder :text-success"}}></i>
+                  {{column.name}}
+                </a>
+            </li>
+        {{/each}}
+      </ul>
+  </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d64b06e6/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index 550fcfe..b996407 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -32,6 +32,7 @@ require('views/common/quick_view_link_view');
 require('views/common/configs/services_config');
 require('views/common/configs/overriddenProperty_view');
 require('views/common/filter_combobox');
+require('views/common/filter_combo_cleanable');
 require('views/common/table_view');
 require('views/login');
 require('views/main');

http://git-wip-us.apache.org/repos/asf/ambari/blob/d64b06e6/ambari-web/app/views/common/filter_combo_cleanable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/filter_combo_cleanable.js b/ambari-web/app/views/common/filter_combo_cleanable.js
new file mode 100644
index 0000000..a002a1b
--- /dev/null
+++ b/ambari-web/app/views/common/filter_combo_cleanable.js
@@ -0,0 +1,54 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+
+/**
+ * Filter component with custom dropdown and cross-circled cleaner. Build on Twitter Bootstrap styles
+ * @type {*}
+ */
+App.FilterComboCleanableView = Ember.View.extend({
+  templateName: require('templates/common/filter_combo_cleanable'),
+
+  classNames: ['filter-combobox', 'input-append'],
+
+  placeHolder: function(){
+    return this.t('common.combobox.placeholder');
+  }.property(),
+
+  /**
+   * Onclick handler for dropdown menu
+   * @param event
+   */
+  selectFilterColumn: function(event){
+    var column = event.context;
+    column.set('selected', !column.get('selected'));
+  },
+
+  filterNotEmpty: function(target){
+    return (this.get('filter').length > 0);
+  }.property('filter'),
+
+  /**
+   * clear Filter textfield
+   */
+  clearFilter: function() {
+    this.set('filter', '');
+  }
+});