mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
Changes to notifications after API naming change
The API changed the /notifier endpoint to /noticiation_templates to match up with the terminology used with the UI
This commit is contained in:
parent
3170c1b8b8
commit
b974422c6e
@ -312,7 +312,7 @@ export default
|
||||
return {
|
||||
notifications: {
|
||||
iterator: 'notification',
|
||||
url: 'api/v1/notifiers/'
|
||||
url: 'api/v1/notification_templates/'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ export default
|
||||
},
|
||||
notifications: {
|
||||
iterator: 'notification',
|
||||
url: '/api/v1/notifiers/'
|
||||
url: '/api/v1/notification_templates/'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ export default
|
||||
},
|
||||
notifications: {
|
||||
iterator: 'notification',
|
||||
url: '/api/v1/notifiers/'
|
||||
url: '/api/v1/notification_templates/'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
|
||||
},
|
||||
notifications: {
|
||||
iterator: 'notification',
|
||||
url: '/api/v1/notifiers/'
|
||||
url: '/api/v1/notification_templates/'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export default
|
||||
$compile, $filter, ToggleNotification, NotificationsListInit,
|
||||
$stateParams, management_job) {
|
||||
var scope = $rootScope.$new(),
|
||||
url = GetBasePath('notifiers'),
|
||||
url = GetBasePath('notification_templates'),
|
||||
defaultUrl = GetBasePath('system_job_templates'),
|
||||
list = NotificationsList,
|
||||
view = GenerateList,
|
||||
|
@ -19,7 +19,7 @@ export default
|
||||
) {
|
||||
var generator = GenerateForm,
|
||||
form = NotificationsFormObject,
|
||||
url = GetBasePath('notifiers');
|
||||
url = GetBasePath('notification_templates');
|
||||
|
||||
generator.inject(form, {
|
||||
mode: 'add' ,
|
||||
@ -40,7 +40,7 @@ export default
|
||||
}
|
||||
}
|
||||
CreateSelect2({
|
||||
element: '#notifier_notification_type',
|
||||
element: '#notification_template_notification_type',
|
||||
multiple: false
|
||||
});
|
||||
});
|
||||
@ -66,7 +66,7 @@ export default
|
||||
for(var fld in form.fields){
|
||||
if(form.fields[fld] && form.fields[fld].subForm){
|
||||
$scope[fld] = null;
|
||||
$scope.notifier_form[fld].$setPristine();
|
||||
$scope.notification_template_form[fld].$setPristine();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,6 @@ export default {
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
parent: 'notifications',
|
||||
label: 'Create Notifier'
|
||||
label: 'Create Notification Template'
|
||||
}
|
||||
};
|
||||
|
@ -8,24 +8,24 @@ export default
|
||||
[ 'Rest', 'Wait',
|
||||
'NotificationsFormObject', 'ProcessErrors', 'GetBasePath',
|
||||
'GenerateForm', 'SearchInit' , 'PaginateInit',
|
||||
'LookUpInit', 'OrganizationList', 'notifier',
|
||||
'LookUpInit', 'OrganizationList', 'notification_template',
|
||||
'$scope', '$state', 'GetChoices', 'CreateSelect2', 'Empty',
|
||||
'$rootScope', 'NotificationsTypeChange',
|
||||
function(
|
||||
Rest, Wait,
|
||||
NotificationsFormObject, ProcessErrors, GetBasePath,
|
||||
GenerateForm, SearchInit, PaginateInit,
|
||||
LookUpInit, OrganizationList, notifier,
|
||||
LookUpInit, OrganizationList, notification_template,
|
||||
$scope, $state, GetChoices, CreateSelect2, Empty,
|
||||
$rootScope, NotificationsTypeChange
|
||||
) {
|
||||
var generator = GenerateForm,
|
||||
id = notifier.id,
|
||||
id = notification_template.id,
|
||||
form = NotificationsFormObject,
|
||||
master = {},
|
||||
url = GetBasePath('notifiers');
|
||||
url = GetBasePath('notification_templates');
|
||||
|
||||
$scope.notifier = notifier;
|
||||
$scope.notification_template = notification_template;
|
||||
generator.inject(form, {
|
||||
mode: 'edit' ,
|
||||
scope:$scope,
|
||||
@ -81,7 +81,7 @@ export default
|
||||
|
||||
master.notification_type = $scope.notification_type;
|
||||
CreateSelect2({
|
||||
element: '#notifier_notification_type',
|
||||
element: '#notification_template_notification_typex',
|
||||
multiple: false
|
||||
});
|
||||
NotificationsTypeChange.getDetailFields($scope.notification_type.value).forEach(function(field) {
|
||||
@ -115,7 +115,7 @@ export default
|
||||
for(var fld in form.fields){
|
||||
if(form.fields[fld] && form.fields[fld].subForm){
|
||||
$scope[fld] = null;
|
||||
$scope.notifier_form[fld].$setPristine();
|
||||
$scope.notification_template_form[fld].$setPristine();
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ export default
|
||||
})
|
||||
.error(function (data, status) {
|
||||
ProcessErrors($scope, data, status, form, { hdr: 'Error!',
|
||||
msg: 'Failed to add new notifier. POST returned status: ' + status });
|
||||
msg: 'Failed to add new notification template. POST returned status: ' + status });
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -8,11 +8,11 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
|
||||
export default {
|
||||
name: 'notifications.edit',
|
||||
route: '/:notifier_id',
|
||||
route: '/:notification_template_id',
|
||||
templateUrl: templateUrl('notifications/edit/edit'),
|
||||
controller: 'notificationsEditController',
|
||||
resolve: {
|
||||
notifier:
|
||||
notification_template:
|
||||
[ '$state',
|
||||
'$stateParams',
|
||||
'$q',
|
||||
@ -20,13 +20,13 @@ export default {
|
||||
'GetBasePath',
|
||||
'ProcessErrors',
|
||||
function($state, $stateParams, $q, rest, getBasePath, ProcessErrors) {
|
||||
if ($stateParams.notifier) {
|
||||
return $q.when($stateParams.notifier);
|
||||
if ($stateParams.notification_template) {
|
||||
return $q.when($stateParams.notification_template);
|
||||
}
|
||||
|
||||
var notifierId = $stateParams.notifier_id;
|
||||
var notificationTemplateId = $stateParams.notification_template_id;
|
||||
|
||||
var url = getBasePath('notifiers') + notifierId + '/';
|
||||
var url = getBasePath('notification_templates') + notificationTemplateId + '/';
|
||||
rest.setUrl(url);
|
||||
return rest.get()
|
||||
.then(function(data) {
|
||||
@ -43,6 +43,6 @@ export default {
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
parent: 'notifications',
|
||||
label: 'Edit Notifier'
|
||||
label: 'Edit Notification Template'
|
||||
}
|
||||
};
|
||||
|
@ -15,7 +15,7 @@ export default
|
||||
ProcessErrors, Prompt, $state, GetChoices, Empty, Find, ngToast,
|
||||
$compile, $filter) {
|
||||
var scope = $rootScope.$new(),
|
||||
defaultUrl = GetBasePath('notifiers'),
|
||||
defaultUrl = GetBasePath('notification_templates'),
|
||||
list = NotificationTemplatesList,
|
||||
view = GenerateList;
|
||||
|
||||
@ -30,12 +30,12 @@ export default
|
||||
}
|
||||
scope.removePostRefresh = scope.$on('PostRefresh', function () {
|
||||
Wait('stop');
|
||||
if (scope.notifiers) {
|
||||
scope.notifiers.forEach(function(notifier, i) {
|
||||
if (scope.notification_templates) {
|
||||
scope.notification_templates.forEach(function(notification_template, i) {
|
||||
scope.notification_type_options.forEach(function(type) {
|
||||
if (type.value === notifier.notification_type) {
|
||||
scope.notifiers[i].notification_type = type.label;
|
||||
scope.notifiers[i].status = notifier.summary_fields.recent_notifications[0].status;
|
||||
if (type.value === notification_template.notification_type) {
|
||||
scope.notification_templates[i].notification_type = type.label;
|
||||
scope.notification_templates[i].status = notification_template.summary_fields.recent_notifications[0].status;
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -50,7 +50,7 @@ export default
|
||||
|
||||
SearchInit({
|
||||
scope: scope,
|
||||
set: 'notifiers',
|
||||
set: 'notification_templates',
|
||||
list: list,
|
||||
url: defaultUrl
|
||||
});
|
||||
@ -117,9 +117,9 @@ export default
|
||||
var recent_notifications,
|
||||
html, title = "Recent Notifications";
|
||||
|
||||
scope.notifiers.forEach(function(notifier){
|
||||
if(notifier.id === id){
|
||||
recent_notifications = notifier.summary_fields.recent_notifications;
|
||||
scope.notification_templates.forEach(function(notification_template){
|
||||
if(notification_template.id === id){
|
||||
recent_notifications = notification_template.summary_fields.recent_notifications;
|
||||
}
|
||||
});
|
||||
Wait('stop');
|
||||
@ -150,8 +150,8 @@ export default
|
||||
};
|
||||
|
||||
scope.testNotification = function(){
|
||||
var name = this.notifier.name;
|
||||
Rest.setUrl(defaultUrl + this.notifier.id +'/test/');
|
||||
var name = this.notification_template.name;
|
||||
Rest.setUrl(defaultUrl + this.notification_template.id +'/test/');
|
||||
Rest.post({})
|
||||
.then(function () {
|
||||
ngToast.success({
|
||||
@ -172,8 +172,8 @@ export default
|
||||
|
||||
scope.editNotification = function(){
|
||||
$state.transitionTo('notifications.edit',{
|
||||
notifier_id: this.notifier.id,
|
||||
notifier: this.notifier
|
||||
notification_template_id: this.notification_template.id,
|
||||
notification_template: this.notification_templates
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,7 @@ export default function() {
|
||||
|
||||
addTitle: 'New Notification Template',
|
||||
editTitle: '{{ name }}',
|
||||
name: 'notifier',
|
||||
name: 'notification_template',
|
||||
showActions: true,
|
||||
subFormTitles: {
|
||||
typeSubForm: 'Type Details',
|
||||
|
@ -8,9 +8,9 @@
|
||||
|
||||
export default function(){
|
||||
return {
|
||||
name: 'notifiers' ,
|
||||
name: 'notification_templates' ,
|
||||
listTitle: 'Notification Templates',
|
||||
iterator: 'notifier',
|
||||
iterator: 'notification_template',
|
||||
index: false,
|
||||
hover: false,
|
||||
|
||||
@ -24,10 +24,10 @@ export default function(){
|
||||
iconOnly: true,
|
||||
excludeModal: true,
|
||||
icons: [{
|
||||
icon: "{{ 'icon-job-' + notifier.status }}",
|
||||
icon: "{{ 'icon-job-' + notification_template.status }}",
|
||||
awToolTip: "Click for recent notifications",
|
||||
awTipPlacement: "right",
|
||||
ngClick: "showSummary($event, notifier.id)",
|
||||
ngClick: "showSummary($event, notification_templates.id)",
|
||||
ngClass: ""
|
||||
}]
|
||||
},
|
||||
@ -35,7 +35,7 @@ export default function(){
|
||||
key: true,
|
||||
label: 'Name',
|
||||
columnClass: 'col-md-3 col-sm-9 col-xs-9',
|
||||
linkTo: '/#/notifications/{{notifier.id}}'
|
||||
linkTo: '/#/notifications/{{notification_template.id}}'
|
||||
},
|
||||
notification_type: {
|
||||
label: 'Type',
|
||||
@ -60,7 +60,7 @@ export default function(){
|
||||
|
||||
columnClass: 'col-md-2 col-sm-3 col-xs-3',
|
||||
test: {
|
||||
ngClick: "testNotification(notification.id)",
|
||||
ngClick: "testNotification(notification_template.id)",
|
||||
icon: 'fa-bell-o',
|
||||
label: 'Edit',
|
||||
"class": 'btn-sm',
|
||||
@ -68,7 +68,7 @@ export default function(){
|
||||
dataPlacement: 'top'
|
||||
},
|
||||
edit: {
|
||||
ngClick: "editNotification(notification.id)",
|
||||
ngClick: "editNotification(notification_template.id)",
|
||||
icon: 'fa-edit',
|
||||
label: 'Edit',
|
||||
"class": 'btn-sm',
|
||||
@ -76,7 +76,7 @@ export default function(){
|
||||
dataPlacement: 'top'
|
||||
},
|
||||
"delete": {
|
||||
ngClick: "deleteNotification(notifier.id, notifier.name)",
|
||||
ngClick: "deleteNotification(notification_template.id, notification_template.name)",
|
||||
icon: 'fa-trash',
|
||||
label: 'Delete',
|
||||
"class": 'btn-sm',
|
||||
|
@ -26,23 +26,23 @@ export default function(){
|
||||
excludeModal: true,
|
||||
columnClass: 'col-md-4 hidden-sm hidden-xs'
|
||||
},
|
||||
notifiers_success: {
|
||||
notification_templates_success: {
|
||||
label: 'Successful',
|
||||
flag: 'notifiers_success',
|
||||
flag: 'notification_templates_success',
|
||||
type: "toggle",
|
||||
ngClick: "toggleNotification($event, notification.id, \"notifiers_success\")",
|
||||
ngClick: "toggleNotification($event, notification.id, \"notification_templates_success\")",
|
||||
awToolTip: "{{ schedule.play_tip }}",
|
||||
dataTipWatch: "schedule.play_tip",
|
||||
dataPlacement: "right",
|
||||
searchable: false,
|
||||
nosort: true,
|
||||
},
|
||||
notifiers_error: {
|
||||
notification_templates_error: {
|
||||
label: 'Failed',
|
||||
columnClass: 'NotifierList-lastColumn',
|
||||
flag: 'notifiers_error',
|
||||
flag: 'notification_templates_error',
|
||||
type: "toggle",
|
||||
ngClick: "toggleNotification($event, notification.id, \"notifiers_error\")",
|
||||
ngClick: "toggleNotification($event, notification.id, \"notification_templates_error\")",
|
||||
awToolTip: "{{ schedule.play_tip }}",
|
||||
dataTipWatch: "schedule.play_tip",
|
||||
dataPlacement: "right",
|
||||
|
@ -25,14 +25,14 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest',
|
||||
scope.relatednotificationsRemove();
|
||||
}
|
||||
scope.relatednotificationsRemove = scope.$on('relatednotifications', function () {
|
||||
var columns = ['/notifiers_success/', '/notifiers_error/'];
|
||||
var columns = ['/notification_templates_success/', '/notification_templates_error/'];
|
||||
|
||||
_.map(columns, function(column){
|
||||
var notifier_url = url + id + column;
|
||||
Rest.setUrl(notifier_url);
|
||||
Rest.get()
|
||||
.success( function(data, i, j, obj) {
|
||||
var type = (obj.url.indexOf('success')>0) ? "notifiers_success" : "notifiers_error";
|
||||
var type = (obj.url.indexOf('success')>0) ? "notification_templates_success" : "notification_templates_error";
|
||||
if (data.results) {
|
||||
_.forEach(data.results, function(result){
|
||||
_.forEach(scope.notifications, function(notification){
|
||||
|
@ -22,7 +22,7 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest',
|
||||
id = params.id,
|
||||
notifier_id = params.notifier.id,
|
||||
callback = params.callback,
|
||||
column = params.column, // notifiers_success/notifiers_error
|
||||
column = params.column, // notification_template_success/notification_template__error
|
||||
url = params.url+ id+ "/"+ column + '/';
|
||||
|
||||
if(!notifier[column]){
|
||||
|
Loading…
Reference in New Issue
Block a user