mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-27 02:11:48 -05:00
Rename ansibleworks to awx.
This commit is contained in:
37
awx/ui/static/js/helpers/ProjectPath.js
Normal file
37
awx/ui/static/js/helpers/ProjectPath.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/*********************************************
|
||||
* Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
*
|
||||
* ProjectPathHelper
|
||||
*
|
||||
* Use GetProjectPath({ scope: <scope>, master: <master obj> }) to
|
||||
* load scope.project_local_paths (array of options for drop-down) and
|
||||
* scope.base_dir (readonly field).
|
||||
*
|
||||
*/
|
||||
|
||||
angular.module('ProjectPathHelper', ['RestServices', 'Utilities'])
|
||||
.factory('GetProjectPath', ['Alert', 'Rest', 'GetBasePath','ProcessErrors',
|
||||
function(Alert, Rest, GetBasePath, ProcessErrors) {
|
||||
return function(params) {
|
||||
|
||||
var scope = params.scope;
|
||||
var master = params.master;
|
||||
|
||||
Rest.setUrl( GetBasePath('config') );
|
||||
Rest.get()
|
||||
.success( function(data, status, headers, config) {
|
||||
var opts = [];
|
||||
for (var i=0; i < data.project_local_paths.length; i++) {
|
||||
opts.push(data.project_local_paths[i]);
|
||||
}
|
||||
scope.project_local_paths = opts;
|
||||
scope.base_dir = data.project_base_dir;
|
||||
master.base_dir = scope.base_dir; // Keep in master object so that it doesn't get
|
||||
// wiped out on form reset.
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, null,
|
||||
{ hdr: 'Error!', msg: 'Failed to access API config. GET status: ' + status });
|
||||
});
|
||||
}
|
||||
}]);
|
||||
Reference in New Issue
Block a user