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

Refactor: improve no data response #838

Merged
merged 2 commits into from
Jan 27, 2025

Conversation

Francisco2002
Copy link
Collaborator

@Francisco2002 Francisco2002 commented Jan 23, 2025

Improve the response for not found data

  • use status code 200 and return a error message
  • show the error message in the frontend

Close #784

@Francisco2002 Francisco2002 force-pushed the refactor/improve-no-data-response branch from a942a2e to 8451117 Compare January 23, 2025 18:36
Copy link
Collaborator

@MarceloRobert MarceloRobert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are changing some responses, I would add the changes of some messages to be clearer. Saying for example "Builds not found" for the builds of an issue makes it seem like an issue is supposed to have builds but they weren't found, which is not true. Saying "No builds found for this issue" doesn't imply anything, it just says that no builds were found.

backend/kernelCI_app/views/buildTestsView.py Outdated Show resolved Hide resolved
backend/kernelCI_app/views/issueDetailsBuildsView.py Outdated Show resolved Hide resolved
backend/kernelCI_app/views/issueDetailsTestsView.py Outdated Show resolved Hide resolved
backend/kernelCI_app/views/treeDetailsBootsView.py Outdated Show resolved Hide resolved
backend/kernelCI_app/views/treeDetailsBuildsView.py Outdated Show resolved Hide resolved
backend/kernelCI_app/views/treeDetailsTestsView.py Outdated Show resolved Hide resolved
backend/kernelCI_app/views/treeView.py Show resolved Hide resolved
dashboard/src/api/buildDetails.ts Outdated Show resolved Hide resolved
dashboard/src/api/buildDetails.ts Outdated Show resolved Hide resolved
dashboard/src/api/commonRequest.ts Outdated Show resolved Hide resolved
@Francisco2002 Francisco2002 force-pushed the refactor/improve-no-data-response branch from 8451117 to 413ae17 Compare January 24, 2025 14:38
- create type to response with error prop
- create function to throw a error message

Part of #784
@Francisco2002 Francisco2002 force-pushed the refactor/improve-no-data-response branch from 413ae17 to 8a8849d Compare January 24, 2025 16:59
@Francisco2002 Francisco2002 marked this pull request as ready for review January 24, 2025 17:03
@Francisco2002 Francisco2002 force-pushed the refactor/improve-no-data-response branch from 8a8849d to 2bd510f Compare January 24, 2025 19:37
Copy link
Collaborator

@MarceloRobert MarceloRobert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice changes. I just noticed that because of the thrown error there is a retry even if the status is 200, but this is the same as the current behavior so I'll approve

@Francisco2002
Copy link
Collaborator Author

Nice changes. I just noticed that because of the thrown error there is a retry even if the status is 200, but this is the same as the current behavior so I'll approve

Create a issue for that #841

- change the status code from 404 to 200 (OK)
- use makeRequest function to treat error from endpoint in the frontend
- show error message in SectionError component

Part of #784
@Francisco2002 Francisco2002 force-pushed the refactor/improve-no-data-response branch from 2bd510f to 6bbc998 Compare January 27, 2025 12:27
Copy link
Contributor

@murilx murilx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked well on my tests

@Francisco2002 Francisco2002 merged commit f7bd09b into main Jan 27, 2025
5 checks passed
@Francisco2002 Francisco2002 deleted the refactor/improve-no-data-response branch January 27, 2025 12:30
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

Successfully merging this pull request may close these issues.

Review 404 and replace with 200 and not found in endpoints
3 participants