From c0f01e671b2a80352aff4f3b0874027ef084885c Mon Sep 17 00:00:00 2001 From: Marliana Lara Date: Thu, 27 Jul 2017 15:31:39 -0400 Subject: [PATCH] Fix UX items related to Notifications --- awx/ui/client/src/app.js | 3 ++- .../src/notifications/add/add.controller.js | 12 ++++++++++ .../src/notifications/edit/edit.controller.js | 14 +++++++++++- .../notificationTemplates.form.js | 2 +- .../notifications/notifications.block.less | 22 +++++++++++++++++++ awx/ui/client/src/shared/form-generator.js | 1 + 6 files changed, 51 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 8d3c38e6e7..520c9bf7e1 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -151,7 +151,8 @@ var awApp = angular.module('awApp', [ .config(['ngToastProvider', function(ngToastProvider) { ngToastProvider.configure({ animation: 'slide', - dismissOnTimeout: true, + dismissOnTimeout: false, + dismissButton: true, timeout: 4000 }); }]) diff --git a/awx/ui/client/src/notifications/add/add.controller.js b/awx/ui/client/src/notifications/add/add.controller.js index 03592cc48f..57d02a66f7 100644 --- a/awx/ui/client/src/notifications/add/add.controller.js +++ b/awx/ui/client/src/notifications/add/add.controller.js @@ -134,10 +134,22 @@ export default ['Rest', 'Wait', 'NotificationsFormObject', $scope.emailOptionsChange = function () { if ($scope.email_options === 'use_ssl') { + if ($scope.use_ssl) { + $scope.email_options = null; + $scope.use_ssl = false; + return; + } + $scope.use_ssl = true; $scope.use_tls = false; } else if ($scope.email_options === 'use_tls') { + if ($scope.use_tls) { + $scope.email_options = null; + $scope.use_tls = false; + return; + } + $scope.use_ssl = false; $scope.use_tls = true; } diff --git a/awx/ui/client/src/notifications/edit/edit.controller.js b/awx/ui/client/src/notifications/edit/edit.controller.js index 79f23b23ea..5b49665d84 100644 --- a/awx/ui/client/src/notifications/edit/edit.controller.js +++ b/awx/ui/client/src/notifications/edit/edit.controller.js @@ -205,10 +205,22 @@ export default ['Rest', 'Wait', $scope.emailOptionsChange = function () { if ($scope.email_options === 'use_ssl') { + if ($scope.use_ssl) { + $scope.email_options = null; + $scope.use_ssl = false; + return; + } + $scope.use_ssl = true; $scope.use_tls = false; } else if ($scope.email_options === 'use_tls') { + if ($scope.use_tls) { + $scope.email_options = null; + $scope.use_tls = false; + return; + } + $scope.use_ssl = false; $scope.use_tls = true; } @@ -263,7 +275,7 @@ export default ['Rest', 'Wait', Rest.setUrl(url + id + '/'); Rest.put(params) .success(function() { - $state.go($state.current, null, { reload: true }); + $state.go('notifications', {}, { reload: true }); Wait('stop'); }) .error(function(data, status) { diff --git a/awx/ui/client/src/notifications/notificationTemplates.form.js b/awx/ui/client/src/notifications/notificationTemplates.form.js index dcec05ad78..eaf79f3c9d 100644 --- a/awx/ui/client/src/notifications/notificationTemplates.form.js +++ b/awx/ui/client/src/notifications/notificationTemplates.form.js @@ -398,7 +398,7 @@ export default ['i18n', function(i18n) { type: 'radio_group', subForm: 'typeSubForm', ngShow: "notification_type.value == 'email'", - ngChange: "emailOptionsChange()", + ngClick: "emailOptionsChange()", ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', options: [{ value: 'use_tls', diff --git a/awx/ui/client/src/notifications/notifications.block.less b/awx/ui/client/src/notifications/notifications.block.less index 27ad2bbc56..cfa5104524 100644 --- a/awx/ui/client/src/notifications/notifications.block.less +++ b/awx/ui/client/src/notifications/notifications.block.less @@ -25,3 +25,25 @@ .NotificationsForm-radioButtons{ display:block!important; } + +#notification_templates_table .name-column { + padding-left: 10px; +} + +.notificationsList { + margin-top: 0; +} + +.ng-toast { + .alert { + margin: 0; + } + .close { + position: absolute; + right: 5px; + top: 0px; + color: white; + opacity: 1; + text-shadow: none; + } +} \ No newline at end of file diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index 771af06646..b332dc0f27 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -1287,6 +1287,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat html += "value=\"" + field.options[i].value + "\" "; html += "ng-model=\"" + fld + "\" "; html += (field.ngChange) ? this.attr(field, 'ngChange') : ""; + html += (field.ngClick) ? this.attr(field, 'ngClick') : ""; html += (field.ngDisabled) ? `ng-disabled="${field.ngDisabled}"` : ""; html += (field.readonly) ? "disabled " : ""; html += (field.required) ? "required " : "";