mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 06:17:36 -02:30
Merge pull request #2765 from jaredevantabor/fix-2748
Improves error handling of applications page form
This commit is contained in:
@@ -12,7 +12,15 @@ const listTemplate = require('~features/applications/list-applications.view.html
|
|||||||
const indexTemplate = require('~features/applications/index.view.html');
|
const indexTemplate = require('~features/applications/index.view.html');
|
||||||
const userListTemplate = require('~features/applications/list-applications-users.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 id = $stateParams.application_id;
|
||||||
|
|
||||||
const promises = {
|
const promises = {
|
||||||
@@ -42,6 +50,13 @@ function ApplicationsDetailResolve ($q, $stateParams, Me, Application, Organizat
|
|||||||
|
|
||||||
return models;
|
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',
|
'$stateParams',
|
||||||
'MeModel',
|
'MeModel',
|
||||||
'ApplicationModel',
|
'ApplicationModel',
|
||||||
'OrganizationModel'
|
'OrganizationModel',
|
||||||
|
'ProcessErrors',
|
||||||
|
'ApplicationsStrings'
|
||||||
];
|
];
|
||||||
|
|
||||||
function ApplicationsRun ($stateExtender, strings) {
|
function ApplicationsRun ($stateExtender, strings) {
|
||||||
|
|||||||
@@ -114,6 +114,12 @@ function AtFormController (eventService, strings) {
|
|||||||
|
|
||||||
if (typeof err.data === 'object') {
|
if (typeof err.data === 'object') {
|
||||||
message = JSON.stringify(err.data);
|
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 {
|
} else {
|
||||||
message = err.data;
|
message = err.data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user