New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIM-7915: Display a modal on deletion error #9315

Merged
merged 1 commit into from Jan 4, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+22 −13
Diff settings

Always

Just for now

@@ -2,7 +2,6 @@
namespace Akeneo\UserManagement\Bundle\Controller;
use Akeneo\Tool\Bundle\StorageUtilsBundle\Doctrine\Common\Remover\BaseRemover;
use Akeneo\UserManagement\Component\Model\Group;
use Akeneo\UserManagement\Component\UserEvents;
use Oro\Bundle\SecurityBundle\Annotation\AclAncestor;
@@ -59,7 +58,12 @@ public function deleteAction(Request $request, $id)
}
$remover = $this->get('pim_user.remover.user_group');
$remover->remove($group);
try {
$remover->remove($group);
} catch (\Exception $exception) {
return new JsonResponse(['message' => $exception->getMessage()], 500);
};
return new JsonResponse('', 204);
}
@@ -22,6 +22,7 @@ pim_title:
confirmation:
remove:
user: Are you sure you want to delete this user?
group: Are you sure you want to delete this group?

pim_enrich:
entity:
@@ -104,23 +104,27 @@ define([
* @return {oro.Modal}
*/
getErrorDialog: function(response) {
if (!this.errorModal) {
let message = '';
let message = '';

if (typeof response === 'string') {
message = response;
} else {
try {
message = JSON.parse(response).message;
} catch(e) {
message = __('pim_enrich.entity.' + this.getEntityHint() + '.flash.delete.fail');
}

this.errorModal = new Modal({
title: __('pim_datagrid.delete_error.title'),
content:
'' === message ?
__('pim_enrich.entity.' + this.getEntityHint() + '.flash.delete.fail'):
message,
cancelText: false
});
}

this.errorModal = new Modal({
title: __('pim_datagrid.delete_error.title'),
content:
'' === message ?
__('pim_enrich.entity.' + this.getEntityHint() + '.flash.delete.fail'):
message,
cancelText: false
});

return this.errorModal;
}
});
ProTip! Use n and p to navigate between commits in a pull request.