mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
change custom notification message from checkbox to toggle
This commit is contained in:
parent
1470fa61d5
commit
56f04e0153
@ -24,6 +24,7 @@ export default ['Rest', 'Wait', 'NotificationsFormObject',
|
||||
init();
|
||||
|
||||
function init() {
|
||||
$scope.customize_messages = false;
|
||||
Rest.setUrl(GetBasePath('notification_templates'));
|
||||
Rest.options()
|
||||
.then(({data}) => {
|
||||
@ -164,6 +165,9 @@ export default ['Rest', 'Wait', 'NotificationsFormObject',
|
||||
});
|
||||
}
|
||||
});
|
||||
$scope.toggleForm = function(key) {
|
||||
$scope[key] = !$scope[key];
|
||||
};
|
||||
$scope.$watch('notification_type', (value) => {
|
||||
if (value) {
|
||||
$scope.$broadcast('reset-code-mirror', {
|
||||
|
||||
@ -254,6 +254,9 @@ export default ['Rest', 'Wait',
|
||||
});
|
||||
}
|
||||
});
|
||||
$scope.toggleForm = function(key) {
|
||||
$scope[key] = !$scope[key];
|
||||
};
|
||||
$scope.$watch('notification_type', (value) => {
|
||||
if (value) {
|
||||
$scope.$broadcast('reset-code-mirror', {
|
||||
|
||||
@ -584,9 +584,9 @@ export default ['i18n', function(i18n) {
|
||||
},
|
||||
customize_messages: {
|
||||
label: i18n._('Customize messages…'),
|
||||
type: 'checkbox',
|
||||
type: 'toggleSwitch',
|
||||
toggleSource: 'customize_messages',
|
||||
class: 'Form-formGroup--fullWidth',
|
||||
default: false,
|
||||
ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)',
|
||||
},
|
||||
custom_message_description: {
|
||||
|
||||
@ -35,32 +35,32 @@ export default [function () {
|
||||
if (!messages) {
|
||||
return;
|
||||
}
|
||||
let customized = false;
|
||||
let isCustomized = false;
|
||||
if (messages.started.message) {
|
||||
customized = true;
|
||||
isCustomized = true;
|
||||
$scope.started_message = messages.started.message;
|
||||
}
|
||||
if (messages.started.body) {
|
||||
customized = true;
|
||||
isCustomized = true;
|
||||
$scope.started_body = messages.started.body;
|
||||
}
|
||||
if (messages.success.message) {
|
||||
customized = true;
|
||||
isCustomized = true;
|
||||
$scope.success_message = messages.success.message;
|
||||
}
|
||||
if (messages.success.body) {
|
||||
customized = true;
|
||||
isCustomized = true;
|
||||
$scope.success_body = messages.success.body;
|
||||
}
|
||||
if (messages.error.message) {
|
||||
customized = true;
|
||||
isCustomized = true;
|
||||
$scope.error_message = messages.error.message;
|
||||
}
|
||||
if (messages.error.body) {
|
||||
customized = true;
|
||||
isCustomized = true;
|
||||
$scope.error_body = messages.error.body;
|
||||
}
|
||||
$scope.customize_messages = customized;
|
||||
$scope.customize_messages = isCustomized;
|
||||
}
|
||||
};
|
||||
}];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user