mirror of
https://github.com/ansible/awx.git
synced 2026-02-20 12:40:06 -03:30
Moved the LookUpName factory out into the standard out directory. Removed the StandardOut helper.
This commit is contained in:
@@ -21,7 +21,6 @@ import JobTemplates from "./helpers/JobTemplates";
|
|||||||
import Jobs from "./helpers/Jobs";
|
import Jobs from "./helpers/Jobs";
|
||||||
import License from "./helpers/License";
|
import License from "./helpers/License";
|
||||||
import LoadConfig from "./helpers/LoadConfig";
|
import LoadConfig from "./helpers/LoadConfig";
|
||||||
import StandardOut from "./helpers/StandardOut";
|
|
||||||
import Lookup from "./helpers/Lookup";
|
import Lookup from "./helpers/Lookup";
|
||||||
import PaginationHelpers from "./helpers/PaginationHelpers";
|
import PaginationHelpers from "./helpers/PaginationHelpers";
|
||||||
import Parse from "./helpers/Parse";
|
import Parse from "./helpers/Parse";
|
||||||
@@ -59,7 +58,6 @@ export
|
|||||||
Jobs,
|
Jobs,
|
||||||
License,
|
License,
|
||||||
LoadConfig,
|
LoadConfig,
|
||||||
StandardOut,
|
|
||||||
Lookup,
|
Lookup,
|
||||||
PaginationHelpers,
|
PaginationHelpers,
|
||||||
Parse,
|
Parse,
|
||||||
|
|||||||
@@ -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 });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}])
|
|
||||||
@@ -9,8 +9,9 @@ import stdoutManagementJobsRoute from './management-jobs/standard-out-management
|
|||||||
import stdoutInventorySyncRoute from './inventory-sync/standard-out-inventory-sync.route';
|
import stdoutInventorySyncRoute from './inventory-sync/standard-out-inventory-sync.route';
|
||||||
import stdoutScmUpdateRoute from './scm-update/standard-out-scm-update.route';
|
import stdoutScmUpdateRoute from './scm-update/standard-out-scm-update.route';
|
||||||
import {JobStdoutController} from './standard-out.controller';
|
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)
|
.controller('JobStdoutController', JobStdoutController)
|
||||||
.run(['$stateExtender', function($stateExtender) {
|
.run(['$stateExtender', function($stateExtender) {
|
||||||
$stateExtender.addState(stdoutAdhocRoute);
|
$stateExtender.addState(stdoutAdhocRoute);
|
||||||
|
|||||||
@@ -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 });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}];
|
||||||
@@ -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);
|
||||||
Reference in New Issue
Block a user