mirror of
https://github.com/ansible/awx.git
synced 2026-01-21 14:38:00 -03:30
Merge pull request #2765 from jaredevantabor/fix-2748
Improves error handling of applications page form
This commit is contained in:
commit
d1f37ad1af
@ -12,7 +12,15 @@ const listTemplate = require('~features/applications/list-applications.view.html
|
||||
const indexTemplate = require('~features/applications/index.view.html');
|
||||
const userListTemplate = require('~features/applications/list-applications-users.view.html');
|
||||
|
||||
function ApplicationsDetailResolve ($q, $stateParams, Me, Application, Organization) {
|
||||
function ApplicationsDetailResolve (
|
||||
$q,
|
||||
$stateParams,
|
||||
Me,
|
||||
Application,
|
||||
Organization,
|
||||
ProcessErrors,
|
||||
strings
|
||||
) {
|
||||
const id = $stateParams.application_id;
|
||||
|
||||
const promises = {
|
||||
@ -42,6 +50,13 @@ function ApplicationsDetailResolve ($q, $stateParams, Me, Application, Organizat
|
||||
|
||||
return models;
|
||||
});
|
||||
})
|
||||
.catch(({ data, status, config }) => {
|
||||
ProcessErrors(null, data, status, null, {
|
||||
hdr: strings.get('error.HEADER'),
|
||||
msg: strings.get('error.CALL', { path: `${config.url}`, status })
|
||||
});
|
||||
return $q.reject();
|
||||
});
|
||||
}
|
||||
|
||||
@ -50,7 +65,9 @@ ApplicationsDetailResolve.$inject = [
|
||||
'$stateParams',
|
||||
'MeModel',
|
||||
'ApplicationModel',
|
||||
'OrganizationModel'
|
||||
'OrganizationModel',
|
||||
'ProcessErrors',
|
||||
'ApplicationsStrings'
|
||||
];
|
||||
|
||||
function ApplicationsRun ($stateExtender, strings) {
|
||||
|
||||
@ -114,6 +114,12 @@ function AtFormController (eventService, strings) {
|
||||
|
||||
if (typeof err.data === 'object') {
|
||||
message = JSON.stringify(err.data);
|
||||
} if (_.has(err, 'data.__all__')) {
|
||||
if (typeof err.data.__all__ === 'object' && Array.isArray(err.data.__all__)) {
|
||||
message = JSON.stringify(err.data.__all__[0]);
|
||||
} else {
|
||||
message = JSON.stringify(err.data.__all__);
|
||||
}
|
||||
} else {
|
||||
message = err.data;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user