openclimatefix / quartz-frontend

Front End repo for the Nowcasting project.
https://openclimatefix.org/projects/nowcasting/
MIT License
101 stars 16 forks source link

Add UI tag to routes #387

Closed okjake closed 1 year ago

okjake commented 1 year ago

👋 hi all, Robert Monarch's Coursera course brought me here. I'm hoping I can make myself useful 🙂

Pull Request

Description

Adds a URL param to identify requests coming directly from the web app

Fixes https://github.com/openclimatefix/nowcasting/issues/373 - lmk if I misunderstood the intention here!

How Has This Been Tested?

I ran the web app and API locally and checked that the param was propagated and persisted to Postgres in some test queries. Example:

postgres=# select * from (select distinct on (url, email) * from api_request join "user" on user_uuid = "user".uuid where url like '%national/forecast%' and email not like '%openclimatefix%' order by url, email, created_utc desc) as anon_1 where created_utc > '2023-06-20' order by created_utc desc;

                 uuid                 |                                               url                                               |              user_uuid               |          created_utc          |                 uuid                 |  email
--------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------------------+-------------------------------+--------------------------------------+---------
 b7d9dc1c-32f7-4fb9-be6d-f69b1478c2e1 | http://localhost:8000/v0/solar/GB/national/forecast?historic=false&only_forecast_values=true&UI | 4ad2d486-51b8-44d3-bfea-1adcdc225a4b | 2023-07-22 17:59:22.880993+00 | 4ad2d486-51b8-44d3-bfea-1adcdc225a4b | unknown
 (1 row)

Checklist:

vercel[bot] commented 1 year ago

@okjake is attempting to deploy a commit to the Open Climate Fix Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nowcasting-app ✅ Ready (Inspect) Visit Preview ✅ 3 resolved Aug 17, 2023 9:36am
nowcasting-website 🛑 Canceled (Inspect) Aug 17, 2023 9:36am
peterdudfield commented 1 year ago

Thanks for this @okjake , @braddf would you be able to resovle conflicts and get this merged?

peterdudfield commented 1 year ago

Thanks for this @okjake , @braddf would you be able to resovle conflicts and get this merged?

or @okjake do you fancy resolving the conflicts? thanks

peterdudfield commented 1 year ago

thanks @okjake for doing this!!!