ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-13046. Revert filter UI for Alert Group + Config Group and address the original issue. (alexantonenko)
Date Thu, 10 Sep 2015 14:44:49 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk c985602cc -> a2931529c


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/a2931529
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a2931529
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a2931529

Branch: refs/heads/trunk
Commit: a2931529c16ebc48d8cb14226e9a65a2984a2550
Parents: c985602
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Wed Sep 9 15:33:15 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Thu Sep 10 17:42:54 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/a2931529/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 9ef3f7f..c54f492 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',
 
@@ -1782,7 +1781,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/a2931529/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index be0220b..4e62482 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;
 }
@@ -4791,6 +4797,11 @@ li.break {
   .link-left-pad {
     padding-left:15px;
   }
+  .config-groups-dropdown-menu {
+    overflow: auto;
+    max-height: 416px;
+    margin-top: 16px;
+  }
 }
 
 #reload_popup {
@@ -5946,20 +5957,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/a2931529/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/a2931529/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/a2931529/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/a2931529/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 803fa63..fe7bf52 100644
--- a/ambari-web/app/views/main/alert_definitions_view.js
+++ b/ambari-web/app/views/main/alert_definitions_view.js
@@ -374,61 +374,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: '',
@@ -460,9 +426,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'),
 


Mime
View raw message