1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Adding labels for notifications on related tabs

for notification type column
This commit is contained in:
Jared Tabor 2016-06-21 12:30:02 -07:00
parent e72f371a1e
commit 205963a7ce

View File

@ -14,8 +14,8 @@
*
*/
export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest',
function(Wait, GetBasePath, ProcessErrors, Rest) {
export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices',
function(Wait, GetBasePath, ProcessErrors, Rest, GetChoices) {
return function(params) {
var scope = params.scope,
url = params.url,
@ -27,6 +27,14 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest',
scope.relatednotificationsRemove = scope.$on('relatednotifications', function () {
var columns = ['/notification_templates_success/', '/notification_templates_error/'];
GetChoices({
scope: scope,
url: GetBasePath('notifications'),
field: 'notification_type',
variable: 'notification_type_options',
callback: 'choicesReadyNotifierList'
});
_.map(columns, function(column){
var notifier_url = url + id + column;
Rest.setUrl(notifier_url);
@ -52,6 +60,21 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest',
});
});
if (scope.removeChoicesHere) {
scope.removeChoicesHere();
}
scope.removeChoicesHere = scope.$on('choicesReadyNotifierList', function () {
if (scope.notifications) {
scope.notifications.forEach(function(notification, i) {
scope.notification_type_options.forEach(function(type) {
if (type.value === notification.notification_type) {
scope.notifications[i].notification_type = type.label;
}
});
});
}
});
});
};
}];