diff --git a/awx/ui/client/src/helpers.js b/awx/ui/client/src/helpers.js index 94acbd1382..fdd0c9eab3 100644 --- a/awx/ui/client/src/helpers.js +++ b/awx/ui/client/src/helpers.js @@ -21,7 +21,6 @@ import JobTemplates from "./helpers/JobTemplates"; import Jobs from "./helpers/Jobs"; import License from "./helpers/License"; import LoadConfig from "./helpers/LoadConfig"; -import StandardOut from "./helpers/StandardOut"; import Lookup from "./helpers/Lookup"; import PaginationHelpers from "./helpers/PaginationHelpers"; import Parse from "./helpers/Parse"; @@ -59,7 +58,6 @@ export Jobs, License, LoadConfig, - StandardOut, Lookup, PaginationHelpers, Parse, diff --git a/awx/ui/client/src/helpers/StandardOut.js b/awx/ui/client/src/helpers/StandardOut.js deleted file mode 100644 index a739bef764..0000000000 --- a/awx/ui/client/src/helpers/StandardOut.js +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************* - * Copyright (c) 2016 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name helpers.function:StandardOut - * @description Helpers for the standard out views -*/ - -export default - angular.module('StandardOutHelper', []) - - .factory('LookUpName', ['Rest', 'ProcessErrors', 'Empty', function(Rest, ProcessErrors, Empty) { - return function(params) { - var url = params.url, - scope_var = params.scope_var, - scope = params.scope; - Rest.setUrl(url); - Rest.get() - .success(function(data) { - if (scope_var === 'inventory_source') { - scope[scope_var + '_name'] = data.summary_fields.group.name; - } - else if (!Empty(data.name)) { - scope[scope_var + '_name'] = data.name; - } - if (!Empty(data.group)) { - // Used for inventory_source - scope.group = data.group; - } - }) - .error(function(data, status) { - ProcessErrors(scope, data, status, null, { hdr: 'Error!', - msg: 'Failed to retrieve ' + url + '. GET returned: ' + status }); - }); - }; - }]) diff --git a/awx/ui/client/src/standard-out/main.js b/awx/ui/client/src/standard-out/main.js index e8a0946e82..b0aafe40ad 100644 --- a/awx/ui/client/src/standard-out/main.js +++ b/awx/ui/client/src/standard-out/main.js @@ -9,8 +9,9 @@ import stdoutManagementJobsRoute from './management-jobs/standard-out-management import stdoutInventorySyncRoute from './inventory-sync/standard-out-inventory-sync.route'; import stdoutScmUpdateRoute from './scm-update/standard-out-scm-update.route'; import {JobStdoutController} from './standard-out.controller'; +import StandardOutHelper from './standard-out-factories/main'; -export default angular.module('standardOut', []) +export default angular.module('standardOut', [StandardOutHelper.name]) .controller('JobStdoutController', JobStdoutController) .run(['$stateExtender', function($stateExtender) { $stateExtender.addState(stdoutAdhocRoute); diff --git a/awx/ui/client/src/standard-out/standard-out-factories/lookup-name.factory.js b/awx/ui/client/src/standard-out/standard-out-factories/lookup-name.factory.js new file mode 100644 index 0000000000..f097a945be --- /dev/null +++ b/awx/ui/client/src/standard-out/standard-out-factories/lookup-name.factory.js @@ -0,0 +1,32 @@ +/************************************************* + * Copyright (c) 2016 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + + export default + ['Rest', 'ProcessErrors', 'Empty', function(Rest, ProcessErrors, Empty) { + return function(params) { + var url = params.url, + scope_var = params.scope_var, + scope = params.scope; + Rest.setUrl(url); + Rest.get() + .success(function(data) { + if (scope_var === 'inventory_source') { + scope[scope_var + '_name'] = data.summary_fields.group.name; + } + else if (!Empty(data.name)) { + scope[scope_var + '_name'] = data.name; + } + if (!Empty(data.group)) { + // Used for inventory_source + scope.group = data.group; + } + }) + .error(function(data, status) { + ProcessErrors(scope, data, status, null, { hdr: 'Error!', + msg: 'Failed to retrieve ' + url + '. GET returned: ' + status }); + }); + }; + }]; diff --git a/awx/ui/client/src/standard-out/standard-out-factories/main.js b/awx/ui/client/src/standard-out/standard-out-factories/main.js new file mode 100644 index 0000000000..fdded8ab31 --- /dev/null +++ b/awx/ui/client/src/standard-out/standard-out-factories/main.js @@ -0,0 +1,11 @@ +/************************************************* + * Copyright (c) 2016 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + +import lookUpName from './lookup-name.factory'; + +export default + angular.module('StandardOutHelper', []) + .factory('LookUpName', lookUpName);