You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by xi...@apache.org on 2014/12/05 03:29:17 UTC
[1/2] ambari git commit: AMBARI-8537. Alerts UI: Add ability to
create global alert-notification.(xiwang)
Repository: ambari
Updated Branches:
refs/heads/trunk 96c9e2045 -> ae24c7331
AMBARI-8537. Alerts UI: Add ability to create global alert-notification.(xiwang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ae24c733
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ae24c733
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ae24c733
Branch: refs/heads/trunk
Commit: ae24c7331f3583c400a6b4f469fc1ae487c109f9
Parents: f5ed635
Author: Xi Wang <xi...@apache.org>
Authored: Thu Dec 4 15:26:59 2014 -0800
Committer: Xi Wang <xi...@apache.org>
Committed: Thu Dec 4 18:09:52 2014 -0800
----------------------------------------------------------------------
.../main/alerts/manage_alert_groups_controller.js | 1 +
.../main/alerts/manage_alert_notifications_controller.js | 11 +++++++++++
ambari-web/app/mappers/alert_notification_mapper.js | 3 ++-
ambari-web/app/messages.js | 1 +
ambari-web/app/models/alert_config.js | 2 +-
ambari-web/app/models/alert_notification.js | 1 +
ambari-web/app/styles/alerts.less | 7 ++++++-
ambari-web/app/styles/common.less | 2 +-
ambari-web/app/templates/common/alerts_popup.hbs | 2 +-
ambari-web/app/templates/common/editable_list.hbs | 10 ++++++----
.../templates/main/alerts/create_alert_notification.hbs | 10 +++++++++-
.../app/templates/main/alerts/definition_details.hbs | 2 +-
.../main/alerts/manage_alert_notifications_popup.hbs | 10 +++++++---
ambari-web/app/views/common/editable_list.js | 8 +-------
.../views/main/alerts/manage_alert_notifications_view.js | 2 +-
.../alerts/manage_alert_notifications_controller_test.js | 11 +++++++++++
16 files changed, 61 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js b/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
index 905620b..7e3a2e3 100644
--- a/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
+++ b/ambari-web/app/controllers/main/alerts/manage_alert_groups_controller.js
@@ -95,6 +95,7 @@ App.ManageAlertGroupsController = Em.Controller.extend({
name: target.AlertTarget.name,
type: target.AlertTarget.notification_type,
description: target.AlertTarget.description,
+ global: target.AlertTarget.global,
id: target.AlertTarget.id
}));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js b/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
index 27f8303..a5c13cf 100644
--- a/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
+++ b/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
@@ -51,6 +51,12 @@ App.ManageAlertNotificationsController = Em.Controller.extend({
value: '',
defaultValue: ''
},
+ global: {
+ label: Em.I18n.t('alerts.actions.manage_alert_notifications_popup.global'),
+ value: false,
+ defaultValue: false,
+ disabled: false
+ },
method: {
label: Em.I18n.t('alerts.actions.manage_alert_notifications_popup.method'),
value: '',
@@ -146,6 +152,7 @@ App.ManageAlertNotificationsController = Em.Controller.extend({
*/
addAlertNotification: function () {
var inputFields = this.get('inputFields');
+ inputFields.set('global.disabled', false);
Em.keys(inputFields).forEach(function (key) {
inputFields.set(key + '.value', inputFields.get(key + '.defaultValue'));
});
@@ -178,6 +185,9 @@ App.ManageAlertNotificationsController = Em.Controller.extend({
selectedAlertNotification.get('alertStates').contains('CRITICAL'),
selectedAlertNotification.get('alertStates').contains('UNKNOWN')
]);
+ inputFields.set('global.value', selectedAlertNotification.get('global'));
+ // not allow to edit global field
+ inputFields.set('global.disabled', true);
inputFields.set('description.value', selectedAlertNotification.get('description'));
inputFields.set('method.value', selectedAlertNotification.get('type'));
inputFields.get('customProperties').clear();
@@ -256,6 +266,7 @@ App.ManageAlertNotificationsController = Em.Controller.extend({
AlertTarget: {
name: inputFields.get('name.value'),
description: inputFields.get('description.value'),
+ global: inputFields.get('global.value'),
notification_type: inputFields.get('method.value'),
alert_states: alertStates,
properties: properties
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/mappers/alert_notification_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/alert_notification_mapper.js b/ambari-web/app/mappers/alert_notification_mapper.js
index bd1a42a..728a2e7 100644
--- a/ambari-web/app/mappers/alert_notification_mapper.js
+++ b/ambari-web/app/mappers/alert_notification_mapper.js
@@ -23,7 +23,8 @@ App.alertNotificationMapper = App.QuickDataMapper.create({
id: 'AlertTarget.id',
name: 'AlertTarget.name',
type: 'AlertTarget.notification_type',
- description: 'AlertTarget.description'
+ description: 'AlertTarget.description',
+ global: 'AlertTarget.global'
},
map: function (json) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index e2c2744..dd4e952 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1861,6 +1861,7 @@ Em.I18n.translations = {
'alerts.actions.manage_alert_notifications_popup.duplicateButton':'Duplicate Alert Notification',
'alerts.actions.manage_alert_notifications_popup.method':'Method',
'alerts.actions.manage_alert_notifications_popup.email':'Email',
+ 'alerts.actions.manage_alert_notifications_popup.global':'Global',
'alerts.actions.manage_alert_notifications_popup.severityFilter':'Severity Filter',
'hosts.host.add':'Add New Hosts',
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/models/alert_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alert_config.js b/ambari-web/app/models/alert_config.js
index a77196b..ed337f0 100644
--- a/ambari-web/app/models/alert_config.js
+++ b/ambari-web/app/models/alert_config.js
@@ -209,7 +209,7 @@ App.AlertConfigProperties = {
name: 'interval',
label: 'Interval',
displayType: 'textField',
- unit: 'Second',
+ unit: 'Minute',
classNames: 'alert-interval-input',
apiProperty: 'interval'
}),
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/models/alert_notification.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alert_notification.js b/ambari-web/app/models/alert_notification.js
index 40e2089..c2d7570 100644
--- a/ambari-web/app/models/alert_notification.js
+++ b/ambari-web/app/models/alert_notification.js
@@ -24,6 +24,7 @@ App.AlertNotification = DS.Model.extend({
type: DS.attr('string'),
description: DS.attr('string'),
groups: DS.hasMany('App.AlertGroup'),
+ global: DS.attr('boolean'),
properties: {},
alertStates: []
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/styles/alerts.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/alerts.less b/ambari-web/app/styles/alerts.less
index 8785eee..8018c44 100644
--- a/ambari-web/app/styles/alerts.less
+++ b/ambari-web/app/styles/alerts.less
@@ -337,6 +337,12 @@
}
}
+#manage-alert-notification-content {
+ .notification-info .global-info .global-checkbox {
+ margin: 0px;
+ }
+}
+
#manage-alert-notifications-error {
margin-bottom: 20px
}
@@ -357,7 +363,6 @@
.icon-minus-sign {
color: #FF4B4B;
}
-
}
/*****start styles for manage alerts popup*****/
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/styles/common.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/common.less b/ambari-web/app/styles/common.less
index 8b1ad84..afa1405 100644
--- a/ambari-web/app/styles/common.less
+++ b/ambari-web/app/styles/common.less
@@ -60,7 +60,7 @@
position: relative;
}
-.editable-list-container.edit-mode .items-box ul.items-list li.item{
+.editable-list-container.edit-mode .items-box ul.items-list li.item.deletable{
padding-right: 25px;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/templates/common/alerts_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/alerts_popup.hbs b/ambari-web/app/templates/common/alerts_popup.hbs
index 1c19074..579471a 100644
--- a/ambari-web/app/templates/common/alerts_popup.hbs
+++ b/ambari-web/app/templates/common/alerts_popup.hbs
@@ -35,7 +35,7 @@
<div class="status-icon">{{{alertInstance.status}}}</div>
<div class="name-text"><a href="#" {{action "gotoAlertDetails" alertInstance target="view"}}>{{alertInstance.label}}</a></div>
<div class="service-text"><a href="#" {{action "gotoService" alertInstance.service target="view"}}>{{alertInstance.service.displayName}}</a>
- {{#if alertInstance.host}}
+ {{#if alertInstance.host.hostName}}
{{#if alertInstance.service.displayName}}
/
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/templates/common/editable_list.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/editable_list.hbs b/ambari-web/app/templates/common/editable_list.hbs
index c905662..53f92cd 100644
--- a/ambari-web/app/templates/common/editable_list.hbs
+++ b/ambari-web/app/templates/common/editable_list.hbs
@@ -20,12 +20,14 @@
<div class="items-box" {{action enableEditMode target="view"}}>
<ul class="items-list">
{{#each item in view.items}}
- <li class="item">
+ <li {{bindAttr class=":item item.global::deletable"}}>
<span>
<a href>{{item.name}}</a>
- <button {{action removeFromItems item target="view"}} type="button" class="close">
- <span>×x</span>
- </button>
+ {{#unless item.global}}
+ <button {{action removeFromItems item target="view"}} type="button" class="close">
+ <span>×</span>
+ </button>
+ {{/unless}}
</span>
</li>
{{/each}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/templates/main/alerts/create_alert_notification.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/create_alert_notification.hbs b/ambari-web/app/templates/main/alerts/create_alert_notification.hbs
index 9002809..9ef86eb 100644
--- a/ambari-web/app/templates/main/alerts/create_alert_notification.hbs
+++ b/ambari-web/app/templates/main/alerts/create_alert_notification.hbs
@@ -32,7 +32,15 @@
<label class="control-label" for="inputGroups">{{controller.inputFields.groups.label}}</label>
<div class="controls">
- {{view Em.TextField valueBinding="controller.inputFields.groups.value" id="inputGroups" class="input-xlarge"}}
+ {{view Em.TextField valueBinding="controller.inputFields.groups.value" id="inputGroups" class="input-xlarge" disabledBinding="controller.inputFields.global.value"}}
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="inputGlobal">{{controller.inputFields.global.label}}</label>
+
+ <div class="controls">
+ {{view Em.Checkbox checkedBinding="controller.inputFields.global.value" disabledBinding="controller.inputFields.global.disabled" id="inputGlobal" class="input-xlarge"}}
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/templates/main/alerts/definition_details.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/definition_details.hbs b/ambari-web/app/templates/main/alerts/definition_details.hbs
index 3598664..4e4e5c8 100644
--- a/ambari-web/app/templates/main/alerts/definition_details.hbs
+++ b/ambari-web/app/templates/main/alerts/definition_details.hbs
@@ -175,7 +175,7 @@
<td class="first">{{{instance.status}}}</td>
<td>
<a {{action goToService instance.service target="controller"}} href="#">{{instance.service.displayName}}</a>
- {{#if instance.host}}
+ {{#if instance.host.hostName}}
{{#if instance.service.displayName}}
/
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/templates/main/alerts/manage_alert_notifications_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/manage_alert_notifications_popup.hbs b/ambari-web/app/templates/main/alerts/manage_alert_notifications_popup.hbs
index be83e47..94f7ed8 100644
--- a/ambari-web/app/templates/main/alerts/manage_alert_notifications_popup.hbs
+++ b/ambari-web/app/templates/main/alerts/manage_alert_notifications_popup.hbs
@@ -17,10 +17,10 @@
}}
<div class="alert alert-info margin-bottom-5">{{t alerts.actions.manageNotifications.info}}</div>
{{#if controller.isLoaded}}
- <div class="row-fluid manage-configuration-group-content">
+ <div class="row-fluid manage-configuration-group-content" id="manage-alert-notification-content">
<div class="span12">
<div class="row-fluid">
- <div class="span4">
+ <div class="span4 notification-list">
<span> </span>
{{view Em.Select
contentBinding="alertNotifications"
@@ -56,7 +56,7 @@
</div>
</div>
</div>
- <div class="span8">
+ <div class="span8 notification-info">
<span> </span>
<div class="row-fluid">
@@ -70,6 +70,10 @@
<div class="span3">{{t common.groups}}</div>
<div class="span9">{{view.selectedAlertNotificationGroups}}</div>
</div>
+ <div class="row-fluid global-info">
+ <div class="span3">{{t alerts.actions.manage_alert_notifications_popup.global}}</div>
+ <div class="span9">{{view Em.Checkbox checkedBinding="selectedAlertNotification.global" disabled="disabled" class="global-checkbox"}}</div>
+ </div>
<div class="row-fluid">
<div class="span3">{{t alerts.actions.manage_alert_notifications_popup.method}}</div>
<div class="span9">{{selectedAlertNotification.type}}</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/views/common/editable_list.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/editable_list.js b/ambari-web/app/views/common/editable_list.js
index 847c603..abf57a9 100644
--- a/ambari-web/app/views/common/editable_list.js
+++ b/ambari-web/app/views/common/editable_list.js
@@ -105,7 +105,6 @@ App.EditableList = Ember.View.extend({
self.addItem(item);
});
self.clearInput();
- self.focusOnInput();
} else {
// Load typeahed items based on current input
var items = self.get('availableItemsToAdd');
@@ -115,12 +114,7 @@ App.EditableList = Ember.View.extend({
} else {
self.set('typeahead', []);
self.set('selectedTypeahed', 0);
- this.focusOnInput();
}
- }.observes('input'),
-
- focusOnInput: function() {
- }
-
+ }.observes('input')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js b/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
index 5835be6..56e8556 100644
--- a/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
+++ b/ambari-web/app/views/main/alerts/manage_alert_notifications_view.js
@@ -28,7 +28,7 @@ App.ManageAlertNotificationsView = Em.View.extend({
selectedAlertNotification: null,
selectedAlertNotificationGroups: function () {
- return this.get('controller.selectedAlertNotification.groups').toArray().mapProperty('name').join(', ');
+ return this.get('controller.selectedAlertNotification.groups').toArray().mapProperty('displayName').join(', ');
}.property('controller.selectedAlertNotification'),
isEditButtonDisabled: true,
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae24c733/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
index 2ae6c6e..688fffe 100644
--- a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
@@ -168,6 +168,7 @@ describe('App.ManageAlertNotificationsController', function () {
controller.set('selectedAlertNotification', Em.Object.create({
name: 'test_name',
+ global: true,
description: 'test_description',
type: 'EMAIL',
alertStates: ['OK', 'UNKNOWN'],
@@ -187,6 +188,9 @@ describe('App.ManageAlertNotificationsController', function () {
groups: {
value: ''
},
+ global: {
+ value: false
+ },
method: {
value: ''
},
@@ -214,6 +218,9 @@ describe('App.ManageAlertNotificationsController', function () {
groups: {
value: ''
},
+ global: {
+ value: true
+ },
method: {
value: 'EMAIL'
},
@@ -270,6 +277,9 @@ describe('App.ManageAlertNotificationsController', function () {
groups: {
value: ''
},
+ global: {
+ value: false
+ },
method: {
value: 'EMAIL'
},
@@ -293,6 +303,7 @@ describe('App.ManageAlertNotificationsController', function () {
expect(result).to.eql({
AlertTarget: {
name: 'test_name',
+ global: false,
description: 'test_description',
notification_type: 'EMAIL',
alert_states: ['OK', 'CRITICAL'],
[2/2] ambari git commit: AMBARI-8548. Alerts UI: Layout for alerts is
broken with wrap around for hostnames.(xiwang)
Posted by xi...@apache.org.
AMBARI-8548. Alerts UI: Layout for alerts is broken with wrap around for hostnames.(xiwang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f5ed6359
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f5ed6359
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f5ed6359
Branch: refs/heads/trunk
Commit: f5ed63590a038b51e0a0d9212c009876b03568af
Parents: 96c9e20
Author: Xi Wang <xi...@apache.org>
Authored: Thu Dec 4 11:25:11 2014 -0800
Committer: Xi Wang <xi...@apache.org>
Committed: Thu Dec 4 18:09:52 2014 -0800
----------------------------------------------------------------------
ambari-web/app/styles/alerts.less | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f5ed6359/ambari-web/app/styles/alerts.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/alerts.less b/ambari-web/app/styles/alerts.less
index b203698..8785eee 100644
--- a/ambari-web/app/styles/alerts.less
+++ b/ambari-web/app/styles/alerts.less
@@ -433,7 +433,7 @@
max-height: 340px;
width: 100%;
.alert-list-wrap {
- padding: 10px 10px 10px 20px;
+ padding: 10px 5px;
border-top: 1px solid #CCC;
border-bottom: 1px solid #CCC;
}
@@ -443,17 +443,17 @@
.status-icon {
padding-left: 5px;
float: left;
- width: 10%;
+ width: 12%;
min-width: 20px;
}
.name-text {
- padding-left: 10px;
- width: 35%;
+ padding-left: 5px;
float: left;
+ width: 33%;
}
.service-text {
padding-left: 5px;
- width: 30%;
+ width: 33%;
float: left;
.na-text {
color: #808080;
@@ -461,10 +461,20 @@
}
.last-triggered-text {
padding-left: 5px;
+ float: left;
+ width: 18%;
color: #808080;
font-size: 12px;
}
}
+ .alert-list-line-cursor:before,.alert-list-line-cursor:after {
+ display: table;
+ line-height: 0;
+ content: "";
+ }
+ .alert-list-line-cursor:after {
+ clear: both;
+ }
.show-more {
width: 98.8%;
min-height: 20px;