mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 03:17:39 -02:30
Merge pull request #4735 from jaredevantabor/ssl-tls-radios
Notification Templates -> email "Use TLS/Use SSL" should be radio buttons
This commit is contained in:
@@ -115,6 +115,17 @@ export default ['$rootScope', 'Rest', 'Wait', 'NotificationsFormObject',
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.emailOptionsChange = function () {
|
||||||
|
if ($scope.email_options === 'use_ssl') {
|
||||||
|
$scope.use_ssl = true;
|
||||||
|
$scope.use_tls = false;
|
||||||
|
}
|
||||||
|
else if ($scope.email_options === 'use_tls') {
|
||||||
|
$scope.use_ssl = false;
|
||||||
|
$scope.use_tls = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
$scope.formSave = function() {
|
$scope.formSave = function() {
|
||||||
var params,
|
var params,
|
||||||
@@ -143,7 +154,7 @@ export default ['$rootScope', 'Rest', 'Wait', 'NotificationsFormObject',
|
|||||||
if (field.type === 'number') {
|
if (field.type === 'number') {
|
||||||
$scope[i] = Number($scope[i]);
|
$scope[i] = Number($scope[i]);
|
||||||
}
|
}
|
||||||
if (field.name === "username" && $scope.notification_type.value === "email" && value === null) {
|
if (i === "username" && $scope.notification_type.value === "email" && value === null) {
|
||||||
$scope[i] = "";
|
$scope[i] = "";
|
||||||
}
|
}
|
||||||
if (field.type === 'sensitive' && value === null) {
|
if (field.type === 'sensitive' && value === null) {
|
||||||
@@ -156,13 +167,13 @@ export default ['$rootScope', 'Rest', 'Wait', 'NotificationsFormObject',
|
|||||||
.filter(i => (form.fields[i].ngShow && form.fields[i].ngShow.indexOf(v) > -1))
|
.filter(i => (form.fields[i].ngShow && form.fields[i].ngShow.indexOf(v) > -1))
|
||||||
.map(i => [i, processValue($scope[i], i, form.fields[i])]));
|
.map(i => [i, processValue($scope[i], i, form.fields[i])]));
|
||||||
|
|
||||||
delete params.notification_configuration.checkbox_group;
|
delete params.notification_configuration.email_options;
|
||||||
|
|
||||||
for (var j = 0; j < form.fields.checkbox_group.fields.length; j++) {
|
for(var j = 0; j < form.fields.email_options.options.length; j++) {
|
||||||
if (form.fields.checkbox_group.fields[j].ngShow && form.fields.checkbox_group.fields[j].ngShow.indexOf(v) > -1) {
|
if(form.fields.email_options.options[j].ngShow && form.fields.email_options.options[j].ngShow.indexOf(v) > -1) {
|
||||||
params.notification_configuration[form.fields.checkbox_group.fields[j].name] = Boolean($scope[form.fields.checkbox_group.fields[j].name]);
|
params.notification_configuration[form.fields.email_options.options[j].value] = Boolean($scope[form.fields.email_options.options[j].value]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
|
|||||||
@@ -67,15 +67,25 @@ export default ['Rest', 'Wait',
|
|||||||
master[fld] = data[fld];
|
master[fld] = data[fld];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (form.fields[fld].type === 'checkbox_group') {
|
if(form.fields[fld].type === 'radio_group') {
|
||||||
// Loop across the group and put the child data on scope
|
if(data.notification_configuration.use_ssl === true){
|
||||||
for (var j = 0; j < form.fields[fld].fields.length; j++) {
|
$scope.email_options = "use_ssl";
|
||||||
if (data.notification_configuration[form.fields[fld].fields[j].name]) {
|
master.email_options = "use_ssl";
|
||||||
$scope[form.fields[fld].fields[j].name] = data.notification_configuration[form.fields[fld].fields[j].name];
|
$scope.use_ssl = true;
|
||||||
master[form.fields[fld].fields[j].name] = data.notification_configuration[form.fields[fld].fields[j].name];
|
master.use_ssl = true;
|
||||||
}
|
$scope.use_tls = false;
|
||||||
|
master.use_tls = false;
|
||||||
}
|
}
|
||||||
} else {
|
if(data.notification_configuration.use_tls === true){
|
||||||
|
$scope.email_options = "use_tls";
|
||||||
|
master.email_options = "use_tls";
|
||||||
|
$scope.use_ssl = false;
|
||||||
|
master.use_ssl = false;
|
||||||
|
$scope.use_tls = true;
|
||||||
|
master.use_tls = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (data.notification_configuration[fld]) {
|
if (data.notification_configuration[fld]) {
|
||||||
$scope[fld] = data.notification_configuration[fld];
|
$scope[fld] = data.notification_configuration[fld];
|
||||||
master[fld] = data.notification_configuration[fld];
|
master[fld] = data.notification_configuration[fld];
|
||||||
@@ -193,6 +203,17 @@ export default ['Rest', 'Wait',
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.emailOptionsChange = function () {
|
||||||
|
if ($scope.email_options === 'use_ssl') {
|
||||||
|
$scope.use_ssl = true;
|
||||||
|
$scope.use_tls = false;
|
||||||
|
}
|
||||||
|
else if ($scope.email_options === 'use_tls') {
|
||||||
|
$scope.use_ssl = false;
|
||||||
|
$scope.use_tls = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$scope.formSave = function() {
|
$scope.formSave = function() {
|
||||||
var params,
|
var params,
|
||||||
v = $scope.notification_type.value;
|
v = $scope.notification_type.value;
|
||||||
@@ -220,10 +241,10 @@ export default ['Rest', 'Wait',
|
|||||||
if (field.type === 'number') {
|
if (field.type === 'number') {
|
||||||
$scope[i] = Number($scope[i]);
|
$scope[i] = Number($scope[i]);
|
||||||
}
|
}
|
||||||
if (field.name === "username" && $scope.notification_type.value === "email" && value === null) {
|
if (i === "username" && $scope.notification_type.value === "email" && (value === null || value === undefined)) {
|
||||||
$scope[i] = "";
|
$scope[i] = "";
|
||||||
}
|
}
|
||||||
if (field.type === 'sensitive' && value === null) {
|
if (field.type === 'sensitive' && (value === null || value === undefined)) {
|
||||||
$scope[i] = "";
|
$scope[i] = "";
|
||||||
}
|
}
|
||||||
return $scope[i];
|
return $scope[i];
|
||||||
@@ -233,13 +254,10 @@ export default ['Rest', 'Wait',
|
|||||||
.filter(i => (form.fields[i].ngShow && form.fields[i].ngShow.indexOf(v) > -1))
|
.filter(i => (form.fields[i].ngShow && form.fields[i].ngShow.indexOf(v) > -1))
|
||||||
.map(i => [i, processValue($scope[i], i, form.fields[i])]));
|
.map(i => [i, processValue($scope[i], i, form.fields[i])]));
|
||||||
|
|
||||||
delete params.notification_configuration.checkbox_group;
|
delete params.notification_configuration.email_options;
|
||||||
|
|
||||||
for (var j = 0; j < form.fields.checkbox_group.fields.length; j++) {
|
params.notification_configuration.use_ssl = Boolean($scope.use_ssl);
|
||||||
if (form.fields.checkbox_group.fields[j].ngShow && form.fields.checkbox_group.fields[j].ngShow.indexOf(v) > -1) {
|
params.notification_configuration.use_tls = Boolean($scope.use_tls);
|
||||||
params.notification_configuration[form.fields.checkbox_group.fields[j].name] = Boolean($scope[form.fields.checkbox_group.fields[j].name]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(url + id + '/');
|
Rest.setUrl(url + id + '/');
|
||||||
|
|||||||
@@ -388,25 +388,23 @@ export default ['i18n', function(i18n) {
|
|||||||
subForm: 'typeSubForm',
|
subForm: 'typeSubForm',
|
||||||
ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)'
|
ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)'
|
||||||
},
|
},
|
||||||
checkbox_group: {
|
email_options: {
|
||||||
label: i18n._('Options'),
|
label: 'Options',
|
||||||
type: 'checkbox_group',
|
type: 'radio_group',
|
||||||
subForm: 'typeSubForm',
|
subForm: 'typeSubForm',
|
||||||
ngShow: "notification_type.value == 'email'",
|
ngShow: "notification_type.value == 'email'",
|
||||||
fields: [{
|
class: 'squeeze',
|
||||||
name: 'use_tls',
|
ngChange: "emailOptionsChange()",
|
||||||
label: i18n._('Use TLS'),
|
options: [{
|
||||||
type: 'checkbox',
|
value: 'use_tls',
|
||||||
|
label: 'Use TLS',
|
||||||
ngShow: "notification_type.value == 'email' ",
|
ngShow: "notification_type.value == 'email' ",
|
||||||
labelClass: 'checkbox-options stack-inline',
|
labelClass: 'checkbox-options stack-inline'
|
||||||
ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)'
|
|
||||||
}, {
|
}, {
|
||||||
name: 'use_ssl',
|
value: 'use_ssl',
|
||||||
label: i18n._('Use SSL'),
|
label: 'Use SSL',
|
||||||
type: 'checkbox',
|
|
||||||
ngShow: "notification_type.value == 'email'",
|
ngShow: "notification_type.value == 'email'",
|
||||||
labelClass: 'checkbox-options stack-inline',
|
labelClass: 'checkbox-options stack-inline'
|
||||||
ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)'
|
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user