Project base path now displayed on Project detail page. Project path (the subdir under base path) is now selected from a drop-down. Using /api/v1/config to determine base path and drop-down values. Added help text pop-overs that should eliminate confussion around how to setup project directory structure.

This commit is contained in:
chouseknecht
2013-06-21 13:36:31 -04:00
parent d5705ffdd0
commit 5495709a61
6 changed files with 80 additions and 13 deletions

View 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 });
});
}
}]);