Show manual project path when available

This commit is contained in:
mabashian
2019-03-21 10:45:16 -04:00
parent df11a7fd3d
commit b394766075
2 changed files with 5 additions and 18 deletions

View File

@@ -51,20 +51,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'ProjectsForm', 'Rest',
$scope.projectLoadedRemove(); $scope.projectLoadedRemove();
} }
$scope.projectLoadedRemove = $scope.$on('projectLoaded', function() { $scope.projectLoadedRemove = $scope.$on('projectLoaded', function() {
var opts = []; GetProjectPath({ scope: $scope, master: master });
if (Authorization.getUserInfo('is_superuser') === true) {
GetProjectPath({ scope: $scope, master: master });
} else {
opts.push({
label: $scope.local_path,
value: $scope.local_path
});
$scope.project_local_paths = opts;
$scope.local_path = $scope.project_local_paths[0];
$scope.base_dir = i18n._('You do not have access to view this property');
$scope.$emit('pathsReady');
}
$scope.pathRequired = ($scope.scm_type.value === 'manual') ? true : false; $scope.pathRequired = ($scope.scm_type.value === 'manual') ? true : false;
$scope.scmRequired = ($scope.scm_type.value !== 'manual') ? true : false; $scope.scmRequired = ($scope.scm_type.value !== 'manual') ? true : false;

View File

@@ -1,5 +1,5 @@
export default export default
function GetProjectPath(Alert, Rest, GetBasePath, ProcessErrors) { function GetProjectPath(i18n, Rest, GetBasePath, ProcessErrors) {
return function(params) { return function(params) {
var scope = params.scope, var scope = params.scope,
master = params.master; master = params.master;
@@ -53,7 +53,7 @@ export default
} }
} }
} }
scope.base_dir = data.project_base_dir; scope.base_dir = data.project_base_dir || i18n._('You do not have access to view this property');
master.local_path = scope.local_path; master.local_path = scope.local_path;
master.base_dir = scope.base_dir; // Keep in master object so that it doesn't get master.base_dir = scope.base_dir; // Keep in master object so that it doesn't get
// wiped out on form reset. // wiped out on form reset.
@@ -65,13 +65,13 @@ export default
}) })
.catch(({data, status}) => { .catch(({data, status}) => {
ProcessErrors(scope, data, status, null, { hdr: 'Error!', ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Failed to access API config. GET status: ' + status }); msg: i18n._('Failed to access API config. GET status: ') + status });
}); });
}; };
} }
GetProjectPath.$inject = GetProjectPath.$inject =
[ 'Alert', [ 'i18n',
'Rest', 'Rest',
'GetBasePath', 'GetBasePath',
'ProcessErrors' 'ProcessErrors'