1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Merge pull request #1632 from jaredevantabor/1507-error-message

fixes error handling with groups service, sources service
This commit is contained in:
Jared Tabor 2018-05-02 14:22:45 -07:00 committed by GitHub
commit 0715773987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View File

@ -49,10 +49,10 @@ export default ['$state', '$stateParams', '$scope', 'GroupForm',
};
GroupsService.post(group).then(res => {
if ($stateParams.group_id) {
if ($stateParams.group_id && _.has(res, 'data')) {
return GroupsService.associateGroup(res.data, $stateParams.group_id)
.then(() => $state.go('^', null, { reload: true }));
} else {
} else if(_.has(res, 'data.id')){
$state.go('^.edit', { group_id: res.data.id }, { reload: true });
}
});

View File

@ -45,10 +45,10 @@ export default ['$state', '$stateParams', '$scope', 'NestedGroupForm',
};
GroupsService.post(group).then(res => {
if ($stateParams.group_id) {
if ($stateParams.group_id && _.has(res, 'data')) {
return GroupsService.associateGroup(res.data, $stateParams.group_id)
.then(() => $state.go('^', null, { reload: true }));
} else {
} else if(_.has(res, 'data.id')){
$state.go('^.edit', { group_id: res.data.id }, { reload: true });
}
});

View File

@ -10,9 +10,9 @@ export default
url: function(){
return '';
},
error: function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + this.url + '. GET returned: ' + status });
error: function(data) {
ProcessErrors($rootScope, data.data, data.status, null, { hdr: 'Error!',
msg: 'Call to ' + this.url + '. GET returned: ' + data.status });
},
success: function(data){
return data;

View File

@ -10,9 +10,9 @@ export default
url: function(){
return '';
},
error: function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + this.url + '. GET returned: ' + status });
error: function(data) {
ProcessErrors($rootScope, data.data, data.status, null, { hdr: 'Error!',
msg: 'Call to ' + this.url + '. GET returned: ' + data.status });
},
success: function(data){
return data;