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

Switch to New APIs for Front-End #3507

Merged
merged 4 commits into from
Mar 31, 2022

Conversation

rajadain
Copy link
Member

@rajadain rajadain commented Mar 30, 2022

Overview

Switch the front-end to use the new public APIs.

Connects #3475

Demo

image

Notes

There's still a few endpoints left, will address them in a future PR.

Testing Instructions

  • Check out this branch and bundle.sh --debug
  • Choose a HUC-8 or HUC-10 shape in the Eastern US
  • Open the Network tab of Developer Tools
  • Run the Watershed Multi-Year model, and from the Water Quality tab, run Subbasin modeling
  • Observe the requests in the Network tab
    • Ensure they go to the /api/modeling/ endpoints

We've used the taskHelper to override many of the taskModel's
attributes. Now, we come across a situation where the taskName
needs to be overridden. Previously we used the same endpoint to
retrieve Mapshed and Subbasin results, with the difference
marked via query parameter. Now we use separate endpoints. Thus,
the taskHelper needs to override the taskModel's URL. Hence
this overridability is added.
We switch them to have the taskType of 'api' since they'll
now request /api/ rather than /mmw/ URLs. The taskNames are
now specific to each model, as now they are all different
endpoints than before.
While a form encoded payload still technically works, we switch
to using a JSON payload for consistency. Also update some keys
for the new API. Also override the task URL for subbasin runs.
This endpoint uses a separate mechanism than the rest due
to a Celery group, so had been missed. This brings it in
line with the standard job response of the other endpoints.
@rajadain rajadain added the DRWI Funding Source: Delaware River Watershed Initiative label Mar 30, 2022
Base automatically changed from tt/add-support-for-modifications-hashes to develop March 30, 2022 20:45
Copy link
Contributor

@emilyhu0106 emilyhu0106 left a comment

Choose a reason for hiding this comment

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

The implementation is great! Glad to see all the pieces coming together. I encountered the same SRAT issue when I run subbasin results on HUCs in California, but things works well in the Delaware River region. I'm wondering if it is better to include something like a tooltip to inform the users that getting subbasin attenuated results is for certain regions only?

@rajadain rajadain merged commit 917b5c0 into develop Mar 31, 2022
@rajadain rajadain deleted the tt/switch-mmw-front-end-to-public-api branch March 31, 2022 14:34
@rajadain
Copy link
Member Author

Thanks for reviewing! I did mention the non-California support and we are working on getting those in.

@emilyhu0106 emilyhu0106 assigned rajadain and unassigned emilyhu0106 Apr 6, 2022
@rajadain rajadain mentioned this pull request Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DRWI Funding Source: Delaware River Watershed Initiative
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants