Skip to content
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

"400" error is ignored when deleting or bulk deleting items #1129

Closed
RichardBradley opened this issue Jun 16, 2016 · 4 comments
Closed

"400" error is ignored when deleting or bulk deleting items #1129

RichardBradley opened this issue Jun 16, 2016 · 4 comments

Comments

@RichardBradley
Copy link
Contributor

On the current version, if the REST backend rejects a "DELETE" request from ng-admin no error is displayed to the user.

There is code which appears to attempt to show an error, so I think this is a regression.
I don't see any tests (unit or e2e) for this functionality.

Repro steps:

Given an entity where the REST backend will return 400 "cannot delete due to xyz" for a "DELETE" request
When I view the "edit" page for that entity
And I click the "delete" button
And I click "Yes" to "are you sure?"
Then I should see an error banner including "cannot delete due to xyz"
 # but I see a success banner

Given an entity where the REST backend will return 400 "cannot delete due to xyz" for a "DELETE" request
When I view the "list" page for that entity tytpe
And I select that entity
And I click the "delete" button
And I click "Yes" to "are you sure?"
Then I should see an error banner including "cannot delete due to xyz"
 # but I see a success banner
@RichardBradley
Copy link
Contributor Author

There are three bugs at play here, I think:

  1. The code uses "|" where it should use "||" in a few places
  2. The code uses angular-translate wrong if a custom error message is used as the translate key, due to $translate on missing key does not return the key, but a failed promise angular-translate/angular-translate#1516
  3. The "batch" delete does not attempt to check the individual success / failure results, but only checks whether the batch request succeeded. So even if there is only 1 item in the batch, it will look like a success to ng-admin

@Phocea
Copy link
Contributor

Phocea commented Jun 17, 2016

Also related to #1059 #1036

@RichardBradley
Copy link
Contributor Author

Thanks, yes, looks like a duplicate of those two. I've commented there.

@jpetitcolas
Copy link
Contributor

Closing as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants