From b1fff38243077195574316f9173f15a41c953312 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 22 Jun 2016 13:14:58 -0700 Subject: [PATCH 1/4] Inserting ADD NOTIFICATION TEMPLATE button for tabs with notification templates --- .../notifications/notificationTemplates.list.js | 6 ++++-- .../client/src/notifications/notifications.list.js | 14 ++++++++++++++ .../shared/notification-list-init.factory.js | 7 ++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/src/notifications/notificationTemplates.list.js b/awx/ui/client/src/notifications/notificationTemplates.list.js index a19795946c..7f3780f959 100644 --- a/awx/ui/client/src/notifications/notificationTemplates.list.js +++ b/awx/ui/client/src/notifications/notificationTemplates.list.js @@ -3,8 +3,10 @@ * * All Rights Reserved *************************************************/ - - + /** + * This is the list definition for the notification templates list + * off of the settings page + */ export default function(){ return { diff --git a/awx/ui/client/src/notifications/notifications.list.js b/awx/ui/client/src/notifications/notifications.list.js index a9514f3071..553d125656 100644 --- a/awx/ui/client/src/notifications/notifications.list.js +++ b/awx/ui/client/src/notifications/notifications.list.js @@ -3,6 +3,10 @@ * * All Rights Reserved *************************************************/ + /** + * This is the list definition for the notification templates list + * used in the related tabs + */ export default function(){ return { @@ -53,6 +57,16 @@ export default function(){ searchable: false, nosort: true, } + }, + actions: { + add: { + label: 'Add Notification', + mode: 'all', // One of: edit, select, all + ngClick: 'addNotificationTemplate()', + awToolTip: 'Create a new notification template', + actionClass: 'btn List-buttonSubmit', + buttonContent: '+ ADD NOTIFICATION TEMPLATE' + } } }; diff --git a/awx/ui/client/src/notifications/shared/notification-list-init.factory.js b/awx/ui/client/src/notifications/shared/notification-list-init.factory.js index fa072c701c..fec995dd70 100644 --- a/awx/ui/client/src/notifications/shared/notification-list-init.factory.js +++ b/awx/ui/client/src/notifications/shared/notification-list-init.factory.js @@ -15,12 +15,17 @@ */ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices', - function(Wait, GetBasePath, ProcessErrors, Rest, GetChoices) { + '$state', + function(Wait, GetBasePath, ProcessErrors, Rest, GetChoices, $state) { return function(params) { var scope = params.scope, url = params.url, id = params.id; + scope.addNotificationTemplate = function(){ + $state.go('notifications.add'); + } + if (scope.relatednotificationsRemove) { scope.relatednotificationsRemove(); } From c075aafd50c555e7e4576d550c0b00a2046d1fa3 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 22 Jun 2016 13:16:59 -0700 Subject: [PATCH 2/4] JSHint --- .../src/notifications/shared/notification-list-init.factory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui/client/src/notifications/shared/notification-list-init.factory.js b/awx/ui/client/src/notifications/shared/notification-list-init.factory.js index fec995dd70..ba13bea4c9 100644 --- a/awx/ui/client/src/notifications/shared/notification-list-init.factory.js +++ b/awx/ui/client/src/notifications/shared/notification-list-init.factory.js @@ -24,7 +24,7 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest', 'GetChoices', scope.addNotificationTemplate = function(){ $state.go('notifications.add'); - } + }; if (scope.relatednotificationsRemove) { scope.relatednotificationsRemove(); From 3e9b86e02451b7c4c1a701e71c9da628cd3b93fc Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 22 Jun 2016 13:24:08 -0700 Subject: [PATCH 3/4] Fix breadcrumb for notification templates page It didn't include the Settings crumb first --- .../notifications/notification-templates-list/list.route.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/src/notifications/notification-templates-list/list.route.js b/awx/ui/client/src/notifications/notification-templates-list/list.route.js index de322316dc..61ea204e95 100644 --- a/awx/ui/client/src/notifications/notification-templates-list/list.route.js +++ b/awx/ui/client/src/notifications/notification-templates-list/list.route.js @@ -10,5 +10,9 @@ export default { name: 'notifications', route: '/notification_templates', templateUrl: templateUrl('notifications/notification-templates-list/list'), - controller: 'notificationTemplatesListController' + controller: 'notificationTemplatesListController', + ncyBreadcrumb: { + parent: 'setup', + label: 'NOTIFICATION TEMPLATES' + }, }; From a26a4326ba1784f2393e6cfce9728fb1ea772f55 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 22 Jun 2016 13:41:50 -0700 Subject: [PATCH 4/4] Fixing add notificaiton template button for mgmt jobs --- .../notifications/notification.controller.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/src/management-jobs/notifications/notification.controller.js b/awx/ui/client/src/management-jobs/notifications/notification.controller.js index 0fed968d24..68bbfa7baa 100644 --- a/awx/ui/client/src/management-jobs/notifications/notification.controller.js +++ b/awx/ui/client/src/management-jobs/notifications/notification.controller.js @@ -19,11 +19,24 @@ export default var scope = $rootScope.$new(), url = GetBasePath('notification_templates'), defaultUrl = GetBasePath('system_job_templates'), - list = NotificationsList, + list, view = GenerateList, id = $stateParams.management_id; + list = _.cloneDeep(NotificationsList); + delete list.actions.add; list.listTitle = `${management_job.name}
Notifications`; + list.searchSize = "col-lg-12 col-md-12 col-sm-12 col-xs-12"; + list.searchRowActions = { + add: { + label: 'Add Notification', + mode: 'all', // One of: edit, select, all + ngClick: 'addNotificationTemplate()', + awToolTip: 'Create a new notification template', + actionClass: 'btn List-buttonSubmit', + buttonContent: '+ ADD NOTIFICATION TEMPLATE' + } + }; view.inject( list, { mode: 'edit', cancelButton: true,