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

Prevent project generation if api failure #1627

Merged
merged 3 commits into from
Jul 8, 2024

Conversation

spwoodcock
Copy link
Member

@spwoodcock spwoodcock commented Jul 4, 2024

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation
  • πŸ§‘β€πŸ’» Refactor
  • βœ… Test
  • πŸ€– Build or CI
  • ❓ Other (please specify)

Describe this PR

  • Currently if there is a failure with of the 4 project creation APIs, the creation will continue, and redirect.
  • Instead it should halt creation and display an error to the user.
  • I did some refactors here @NSUWAL123 to use a state variables: generateProjectError and generateProjectSuccess.
  • If generateProjectSuccess is set to true, then the watcher in SplitTasks.tsx will display a success message and do the redirect.
  • If generateProjectError is set at any stage, then the remaining project creation stages should stop - I didn't get to implement this, could you take a look please?
  • It might be a good idea to add the project creation and data extract upload to separate services, for consistency.

Review Guide

Notes for the reviewer. How to test this change?

Checklist before requesting a review

[optional] What gif best describes this PR or how it makes you feel?

@NSUWAL123
Copy link
Collaborator

@spwoodcock, what approach can we take in this scenario:
there are 4 api's called on project creation. Say that if the 1st API (/create-project) is successful but the second API fails and we halt the project creation. Though it seems that the project creation step is halted, a project is created.

image
Here, only the first API is called and the project is created. Should we call delete project API if there's error on project creation displaying error or only display error?

@spwoodcock
Copy link
Member Author

I think that's a very good idea πŸ‘

Call delete project so the user can try again

@github-actions github-actions bot added docs Improvements or additions to documentation backend Related to backend code devops Related to deployment or configuration ODK Any requests for optimizing ODK migration Contains a DB migration labels Jul 8, 2024
spwoodcock and others added 2 commits July 8, 2024 13:00
* fix(hotfix): download of basemaps in ui, max zoom level 22 used for tms

* ci: update all gh-workflows to latest v1.6.0

* build: upgrade rclone --> v1 pin to avoid CVE-2024-24790

* build: remove unnecessary tables and field from db schema (#1623)

* build: remove unnecessary tables via migration & simplify schema

* refactor: remove references to removed tables in sqlalchemy models

* build: add IF EXISTS to DROP COLUMN in migration

* build: remove default columns from previous migration

* fix(backend): minor fixes to HTTPException on endpoints

* fix(backend): addded created date on the project response, set expiry of access token to 1 hour (#1633)

* docs: add placeholder for axiom repo activity

* fix(createProjectSlice): set generateProject & drawToggle status to default

* feat(commonUtils): isStatusSuccess function add

* test: get the detailed task history for a project (#1626)

* build(backend): add async-lru dep, remove cpuinfo dep

* fix: replace lru_cache with async for getting odk creds

* fix(splitTasks): dependency add to useEffect

* fix(createProjectService): halt project creation if api failure

---------

Co-authored-by: spwoodcock <sam.woodcock@protonmail.com>
Co-authored-by: Sam <78538841+spwoodcock@users.noreply.github.com>
Co-authored-by: Sujan Adhikari <109404840+Sujanadh@users.noreply.github.com>
Co-authored-by: Azhar Ismagulova <31756707+azharcodeit@users.noreply.github.com>
@github-actions github-actions bot removed docs Improvements or additions to documentation backend Related to backend code devops Related to deployment or configuration ODK Any requests for optimizing ODK migration Contains a DB migration labels Jul 8, 2024
@spwoodcock spwoodcock requested a review from NSUWAL123 July 8, 2024 12:01
@spwoodcock spwoodcock marked this pull request as ready for review July 8, 2024 12:01
@spwoodcock
Copy link
Member Author

I merged the other PR then rebased this to development.

It should only include the edits made πŸ™

@github-actions github-actions bot added the devops Related to deployment or configuration label Jul 8, 2024
@spwoodcock
Copy link
Member Author

Working nicely for me! Great job Nishit πŸŽ‰

@spwoodcock spwoodcock merged commit 4db96ea into development Jul 8, 2024
4 checks passed
@spwoodcock spwoodcock deleted the fix/stop-proj-generation branch July 8, 2024 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops Related to deployment or configuration frontend Related to frontend code
Projects
Development

Successfully merging this pull request may close these issues.

2 participants