This is an automated email from the ASF dual-hosted git repository. ababiichuk 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 5cd6b30 AMBARI-24128 Add notification to the Alert Groups not working. (ababiichuk) 5cd6b30 is described below commit 5cd6b30b53f43fc9f24e96c85ae2e1367864c949 Author: ababiichuk <ababiic...@hortonworks.com> AuthorDate: Sat Jun 16 17:21:25 2018 +0300 AMBARI-24128 Add notification to the Alert Groups not working. (ababiichuk) --- .../app/mappers/socket/alert_groups_mapper_adapter.js | 15 +++++++++++---- .../templates/main/alerts/manage_alert_groups_popup.hbs | 1 + ambari-web/app/views/common/editable_list.js | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ambari-web/app/mappers/socket/alert_groups_mapper_adapter.js b/ambari-web/app/mappers/socket/alert_groups_mapper_adapter.js index 58ff0b2..b606076 100644 --- a/ambari-web/app/mappers/socket/alert_groups_mapper_adapter.js +++ b/ambari-web/app/mappers/socket/alert_groups_mapper_adapter.js @@ -25,11 +25,12 @@ App.alertGroupsMapperAdapter = App.QuickDataMapper.create({ map: function(event) { event.groups.forEach((alertGroup) => { if (event.updateType === 'UPDATE' || event.updateType === 'CREATE') { - const {definitions} = alertGroup; + const {definitions, targets} = alertGroup; if (definitions) { - alertGroup.definitions = definitions.map(id => ({ - id - })); + alertGroup.definitions = this.convertIdsToObjects(definitions); + } + if (targets) { + alertGroup.targets = this.convertIdsToObjects(targets); } App.alertGroupsMapper.map({ items: [ @@ -43,5 +44,11 @@ App.alertGroupsMapperAdapter = App.QuickDataMapper.create({ } }); App.router.get('manageAlertGroupsController').toggleProperty('changeTrigger'); + }, + + convertIdsToObjects: function (arr) { + return arr.map(id => ({ + id + })); } }); diff --git a/ambari-web/app/templates/main/alerts/manage_alert_groups_popup.hbs b/ambari-web/app/templates/main/alerts/manage_alert_groups_popup.hbs index db9a560..84e78ba 100644 --- a/ambari-web/app/templates/main/alerts/manage_alert_groups_popup.hbs +++ b/ambari-web/app/templates/main/alerts/manage_alert_groups_popup.hbs @@ -80,6 +80,7 @@ itemsBinding="selectedAlertGroup.notifications" resourcesBinding="controller.alertNotifications" nameBinding="selectedAlertGroup.displayName" + isCaseSensitive=false }} </div> </div> diff --git a/ambari-web/app/views/common/editable_list.js b/ambari-web/app/views/common/editable_list.js index b1d187d..636f782 100644 --- a/ambari-web/app/views/common/editable_list.js +++ b/ambari-web/app/views/common/editable_list.js @@ -31,6 +31,8 @@ App.EditableList = Ember.View.extend({ typeahead: [], selectedTypeahed: 0, + isCaseSensitive: true, + init: function () { this._super(); this.updateItemsOriginal(); @@ -73,11 +75,13 @@ App.EditableList = Ember.View.extend({ */ availableItemsToAdd: function () { var allItems = Em.copy(this.get('resources')); - var input = this.get('input'); + var isCaseSensitive = this.get('isCaseSensitive'); + var input = isCaseSensitive ? this.get('input') : this.get('input').toLowerCase(); var toRemove = []; var existed = this.get('items'); allItems.forEach(function(item) { - if (item.name.indexOf(input) < 0 || existed.findProperty('name', item.name)) { + var nameToCompare = isCaseSensitive ? item.name : item.name.toLowerCase(); + if (nameToCompare.indexOf(input) < 0 || existed.findProperty('name', item.name)) { toRemove.push(item); } }); -- To stop receiving notification emails like this one, please contact ababiic...@apache.org.