From 29f1d695ae6b3aa523b3c8ed351c3c5552b78995 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Tue, 5 Dec 2017 17:08:19 -0500 Subject: [PATCH] add NotificationTemplate model --- .../client/lib/models/NotificationTemplate.js | 21 +++++++++++++++++++ awx/ui/client/lib/models/index.js | 2 ++ .../list.controller.js | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 awx/ui/client/lib/models/NotificationTemplate.js diff --git a/awx/ui/client/lib/models/NotificationTemplate.js b/awx/ui/client/lib/models/NotificationTemplate.js new file mode 100644 index 0000000000..6418a7184d --- /dev/null +++ b/awx/ui/client/lib/models/NotificationTemplate.js @@ -0,0 +1,21 @@ +let Base; + +function NotificationTemplateModel (method, resource, config) { + Base.call(this, 'notification_templates'); + + this.Constructor = NotificationTemplateModel; + + return this.create(method, resource, config); +} + +function NotificationTemplateModelLoader (BaseModel) { + Base = BaseModel; + + return NotificationTemplateModel; +} + +NotificationTemplateModelLoader.$inject = [ + 'BaseModel' +]; + +export default NotificationTemplateModelLoader; diff --git a/awx/ui/client/lib/models/index.js b/awx/ui/client/lib/models/index.js index 4185bb0d71..950d0d2c73 100644 --- a/awx/ui/client/lib/models/index.js +++ b/awx/ui/client/lib/models/index.js @@ -13,6 +13,7 @@ import Job from '~models/Job'; import JobTemplate from '~models/JobTemplate'; import Me from '~models/Me'; import ModelsStrings from '~models/models.strings'; +import NotificationTemplate from '~models/NotificationTemplate'; import Organization from '~models/Organization'; import Project from '~models/Project'; import UnifiedJobTemplate from '~models/UnifiedJobTemplate'; @@ -39,6 +40,7 @@ angular .service('JobTemplateModel', JobTemplate) .service('MeModel', Me) .service('ModelsStrings', ModelsStrings) + .service('NotificationTemplate', NotificationTemplate) .service('OrganizationModel', Organization) .service('ProjectModel', Project) .service('UnifiedJobTemplateModel', UnifiedJobTemplate) diff --git a/awx/ui/client/src/notifications/notification-templates-list/list.controller.js b/awx/ui/client/src/notifications/notification-templates-list/list.controller.js index 6c3eb4b5bf..3e64db1412 100644 --- a/awx/ui/client/src/notifications/notification-templates-list/list.controller.js +++ b/awx/ui/client/src/notifications/notification-templates-list/list.controller.js @@ -7,7 +7,7 @@ export default ['$scope', 'Wait', 'NotificationTemplatesList', 'GetBasePath', 'Rest', 'ProcessErrors', 'Prompt', '$state', 'ngToast', '$filter', 'Dataset', 'rbacUiControlService', - 'i18n', + 'i18n', 'NotificationTemplateModel', function( $scope, Wait, NotificationTemplatesList, GetBasePath, Rest, ProcessErrors, Prompt, $state,