Repository: ambari Updated Branches: refs/heads/trunk c1482f820 -> 96b7f56fe
AMBARI-8638. Alerts UI: include username + password. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/96b7f56f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/96b7f56f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/96b7f56f Branch: refs/heads/trunk Commit: 96b7f56fec4fe89d0b1a1721a8d8badc8573d207 Parents: c1482f8 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Wed Dec 10 17:48:09 2014 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Wed Dec 10 17:48:09 2014 +0200 ---------------------------------------------------------------------- .../app/assets/data/alerts/alertGroups.json | 605 ++++++++++--------- .../manage_alert_notifications_controller.js | 49 +- ambari-web/app/messages.js | 4 + .../main/alerts/create_alert_notification.hbs | 38 ++ ...anage_alert_notifications_controller_test.js | 75 ++- 5 files changed, 462 insertions(+), 309 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/96b7f56f/ambari-web/app/assets/data/alerts/alertGroups.json ---------------------------------------------------------------------- diff --git a/ambari-web/app/assets/data/alerts/alertGroups.json b/ambari-web/app/assets/data/alerts/alertGroups.json index 0171da6..886a27d 100644 --- a/ambari-web/app/assets/data/alerts/alertGroups.json +++ b/ambari-web/app/assets/data/alerts/alertGroups.json @@ -1,394 +1,395 @@ { - "href" : "http://host:8080/api/v1/clusters/tdk/alert_groups?fields=*", - "items" : [ + "href": "http://host:8080/api/v1/clusters/tdk/alert_groups?fields=*", + "items": [ { - "href" : "http://host:8080/api/v1/clusters/tdk/alert_groups/1", - "AlertGroup" : { - "cluster_name" : "tdk", - "default" : true, - "definitions" : [ ], - "id" : 1, - "name" : "SLIDER" + "href": "http://host:8080/api/v1/clusters/tdk/alert_groups/1", + "AlertGroup": { + "targets": [], + "cluster_name": "tdk", + "default": true, + "definitions": [ ], + "id": 1, + "name": "SLIDER" } }, { - "href" : "http://host:8080/api/v1/clusters/tdk/alert_groups/2", - "AlertGroup" : { - "cluster_name" : "tdk", - "default" : true, - "definitions" : [ - { - "name" : "yarn_resourcemanager_rpc_latency", - "label" : "ResourceManager RPC Latency", - "enabled" : true, - "service_name" : "YARN", - "component_name" : "RESOURCEMANAGER", - "id" : 1, - "source_type" : "METRIC" + "href": "http://host:8080/api/v1/clusters/tdk/alert_groups/2", + "AlertGroup": {"targets": [], + "cluster_name": "tdk", + "default": true, + "definitions": [ + { + "name": "yarn_resourcemanager_rpc_latency", + "label": "ResourceManager RPC Latency", + "enabled": true, + "service_name": "YARN", + "component_name": "RESOURCEMANAGER", + "id": 1, + "source_type": "METRIC" }, { - "name" : "yarn_resourcemanager_webui", - "label" : "ResourceManager Web UI", - "enabled" : true, - "service_name" : "YARN", - "component_name" : "RESOURCEMANAGER", - "id" : 2, - "source_type" : "WEB" + "name": "yarn_resourcemanager_webui", + "label": "ResourceManager Web UI", + "enabled": true, + "service_name": "YARN", + "component_name": "RESOURCEMANAGER", + "id": 2, + "source_type": "WEB" }, { - "name" : "yarn_app_timeline_server_webui", - "label" : "App Timeline Web UI", - "enabled" : true, - "service_name" : "YARN", - "component_name" : "APP_TIMELINE_SERVER", - "id" : 3, - "source_type" : "WEB" + "name": "yarn_app_timeline_server_webui", + "label": "App Timeline Web UI", + "enabled": true, + "service_name": "YARN", + "component_name": "APP_TIMELINE_SERVER", + "id": 3, + "source_type": "WEB" }, { - "name" : "yarn_nodemanager_webui_percent", - "label" : "Percent NodeManagers Available", - "enabled" : true, - "service_name" : "YARN", - "component_name" : null, - "id" : 4, - "source_type" : "AGGREGATE" + "name": "yarn_nodemanager_webui_percent", + "label": "Percent NodeManagers Available", + "enabled": true, + "service_name": "YARN", + "component_name": null, + "id": 4, + "source_type": "AGGREGATE" }, { - "name" : "yarn_resourcemanager_cpu", - "label" : "ResourceManager CPU Utilization", - "enabled" : true, - "service_name" : "YARN", - "component_name" : "RESOURCEMANAGER", - "id" : 5, - "source_type" : "METRIC" + "name": "yarn_resourcemanager_cpu", + "label": "ResourceManager CPU Utilization", + "enabled": true, + "service_name": "YARN", + "component_name": "RESOURCEMANAGER", + "id": 5, + "source_type": "METRIC" }, { - "name" : "yarn_nodemanager_health", - "label" : "NodeManager Health", - "enabled" : true, - "service_name" : "YARN", - "component_name" : "NODEMANAGER", - "id" : 6, - "source_type" : "SCRIPT" + "name": "yarn_nodemanager_health", + "label": "NodeManager Health", + "enabled": true, + "service_name": "YARN", + "component_name": "NODEMANAGER", + "id": 6, + "source_type": "SCRIPT" }, { - "name" : "yarn_nodemanager_webui", - "label" : "NodeManager Web UI", - "enabled" : true, - "service_name" : "YARN", - "component_name" : "NODEMANAGER", - "id" : 7, - "source_type" : "WEB" + "name": "yarn_nodemanager_webui", + "label": "NodeManager Web UI", + "enabled": true, + "service_name": "YARN", + "component_name": "NODEMANAGER", + "id": 7, + "source_type": "WEB" } ], - "id" : 2, - "name" : "YARN" + "id": 2, + "name": "YARN" } }, { - "href" : "http://host:8080/api/v1/clusters/tdk/alert_groups/3", - "AlertGroup" : { - "cluster_name" : "tdk", - "default" : true, - "definitions" : [ - { - "name" : "zookeeper_server_process", - "label" : "ZooKeeper Server Process", - "enabled" : true, - "service_name" : "ZOOKEEPER", - "component_name" : "ZOOKEEPER_SERVER", - "id" : 8, - "source_type" : "PORT" + "href": "http://host:8080/api/v1/clusters/tdk/alert_groups/3", + "AlertGroup": {"targets": [], + "cluster_name": "tdk", + "default": true, + "definitions": [ + { + "name": "zookeeper_server_process", + "label": "ZooKeeper Server Process", + "enabled": true, + "service_name": "ZOOKEEPER", + "component_name": "ZOOKEEPER_SERVER", + "id": 8, + "source_type": "PORT" }, { - "name" : "zookeeper_server_process_percent", - "label" : "Percent ZooKeeper Servers Available", - "enabled" : true, - "service_name" : "ZOOKEEPER", - "component_name" : null, - "id" : 9, - "source_type" : "AGGREGATE" + "name": "zookeeper_server_process_percent", + "label": "Percent ZooKeeper Servers Available", + "enabled": true, + "service_name": "ZOOKEEPER", + "component_name": null, + "id": 9, + "source_type": "AGGREGATE" } ], - "id" : 3, - "name" : "ZOOKEEPER" + "id": 3, + "name": "ZOOKEEPER" } }, { - "href" : "http://host:8080/api/v1/clusters/tdk/alert_groups/4", - "AlertGroup" : { - "cluster_name" : "tdk", - "default" : true, - "definitions" : [ - { - "name" : "mapreduce_history_server_rpc_latency", - "label" : "History Server RPC Latency", - "enabled" : true, - "service_name" : "MAPREDUCE2", - "component_name" : "HISTORYSERVER", - "id" : 12, - "source_type" : "METRIC" + "href": "http://host:8080/api/v1/clusters/tdk/alert_groups/4", + "AlertGroup": {"targets": [], + "cluster_name": "tdk", + "default": true, + "definitions": [ + { + "name": "mapreduce_history_server_rpc_latency", + "label": "History Server RPC Latency", + "enabled": true, + "service_name": "MAPREDUCE2", + "component_name": "HISTORYSERVER", + "id": 12, + "source_type": "METRIC" }, { - "name" : "mapreduce_history_server_cpu", - "label" : "History Server CPU Utilization", - "enabled" : true, - "service_name" : "MAPREDUCE2", - "component_name" : "HISTORYSERVER", - "id" : 13, - "source_type" : "METRIC" + "name": "mapreduce_history_server_cpu", + "label": "History Server CPU Utilization", + "enabled": true, + "service_name": "MAPREDUCE2", + "component_name": "HISTORYSERVER", + "id": 13, + "source_type": "METRIC" }, { - "name" : "mapreduce_history_server_webui", - "label" : "History Server Web UI", - "enabled" : true, - "service_name" : "MAPREDUCE2", - "component_name" : "HISTORYSERVER", - "id" : 10, - "source_type" : "WEB" + "name": "mapreduce_history_server_webui", + "label": "History Server Web UI", + "enabled": true, + "service_name": "MAPREDUCE2", + "component_name": "HISTORYSERVER", + "id": 10, + "source_type": "WEB" }, { - "name" : "mapreduce_history_server_process", - "label" : "History Server Process", - "enabled" : true, - "service_name" : "MAPREDUCE2", - "component_name" : "HISTORYSERVER", - "id" : 11, - "source_type" : "PORT" + "name": "mapreduce_history_server_process", + "label": "History Server Process", + "enabled": true, + "service_name": "MAPREDUCE2", + "component_name": "HISTORYSERVER", + "id": 11, + "source_type": "PORT" } ], - "id" : 4, - "name" : "MAPREDUCE2" + "id": 4, + "name": "MAPREDUCE2" } }, { - "href" : "http://host:8080/api/v1/clusters/tdk/alert_groups/5", - "AlertGroup" : { - "cluster_name" : "tdk", - "default" : true, - "definitions" : [ - { - "name" : "ganglia_monitor_hbase_master", - "label" : "Ganglia HBase Master Process Monitor", - "enabled" : true, - "service_name" : "GANGLIA", - "component_name" : "GANGLIA_SERVER", - "id" : 17, - "source_type" : "PORT" + "href": "http://host:8080/api/v1/clusters/tdk/alert_groups/5", + "AlertGroup": {"targets": [], + "cluster_name": "tdk", + "default": true, + "definitions": [ + { + "name": "ganglia_monitor_hbase_master", + "label": "Ganglia HBase Master Process Monitor", + "enabled": true, + "service_name": "GANGLIA", + "component_name": "GANGLIA_SERVER", + "id": 17, + "source_type": "PORT" }, { - "name" : "ganglia_monitor_hdfs_namenode", - "label" : "Ganglia NameNode Process Monitor", - "enabled" : true, - "service_name" : "GANGLIA", - "component_name" : "GANGLIA_SERVER", - "id" : 16, - "source_type" : "PORT" + "name": "ganglia_monitor_hdfs_namenode", + "label": "Ganglia NameNode Process Monitor", + "enabled": true, + "service_name": "GANGLIA", + "component_name": "GANGLIA_SERVER", + "id": 16, + "source_type": "PORT" }, { - "name" : "ganglia_server_process", - "label" : "Ganglia Server Process", - "enabled" : true, - "service_name" : "GANGLIA", - "component_name" : "GANGLIA_SERVER", - "id" : 18, - "source_type" : "PORT" + "name": "ganglia_server_process", + "label": "Ganglia Server Process", + "enabled": true, + "service_name": "GANGLIA", + "component_name": "GANGLIA_SERVER", + "id": 18, + "source_type": "PORT" }, { - "name" : "ganglia_monitor_mapreduce_history_server", - "label" : "Ganglia History Server Process Monitor", - "enabled" : true, - "service_name" : "GANGLIA", - "component_name" : "GANGLIA_SERVER", - "id" : 14, - "source_type" : "PORT" + "name": "ganglia_monitor_mapreduce_history_server", + "label": "Ganglia History Server Process Monitor", + "enabled": true, + "service_name": "GANGLIA", + "component_name": "GANGLIA_SERVER", + "id": 14, + "source_type": "PORT" }, { - "name" : "ganglia_monitor_yarn_resourcemanager", - "label" : "Ganglia ResourceManager Process Monitor", - "enabled" : true, - "service_name" : "GANGLIA", - "component_name" : "GANGLIA_SERVER", - "id" : 15, - "source_type" : "PORT" + "name": "ganglia_monitor_yarn_resourcemanager", + "label": "Ganglia ResourceManager Process Monitor", + "enabled": true, + "service_name": "GANGLIA", + "component_name": "GANGLIA_SERVER", + "id": 15, + "source_type": "PORT" } ], - "id" : 5, - "name" : "GANGLIA" + "id": 5, + "name": "GANGLIA" } }, { - "href" : "http://host:8080/api/v1/clusters/tdk/alert_groups/6", - "AlertGroup" : { - "cluster_name" : "tdk", - "default" : true, - "definitions" : [ - { - "name" : "datanode_storage", - "label" : "DataNode Storage", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "DATANODE", - "id" : 34, - "source_type" : "METRIC" + "href": "http://host:8080/api/v1/clusters/tdk/alert_groups/6", + "AlertGroup": {"targets": [], + "cluster_name": "tdk", + "default": true, + "definitions": [ + { + "name": "datanode_storage", + "label": "DataNode Storage", + "enabled": true, + "service_name": "HDFS", + "component_name": "DATANODE", + "id": 34, + "source_type": "METRIC" }, { - "name" : "datanode_storage_percent", - "label" : "Percent DataNodes With Available Space", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : null, - "id" : 35, - "source_type" : "AGGREGATE" + "name": "datanode_storage_percent", + "label": "Percent DataNodes With Available Space", + "enabled": true, + "service_name": "HDFS", + "component_name": null, + "id": 35, + "source_type": "AGGREGATE" }, { - "name" : "hdfs_zookeeper_failover_controller_process", - "label" : "ZooKeeper Failover Controller Process", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "ZKFC", - "id" : 32, - "source_type" : "PORT" + "name": "hdfs_zookeeper_failover_controller_process", + "label": "ZooKeeper Failover Controller Process", + "enabled": true, + "service_name": "HDFS", + "component_name": "ZKFC", + "id": 32, + "source_type": "PORT" }, { - "name" : "namenode_directory_status", - "label" : "NameNode Directory Status", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "NAMENODE", - "id" : 33, - "source_type" : "METRIC" + "name": "namenode_directory_status", + "label": "NameNode Directory Status", + "enabled": true, + "service_name": "HDFS", + "component_name": "NAMENODE", + "id": 33, + "source_type": "METRIC" }, { - "name" : "journalnode_process_percent", - "label" : "Percent JournalNodes Available", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : null, - "id" : 36, - "source_type" : "AGGREGATE" + "name": "journalnode_process_percent", + "label": "Percent JournalNodes Available", + "enabled": true, + "service_name": "HDFS", + "component_name": null, + "id": 36, + "source_type": "AGGREGATE" }, { - "name" : "secondary_namenode_process", - "label" : "Secondary NameNode Process", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "SECONDARY_NAMENODE", - "id" : 19, - "source_type" : "PORT" + "name": "secondary_namenode_process", + "label": "Secondary NameNode Process", + "enabled": true, + "service_name": "HDFS", + "component_name": "SECONDARY_NAMENODE", + "id": 19, + "source_type": "PORT" }, { - "name" : "datanode_webui", - "label" : "DataNode Web UI", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "DATANODE", - "id" : 21, - "source_type" : "WEB" + "name": "datanode_webui", + "label": "DataNode Web UI", + "enabled": true, + "service_name": "HDFS", + "component_name": "DATANODE", + "id": 21, + "source_type": "WEB" }, { - "name" : "namenode_ha_health", - "label" : "NameNode High Availability Health", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "NAMENODE", - "id" : 20, - "source_type" : "SCRIPT" + "name": "namenode_ha_health", + "label": "NameNode High Availability Health", + "enabled": true, + "service_name": "HDFS", + "component_name": "NAMENODE", + "id": 20, + "source_type": "SCRIPT" }, { - "name" : "namenode_rpc_latency", - "label" : "NameNode RPC Latency", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "NAMENODE", - "id" : 23, - "source_type" : "METRIC" + "name": "namenode_rpc_latency", + "label": "NameNode RPC Latency", + "enabled": true, + "service_name": "HDFS", + "component_name": "NAMENODE", + "id": 23, + "source_type": "METRIC" }, { - "name" : "namenode_cpu", - "label" : "NameNode Host CPU Utilization", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "NAMENODE", - "id" : 22, - "source_type" : "METRIC" + "name": "namenode_cpu", + "label": "NameNode Host CPU Utilization", + "enabled": true, + "service_name": "HDFS", + "component_name": "NAMENODE", + "id": 22, + "source_type": "METRIC" }, { - "name" : "namenode_webui", - "label" : "NameNode Web UI", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "NAMENODE", - "id" : 25, - "source_type" : "WEB" + "name": "namenode_webui", + "label": "NameNode Web UI", + "enabled": true, + "service_name": "HDFS", + "component_name": "NAMENODE", + "id": 25, + "source_type": "WEB" }, { - "name" : "namenode_hdfs_blocks_health", - "label" : "NameNode Blocks Health", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "NAMENODE", - "id" : 24, - "source_type" : "METRIC" + "name": "namenode_hdfs_blocks_health", + "label": "NameNode Blocks Health", + "enabled": true, + "service_name": "HDFS", + "component_name": "NAMENODE", + "id": 24, + "source_type": "METRIC" }, { - "name" : "datanode_process_percent", - "label" : "Percent DataNodes Available", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : null, - "id" : 27, - "source_type" : "AGGREGATE" + "name": "datanode_process_percent", + "label": "Percent DataNodes Available", + "enabled": true, + "service_name": "HDFS", + "component_name": null, + "id": 27, + "source_type": "AGGREGATE" }, { - "name" : "datanode_process", - "label" : "DateNode Process", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "DATANODE", - "id" : 26, - "source_type" : "PORT" + "name": "datanode_process", + "label": "DateNode Process", + "enabled": true, + "service_name": "HDFS", + "component_name": "DATANODE", + "id": 26, + "source_type": "PORT" }, { - "name" : "namenode_hdfs_capacity_utilization", - "label" : "HDFS Capacity Utilization", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "NAMENODE", - "id" : 29, - "source_type" : "METRIC" + "name": "namenode_hdfs_capacity_utilization", + "label": "HDFS Capacity Utilization", + "enabled": true, + "service_name": "HDFS", + "component_name": "NAMENODE", + "id": 29, + "source_type": "METRIC" }, { - "name" : "namenode_process", - "label" : "NameNode Process", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "NAMENODE", - "id" : 28, - "source_type" : "PORT" + "name": "namenode_process", + "label": "NameNode Process", + "enabled": true, + "service_name": "HDFS", + "component_name": "NAMENODE", + "id": 28, + "source_type": "PORT" }, { - "name" : "journalnode_process", - "label" : "JournalNode Process", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "JOURNALNODE", - "id" : 31, - "source_type" : "PORT" + "name": "journalnode_process", + "label": "JournalNode Process", + "enabled": true, + "service_name": "HDFS", + "component_name": "JOURNALNODE", + "id": 31, + "source_type": "PORT" }, { - "name" : "namenode_last_checkpoint", - "label" : "NameNode Last Checkpoint", - "enabled" : true, - "service_name" : "HDFS", - "component_name" : "NAMENODE", - "id" : 30, - "source_type" : "SCRIPT" + "name": "namenode_last_checkpoint", + "label": "NameNode Last Checkpoint", + "enabled": true, + "service_name": "HDFS", + "component_name": "NAMENODE", + "id": 30, + "source_type": "SCRIPT" } ], - "id" : 6, - "name" : "HDFS" + "id": 6, + "name": "HDFS" } } ] -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/96b7f56f/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 5984421..b1345dc 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 @@ -77,6 +77,29 @@ App.ManageAlertNotificationsController = Em.Controller.extend({ value: '', defaultValue: '' }, + SMTPUseAuthentication: Em.Object.create({ + label: Em.I18n.t('alerts.actions.manage_alert_notifications_popup.SMTPUseAuthentication'), + value: false, + defaultValue: false, + inversedValue: function () { + return !this.get('value'); + }.property('value') + }), + SMTPUsername: { + label: Em.I18n.t('alerts.actions.manage_alert_notifications_popup.SMTPUsername'), + value: '', + defaultValue: '' + }, + SMTPPassword: { + label: Em.I18n.t('alerts.actions.manage_alert_notifications_popup.SMTPPassword'), + value: '', + defaultValue: '' + }, + SMTPSTARTTLS: { + label: Em.I18n.t('alerts.actions.manage_alert_notifications_popup.SMTPSTARTTLS'), + value: false, + defaultValue: false + }, emailFrom: { label: Em.I18n.t('alerts.actions.manage_alert_notifications_popup.emailFrom'), value: '', @@ -167,8 +190,20 @@ App.ManageAlertNotificationsController = Em.Controller.extend({ * List custom property names that shouldn't be displayed on Edit page * @type {string[]} */ - ignoredCustomProperties: ['ambari.dispatch.recipients', 'mail.smtp.host', 'mail.smtp.port', 'mail.smtp.from', 'ambari.dispatch.snmp.version', - 'ambari.dispatch.snmp.oids.trap', 'ambari.dispatch.snmp.community', 'ambari.dispatch.snmp.port'], + ignoredCustomProperties: [ + 'ambari.dispatch.credential.password', + 'ambari.dispatch.credential.username', + 'ambari.dispatch.recipients', + 'ambari.dispatch.snmp.community', + 'ambari.dispatch.snmp.oids.trap', + 'ambari.dispatch.snmp.port', + 'ambari.dispatch.snmp.version', + 'mail.smtp.auth', + 'mail.smtp.from', + 'mail.smtp.host', + 'mail.smtp.port', + 'mail.smtp.starttls.enable' + ], /** * Load all Alert Notifications from server @@ -241,6 +276,10 @@ App.ManageAlertNotificationsController = Em.Controller.extend({ selectedAlertNotification.get('properties')['ambari.dispatch.recipients'].join(', ') : ''); inputFields.set('SMTPServer.value', selectedAlertNotification.get('properties')['mail.smtp.host']); inputFields.set('SMTPPort.value', selectedAlertNotification.get('properties')['mail.smtp.port']); + inputFields.set('SMTPUseAuthentication.value', selectedAlertNotification.get('properties')['mail.smtp.auth']); + inputFields.set('SMTPUsername.value', selectedAlertNotification.get('properties')['ambari.dispatch.credential.username']); + inputFields.set('SMTPPassword.value', selectedAlertNotification.get('properties')['ambari.dispatch.credential.password']); + inputFields.set('SMTPSTARTTLS.value', selectedAlertNotification.get('properties')['mail.smtp.starttls.enable']); inputFields.set('emailFrom.value', selectedAlertNotification.get('properties')['mail.smtp.from']); inputFields.set('version.value', selectedAlertNotification.get('properties')['ambari.dispatch.snmp.version']); inputFields.set('OIDs.value', selectedAlertNotification.get('properties')['ambari.dispatch.snmp.oids.trap']); @@ -377,6 +416,12 @@ App.ManageAlertNotificationsController = Em.Controller.extend({ properties['mail.smtp.host'] = inputFields.get('SMTPServer.value'); properties['mail.smtp.port'] = inputFields.get('SMTPPort.value'); properties['mail.smtp.from'] = inputFields.get('emailFrom.value'); + properties['mail.smtp.auth'] = inputFields.get('SMTPUseAuthentication.value'); + if (inputFields.get('SMTPUseAuthentication.value')) { + properties['ambari.dispatch.credential.username'] = inputFields.get('SMTPUsername.value'); + properties['ambari.dispatch.credential.password'] = inputFields.get('SMTPPassword.value'); + properties['mail.smtp.starttls.enable'] = inputFields.get('SMTPSTARTTLS.value'); + } } else { properties['ambari.dispatch.snmp.version'] = inputFields.get('version.value'); properties['ambari.dispatch.snmp.oids.trap'] = inputFields.get('OIDs.value'); http://git-wip-us.apache.org/repos/asf/ambari/blob/96b7f56f/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index e16ab9c..998b661 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1896,6 +1896,10 @@ Em.I18n.translations = { 'alerts.actions.manage_alert_notifications_popup.email':'Email To', 'alerts.actions.manage_alert_notifications_popup.SMTPServer':'SMTP Server', 'alerts.actions.manage_alert_notifications_popup.SMTPPort':'SMTP Port', + 'alerts.actions.manage_alert_notifications_popup.SMTPUseAuthentication':'Use authentication', + 'alerts.actions.manage_alert_notifications_popup.SMTPUsername':'Username', + 'alerts.actions.manage_alert_notifications_popup.SMTPPassword':'Password', + 'alerts.actions.manage_alert_notifications_popup.SMTPSTARTTLS':'Start TLS', 'alerts.actions.manage_alert_notifications_popup.emailFrom':'Email From', 'alerts.actions.manage_alert_notifications_popup.version':'Version', 'alerts.actions.manage_alert_notifications_popup.OIDs':'OIDs', http://git-wip-us.apache.org/repos/asf/ambari/blob/96b7f56f/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 a7e3f1a..7401031 100644 --- a/ambari-web/app/templates/main/alerts/create_alert_notification.hbs +++ b/ambari-web/app/templates/main/alerts/create_alert_notification.hbs @@ -104,6 +104,7 @@ {{view Em.TextField valueBinding="controller.inputFields.email.value" id="inputEmail" class="input-xlarge"}} </div> </div> + <div class="control-group"> <label class="control-label">{{controller.inputFields.SMTPServer.label}}</label> @@ -111,6 +112,7 @@ {{view Em.TextField valueBinding="controller.inputFields.SMTPServer.value" class="input-xlarge"}} </div> </div> + <div class="control-group"> <label class="control-label">{{controller.inputFields.SMTPPort.label}}</label> @@ -118,6 +120,39 @@ {{view Em.TextField valueBinding="controller.inputFields.SMTPPort.value" class="input-xlarge"}} </div> </div> + + <div class="control-group"> + <label class="control-label" for="inputUseAuthentication">{{controller.inputFields.SMTPUseAuthentication.label}}</label> + + <div class="controls"> + {{view Em.Checkbox checkedBinding="controller.inputFields.SMTPUseAuthentication.value" id="inputUseAuthentication" class="input-xlarge"}} + </div> + </div> + + <div class="control-group"> + <label class="control-label">{{controller.inputFields.SMTPUsername.label}}</label> + + <div class="controls"> + {{view Em.TextField disabledBinding="controller.inputFields.SMTPUseAuthentication.inversedValue" valueBinding="controller.inputFields.SMTPUsername.value" class="input-xlarge"}} + </div> + </div> + + <div class="control-group"> + <label class="control-label">{{controller.inputFields.SMTPPassword.label}}</label> + + <div class="controls"> + {{view Em.TextField disabledBinding="controller.inputFields.SMTPUseAuthentication.inversedValue" valueBinding="controller.inputFields.SMTPPassword.value" class="input-xlarge"}} + </div> + </div> + + <div class="control-group"> + <label class="control-label" for="inputSMTPSTARTTLS">{{controller.inputFields.SMTPSTARTTLS.label}}</label> + + <div class="controls"> + {{view Em.Checkbox disabledBinding="controller.inputFields.SMTPUseAuthentication.inversedValue" checkedBinding="controller.inputFields.SMTPSTARTTLS.value" id="inputSMTPSTARTTLS" class="input-xlarge"}} + </div> + </div> + <div class="control-group"> <label class="control-label">{{controller.inputFields.emailFrom.label}}</label> @@ -133,6 +168,7 @@ {{view Em.Select selectionBinding="controller.inputFields.version.value" contentBinding="controller.SNMPVersions" class="input-xlarge"}} </div> </div> + <div class="control-group"> <label class="control-label">{{controller.inputFields.OIDs.label}}</label> @@ -140,6 +176,7 @@ {{view Em.TextField valueBinding="controller.inputFields.OIDs.value" class="input-xlarge"}} </div> </div> + <div class="control-group"> <label class="control-label">{{controller.inputFields.community.label}}</label> @@ -147,6 +184,7 @@ {{view Em.TextField valueBinding="controller.inputFields.community.value" class="input-xlarge"}} </div> </div> + <div class="control-group"> <label class="control-label">{{controller.inputFields.port.label}}</label> http://git-wip-us.apache.org/repos/asf/ambari/blob/96b7f56f/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 f40f515..6410546 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 @@ -180,7 +180,14 @@ describe('App.ManageAlertNotificationsController', function () { 'te...@test.test', 'te...@test.test' ], - 'customName': 'customValue' + 'customName': 'customValue', + "mail.smtp.from" : "from", + "ambari.dispatch.credential.username" : "user", + "mail.smtp.host" : "s1", + "mail.smtp.port" : "25", + "mail.smtp.auth" : "true", + "ambari.dispatch.credential.password" : "pass", + "mail.smtp.starttls.enable" : "true" } })); @@ -212,6 +219,18 @@ describe('App.ManageAlertNotificationsController', function () { SMTPPort: { value: '' }, + SMTPUseAuthentication: { + value: '' + }, + SMTPUsername: { + value: '' + }, + SMTPPassword: { + value: '' + }, + SMTPSTARTTLS: { + value: '' + }, emailFrom: { value: '' }, @@ -258,9 +277,27 @@ describe('App.ManageAlertNotificationsController', function () { description: { value: 'test_description' }, - SMTPServer: {}, - SMTPPort: {}, - emailFrom: {}, + SMTPServer: { + value: 's1' + }, + SMTPPort: { + value: '25' + }, + SMTPUseAuthentication: { + value: "true" + }, + SMTPUsername: { + value: 'user' + }, + SMTPPassword: { + value: 'pass' + }, + SMTPSTARTTLS: { + value: "true" + }, + emailFrom: { + value: 'from' + }, version: {}, OIDs: {}, community: {}, @@ -371,6 +408,27 @@ describe('App.ManageAlertNotificationsController', function () { severityFilter: { value: ['OK', 'CRITICAL'] }, + SMTPServer: { + value: 's1' + }, + SMTPPort: { + value: '25' + }, + SMTPUseAuthentication: { + value: "true" + }, + SMTPUsername: { + value: 'user' + }, + SMTPPassword: { + value: 'pass' + }, + SMTPSTARTTLS: { + value: "true" + }, + emailFrom: { + value: 'from' + }, description: { value: 'test_description' }, @@ -400,6 +458,13 @@ describe('App.ManageAlertNotificationsController', function () { 'te...@test.test', 'te...@test.test' ], + "mail.smtp.host" : "s1", + "mail.smtp.port" : "25", + "mail.smtp.from" : "from", + "mail.smtp.auth" : "true", + "ambari.dispatch.credential.username" : "user", + "ambari.dispatch.credential.password" : "pass", + "mail.smtp.starttls.enable" : "true", 'n1': 'v1', 'n2': 'v2' }, @@ -655,4 +720,4 @@ describe('App.ManageAlertNotificationsController', function () { }); -}); \ No newline at end of file +});