Merge pull request #1984 from anoek/1955

Show selected playbook in JT's even if you can't read the project
This commit is contained in:
Akita Noek
2016-05-20 13:33:47 -04:00

View File

@@ -78,6 +78,10 @@ export default
getPlaybooks = function (project) { getPlaybooks = function (project) {
var url; var url;
if ($scope.playbook) {
$scope.playbook_options = [$scope.playbook];
}
if($scope.job_type.value === 'scan' && $scope.project_name === "Default"){ if($scope.job_type.value === 'scan' && $scope.project_name === "Default"){
$scope.playbook_options = ['Default']; $scope.playbook_options = ['Default'];
$scope.playbook = 'Default'; $scope.playbook = 'Default';
@@ -103,10 +107,14 @@ export default
Wait('stop'); Wait('stop');
} }
}) })
.error(function () { .error(function (ret,status_code) {
if (status_code == 403) {
/* user doesn't have access to see the project, no big deal. */
} else {
Alert('Missing Playbooks', 'Unable to retrieve the list of playbooks for this project. Choose a different ' +
' project or make the playbooks available on the file system.', 'alert-info');
}
Wait('stop'); Wait('stop');
Alert('Missing Playbooks', 'Unable to retrieve the list of playbooks for this project. Choose a different ' +
' project or make the playbooks available on the file system.', 'alert-info');
}); });
} }
else { else {
@@ -190,8 +198,12 @@ export default
} }
}) })
.error(function (data, status) { .error(function (data, status) {
ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to get project ' + $scope.project + if (status == 403) {
'. GET returned status: ' + status }); /* User doesn't have read access to the project, no problem. */
} else {
ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to get project ' + $scope.project +
'. GET returned status: ' + status });
}
}); });
} }
}; };