mirror of
https://github.com/ansible/awx.git
synced 2026-05-24 17:17:45 -02:30
Show proper error message for missing job template form
when visiting the job template page for a job template that has been deleted or doesn't exist, we want to show the 404 error message, not an error message about tags or labels.
This commit is contained in:
@@ -448,7 +448,7 @@ export default
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if($state.params.id !== "null"){
|
||||
Rest.setUrl(defaultUrl + $state.params.id +
|
||||
"/labels");
|
||||
Rest.get()
|
||||
@@ -472,7 +472,16 @@ export default
|
||||
});
|
||||
Wait("stop");
|
||||
});
|
||||
}).error(function(){
|
||||
// job template id is null in this case
|
||||
$scope.$emit("choicesReady");
|
||||
});
|
||||
}
|
||||
else {
|
||||
// job template doesn't exist
|
||||
$scope.$emit("choicesReady");
|
||||
}
|
||||
|
||||
})
|
||||
.error(function (data, status) {
|
||||
ProcessErrors($scope, data, status, form, {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
export default ['$scope', 'Refresh', 'tagSearchService',
|
||||
function($scope, Refresh, tagSearchService) {
|
||||
export default ['$scope', 'Refresh', 'tagSearchService', '$stateParams',
|
||||
function($scope, Refresh, tagSearchService, $stateParams) {
|
||||
// JSONify passed field elements that can be searched
|
||||
$scope.list = angular.fromJson($scope.list);
|
||||
// Access config lines from list spec
|
||||
$scope.listConfig = $scope.$parent.list;
|
||||
// Grab options for the left-dropdown of the searchbar
|
||||
if($stateParams.id !== "null"){
|
||||
tagSearchService.getSearchTypes($scope.list, $scope.endpoint)
|
||||
.then(function(searchTypes) {
|
||||
$scope.searchTypes = searchTypes;
|
||||
@@ -12,6 +13,7 @@ export default ['$scope', 'Refresh', 'tagSearchService',
|
||||
// currently selected option of the left-dropdown
|
||||
$scope.currentSearchType = $scope.searchTypes[0];
|
||||
});
|
||||
}
|
||||
|
||||
// shows/hide the search type dropdown
|
||||
$scope.toggleTypeDropdown = function() {
|
||||
|
||||
@@ -84,7 +84,9 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', '$log', fu
|
||||
|
||||
if (needsRequest.length) {
|
||||
// make the options request to reutrn the typeOptions
|
||||
Rest.setUrl(needsRequest[0].basePath ? GetBasePath(needsRequest[0].basePath) : basePath);
|
||||
var url = needsRequest[0].basePath ? GetBasePath(needsRequest[0].basePath) : basePath;
|
||||
if(url.indexOf('null') === 0 ){
|
||||
Rest.setUrl(url);
|
||||
Rest.options()
|
||||
.success(function (data) {
|
||||
try {
|
||||
@@ -119,6 +121,8 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', '$log', fu
|
||||
hdr: 'Error!',
|
||||
msg: 'Getting type options failed'});
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
Wait("stop");
|
||||
defer.resolve(joinOptions());
|
||||
|
||||
Reference in New Issue
Block a user