feat: set OCF status via the Status API + tidy up the status page#443
Open
braddf wants to merge 3 commits into
Open
feat: set OCF status via the Status API + tidy up the status page#443braddf wants to merge 3 commits into
braddf wants to merge 3 commits into
Conversation
Hook the status page up to the Status API's authenticated PUT action
(PUT /products/{key}/status) instead of writing directly to the
nowcasting/pvsite databases. Current status is now read from
GET /products/{key} too, keyed on product (National->gb-solar,
Sites->asset-solar, NL->nl-solar). India keeps the legacy DB path until
it has a Status API product.
Auth: request the Status API audience so the logged-in user's Auth0 token
carries the read:admin permission, and stash the token in session_state
for the PUT. Config is read from env vars with a Streamlit-secrets
fallback, and AUTH0_DOMAIN is normalised to a bare host.
Took 3 hours 12 minutes
Took 39 minutes Took 12 minutes # Commit time for manual adjustment: # Took 4 minutes
Took 34 minutes
| f"**{status.get('name', product_name)}** :{colour}[{status.get('status')}]" | ||
| ) | ||
| with updated_col: | ||
| st.caption(f"Last updated {format_updated_at(status.get('updatedAt'))} UTC", text_alignment="right") |
Contributor
There was a problem hiding this comment.
nice, good to have the UTC in there
| db_url_sites = os.getenv("SITES_DB_URL", None) | ||
| national_or_sites = "Sites" | ||
|
|
||
| connection = SitesDatabaseConnection(url=db_url_sites, echo=True) |
Contributor
There was a problem hiding this comment.
yea, we can leave that for the moment, good idea
peterdudfield
approved these changes
Jul 22, 2026
peterdudfield
left a comment
Contributor
There was a problem hiding this comment.
Looks great, thanks for this
you might need to resolve conflicts on uv.lock, i smaller change i think went in from #444
Something not urgent / next time: If possible add a screen shot to the PR, then its really easy to see the layout of things, and all the nice improvements made
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes in this Pull Request
Hooks the status page up to the new Status API's authenticated PUT action instead of writing straight to the DB — and gives the page a bit of a tidy-up while I was in there.
Status API routes
read:adminpermission).gb-solar, Assets →asset-solar, NL →nl-solar.Page tidy-up
Warning
Needs the matching
status-apichange (permissions-based admin check) deployed to status-pro for the writes to authorise. This is in the Status Dev API already, just needs merging before deploying this side to prod, along with updating the API/UI to point at the respective Status API counterparts for their/statuschecks.Contributes to https://github.com/openclimatefix/client-private/issues/455
Contribution Checklist