You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/09/10 16:37:33 UTC

ambari git commit: AMBARI-13046. Revert filter UI for Alert Group + Config Group and address the original issue. (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 21e497741 -> 7d17847e6


AMBARI-13046. Revert filter UI for Alert Group + Config Group and address the original issue. (alexantonenko)


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

Branch: refs/heads/branch-2.1
Commit: 7d17847e6e0f20bc69d8efc6738a144955ff6f17
Parents: 21e4977
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Sep 9 15:33:15 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Sep 10 17:27:39 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/messages.js                      |  2 -
 ambari-web/app/styles/application.less          | 28 +++-----
 .../templates/common/configs/service_config.hbs | 26 +++++---
 .../common/configs/service_config_wizard.hbs    | 19 +++++-
 .../views/common/configs/service_config_view.js | 70 --------------------
 .../app/views/main/alert_definitions_view.js    | 63 ++++--------------
 6 files changed, 57 insertions(+), 151 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7d17847e/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 8f2972a..6f813c9 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -908,7 +908,6 @@ Em.I18n.translations = {
   'form.validator.configKey':'Invalid Key. Only alphanumerics, hyphens, underscores, asterisks and periods are allowed.',
   'form.validator.configGroupName':'Invalid Group Name. Only alphanumerics, hyphens, spaces and underscores are allowed.',
   'form.validator.alertGroupName':'Invalid Alert Group Name. Only alphanumerics, hyphens, spaces and underscores are allowed.',
-  'form.validator.alertGroupPlaceHolder':'Alert Group Name',
   'form.validator.configKey.specific':'"{0}" is invalid Key. Only alphanumerics, hyphens, underscores, asterisks and periods are allowed.',
   'form.validator.error.trailingSpaces': 'Cannot contain trailing whitespace',
 
@@ -1808,7 +1807,6 @@ Em.I18n.translations = {
     'on the Ambari Server host to make the JDBC driver available and to enable testing the database connection.',
   'stack.specific.sqla.support.msg': '<b>Please note that SQLA database option is only supported on HDP-2.3.2 or higher.</b><br/>',
   'services.service.config.configHistory.configGroup': 'Config Group',
-  'services.service.config.configHistory.configGroup.name': 'Config Group Name',
   'services.service.config.configHistory.rightArrow.tooltip': 'Show earlier versions',
   'services.service.config.configHistory.leftArrow.tooltip': 'Show later versions',
   'services.service.config.configHistory.dismissIcon.tooltip': 'Dismiss',

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d17847e/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 361ae57..8a3a695 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2112,6 +2112,12 @@ a:focus {
 /*end services summary*/
 
 /*start alerts summary*/
+
+.alert-groups-dropdown {
+  overflow: auto;
+  max-height: 416px;
+}
+
 #alert-actions-button {
   margin-right: 10px;
 }
@@ -4774,6 +4780,11 @@ li.break {
   .link-left-pad {
     padding-left:15px;
   }
+  .config-groups-dropdown-menu {
+    overflow: auto;
+    max-height: 416px;
+    margin-top: 16px;
+  }
 }
 
 #reload_popup {
@@ -5929,20 +5940,3 @@ input[type="radio"].align-checkbox, input[type="checkbox"].align-checkbox {
     }
   }
 }
-
-.typeahead.dropdown-menu {
-  max-height: 280px;
-  overflow-y: auto;
-}
-
-.config-groups-dropdown {
-  display: inline-block;
-  input[type="text"] {
-    margin-bottom: 2px;
-  }
-  .spinner {
-    background-size: 20px;
-    height: 20px;
-    width: 20px;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d17847e/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 4ab0823..0075fd0 100644
--- a/ambari-web/app/templates/common/configs/service_config.hbs
+++ b/ambari-web/app/templates/common/configs/service_config.hbs
@@ -49,15 +49,23 @@
   <div class="alert alert-info">
 
     {{t common.group}}&nbsp;
-    <div class="config-groups-dropdown">
-      {{#if controller.configGroupsAreLoaded}}
-        {{view App.ConfigGroupDropdownView}}
-      {{else}}
-        <div class="pull-left spinner"></div>
-      {{/if}}
-    </div>
-
-
+	  <span class="btn-group">
+		  <button {{bindAttr disabled="controller.isHostsConfigsPage"}} class="btn dropdown-toggle"
+                                                                    data-toggle="dropdown">{{selectedConfigGroup.displayNameHosts}}</button>
+		  <button {{bindAttr disabled="controller.isHostsConfigsPage"}} class="btn dropdown-toggle" data-toggle="dropdown">
+        <span class="caret"></span>
+      </button>
+		  <ul class="dropdown-menu config-groups-dropdown-menu">
+        <!-- available config group menu links -->
+        {{#each configGroup in configGroups}}
+          <li>
+            <a href="#" {{action "selectConfigGroup" configGroup target="controller"}}>
+              {{configGroup.displayNameHosts}}
+            </a>
+          </li>
+        {{/each}}
+      </ul>
+		</span>
     {{#isAccessible ADMIN}}
       {{#if controller.isHostsConfigsPage}}
         &nbsp;<a href="#" {{action "switchHostGroup" target="controller"}}>{{t common.change}}</a>

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d17847e/ambari-web/app/templates/common/configs/service_config_wizard.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config_wizard.hbs b/ambari-web/app/templates/common/configs/service_config_wizard.hbs
index a66eeb7..cd970e7 100644
--- a/ambari-web/app/templates/common/configs/service_config_wizard.hbs
+++ b/ambari-web/app/templates/common/configs/service_config_wizard.hbs
@@ -19,9 +19,22 @@
 {{#if view.supportsHostOverrides}}
   <div class="alert alert-info">
     {{t common.group}}&nbsp;
-    <div class="config-groups-dropdown">
-      {{view App.ConfigGroupDropdownView}}
-    </div>
+	  <span class="btn-group">
+		  <button {{bindAttr disabled="controller.isHostsConfigsPage"}} class="btn">{{selectedConfigGroup.displayNameHosts}}</button>
+		  <button {{bindAttr disabled="controller.isHostsConfigsPage"}} class="btn dropdown-toggle" data-toggle="dropdown">
+        <span class="caret"></span>
+      </button>
+		  <ul class="dropdown-menu">
+        <!-- available config group menu links -->
+        {{#each configGroup in configGroups}}
+          <li>
+            <a href="#" {{action "selectConfigGroup" configGroup target="controller"}}>
+              {{configGroup.displayNameHosts}}
+            </a>
+          </li>
+        {{/each}}
+      </ul>
+		</span>
     {{#isAccessible ADMIN}}
       {{#if controller.isHostsConfigsPage}}
         &nbsp;<a href="#" {{action "switchHostGroup" target="controller"}}>{{t common.change}}</a>

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d17847e/ambari-web/app/views/common/configs/service_config_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_config_view.js b/ambari-web/app/views/common/configs/service_config_view.js
index 2393b47..016b546 100644
--- a/ambari-web/app/views/common/configs/service_config_view.js
+++ b/ambari-web/app/views/common/configs/service_config_view.js
@@ -296,74 +296,4 @@ App.ServiceConfigView = Em.View.extend({
       self.pickActiveTab(self.get('tabs'));
     });
   }.observes('filter', 'columns.@each.selected', 'tabs.@each.isHiddenByFilter')
-
-});
-
-
-App.ConfigGroupDropdownView = Ember.TextField.extend({
-  classNames: ['typeahead'],
-
-  /**
-   * @type {string}
-   */
-  placeholder: Em.I18n.t('services.service.config.configHistory.configGroup.name'),
-
-  /**
-   * @type {boolean}
-   */
-  disabled: function () {
-    if (this.get('controller.isInstaller')) return false;
-    return !this.get('controller.versionLoaded') || this.get('controller.isHostsConfigsPage');
-  }.property('controller.versionLoaded', 'controller.isInstaller', 'controller.isHostsConfigsPage'),
-
-  didInsertElement: function() {
-    var self = this;
-    var node = $(this.get('element'));
-    node.typeahead({
-      name: 'config groups',
-      source: self.get('controller.configGroups').mapProperty('displayNameHosts'),
-      updater: function (value) {
-        if (self.get('controller.selectedConfigGroup.displayNameHosts') !==  value
-          && self.get('controller.configGroups').findProperty('displayNameHosts', value)) {
-          self.get('controller').selectConfigGroup({
-            context: self.get('controller.configGroups').findProperty('displayNameHosts', value)
-          });
-          node.trigger('blur');
-        }
-        return value;
-      },
-      items: 9999,
-      minLength: 0,
-      matcher: function (item) {
-        if (this.query === '_SHOW_ALL_') return true;
-        return ~item.toLowerCase().indexOf(this.query.toLowerCase());
-      }
-    });
-    node.val(self.get('controller.selectedConfigGroup.displayNameHosts'));
-    node.on('keyup focus', function (e) {
-      /**
-       * don't update group list on up arrow(38) or down arrow(40) event
-       * since Typeahead ignore filtering by empty query, "_SHOW_ALL_" pseudo key used in order
-       * to force filtering and show all items
-       */
-      if ($(this).val().length === 0 && [40, 38].indexOf(e.keyCode) === -1) {
-        $(this).val('_SHOW_ALL_');
-        $(this).trigger('keyup');
-        $(this).val('');
-      }
-    });
-    node.on('blur', function (e) {
-      $(self.get('element')).val(self.get('controller.selectedConfigGroup.displayNameHosts'));
-    });
-  },
-
-  updateSelectedGroup: function () {
-    $(this.get('element')).val(this.get('controller.selectedConfigGroup.displayNameHosts'));
-  }.observes('controller.selectedConfigGroup.displayNameHosts'),
-
-  updateConfigGroupsList: function() {
-    if ($(this.get('element'))) {
-      $(this.get('element')).data('typeahead').source = this.get('controller.configGroups').mapProperty('displayNameHosts');
-    }
-  }.observes('controller.configGroups.length')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d17847e/ambari-web/app/views/main/alert_definitions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alert_definitions_view.js b/ambari-web/app/views/main/alert_definitions_view.js
index e67d124..29e4176 100644
--- a/ambari-web/app/views/main/alert_definitions_view.js
+++ b/ambari-web/app/views/main/alert_definitions_view.js
@@ -389,61 +389,27 @@ App.MainAlertDefinitionsView = App.TableView.extend({
     column: 7,
     fieldType: 'filter-input-width',
     template: Ember.Handlebars.compile(
-      '<div class="display-inline-block">' +
-       '<input type="text" class="typeahead" {{bindAttr placeholder="view.alertGroupPlaceholder" }}/>' +
+      '<div class="btn-group display-inline-block">' +
+        '<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">' +
+          '<span class="filters-label">Groups:&nbsp;&nbsp;</span>' +
+          '<span>{{view.selected.label}}&nbsp;<span class="caret"></span></span>' +
+        '</a>' +
+          '<ul class="dropdown-menu alert-groups-dropdown">' +
+            '{{#each category in view.content}}' +
+              '<li {{bindAttr class=":category-item category.selected:active"}}>' +
+                '<a {{action selectCategory category target="view"}} href="#">' +
+                   '<span {{bindAttr class="category.class"}}></span>{{category.label}}</a>' +
+              '</li>'+
+            '{{/each}}' +
+          '</ul>'+
       '</div>'
     ),
     content: [],
 
-    alertGroupPlaceholder: Em.I18n.t('form.validator.alertGroupPlaceHolder'),
-
     didInsertElement: function() {
       this._super();
       this.updateContent();
       this.set('value', '');
-      this.attachAlertGroupDropdown();
-    },
-
-    attachAlertGroupDropdown: function() {
-      var self = this;
-      var node = this.$('.typeahead');
-      this.set('typeahead', node.typeahead({
-        name: 'alert groups',
-        source: self.get('content').mapProperty('label'),
-        updater: function (label) {
-          var current = self.get('content').findProperty('value', self.get('value')).get('label');
-          var entered = self.get('content').findProperty('label', label);
-          if (current !==  label && entered) {
-            self.selectCategory({
-              context: entered
-            });
-            node.trigger('blur');
-          }
-          return label;
-        },
-        items: 9999,
-        minLength: 0,
-        matcher: function (item) {
-          if (this.query === '_SHOW_ALL_') return true;
-          return ~item.toLowerCase().indexOf(this.query.toLowerCase());
-        }
-      }));
-      node.val(self.get('content').findProperty('value', '').get('label'));
-      node.on('keyup focus', function (e) {
-        /**
-         * don't update group list on up arrow(38) or down arrow(40) event
-         * since Typeahead ignore filtering by empty query, "_SHOW_ALL_" pseudo key used in order
-         * to force filtering and show all items
-         */
-        if ($(this).val().length === 0 && [40, 38].indexOf(e.keyCode) === -1) {
-          $(this).val('_SHOW_ALL_');
-          $(this).trigger('keyup');
-          $(this).val('');
-        }
-      });
-      node.on('blur', function (e) {
-        $(self.get('.typeahead')).val(self.get('content').findProperty('value', self.get('value')).get('label'));
-      });
     },
 
     emptyValue: '',
@@ -475,9 +441,6 @@ App.MainAlertDefinitionsView = App.TableView.extend({
           label: Em.I18n.t('common.all') + ' (' + this.get('parentView.controller.content.length') + ')'
         })
       ].concat(defaultGroups, customGroups));
-      if (this.get('typeahead')) {
-        this.get('typeahead').data('typeahead').source = this.get('content').mapProperty('label');
-      }
       this.onValueChange();
     }.observes('App.router.clusterController.isLoaded', 'App.router.manageAlertGroupsController.changeTrigger'),