Conversation
Documentation build overview
Show files changed (17 files in total): 📝 15 modified | ➕ 2 added | ➖ 0 deleted
|
Context: - PR #1985 added the 'Create Forecast' button to the sensor page UI - No agent existed to encode Flask/Jinja2/JS UI patterns for FlexMeasures - Patterns were worked out from scratch during the session Change: - Created .github/agents/ui-specialist.md covering: - Side-panel pattern (sidepanel-container / left-sidepanel-label hierarchy) - Permission-gating idiom: always short-circuit DB calls behind permission check - JS fetch → poll loop → Toast → reload pattern with correct status-code handling - Toast/spinner setup and teardown discipline - Disabled-button vs. hidden-panel distinction - Marshmallow data_key awareness for JS POST payloads - UI test checklist (access, permissions, data availability, boundary, not-called guard) - Known architectural debt (absent CSRF, session-expiry in poll loop, type hint gap)
Context: - PR #1985 established concrete UI patterns (side panel, JS poll loop, permission-gated view logic) that the agent system had no coverage for - A new UI Specialist agent was created to own those patterns - Coordinator roster and domain knowledge should reflect this Change: - Added UI Specialist to the agent roster (item 9) - Added 'UI Development Patterns' subsection to Domain Knowledge with: - Jinja2 side-panel template snippet - Python view short-circuit data-guard pattern - JS fetch/poll/Toast/reload skeleton - Agent responsibility table for UI-touching PRs
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…nit__() missing 1 required argument: 'connection'` Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…docs updates Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
…d updating Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
There was a problem hiding this comment.
The loading UI could improve, i suggest using something like Bootstrap spinners
When the action takes off, you can replace the button with the spinner so the UI is cleaner
They don't seem to be part of this PR, I checked the diff. They result from running the profiler. |
Yes, i was wondering what the source of these files is, and if they are really needed. |
I'm not sure. That would signal more of a blocking action, perhaps less suitable for triggering a job to run in the background. Toast notifications seem more suited to me. What do you think, @nhoening ? I think you were the one suggesting to use toast notifications in the first place. |
|
I could imagine a spinner on the button as a cooldown for not triggering to often (for non-admins), though. |
|
As we go though a few steps, Toast messages help the user understand that. Can somebody who has run this tell me how long the spinner is there now? Maybe until the triggering of the job has returned a success or failure? For at least that a spinner makes sense. It also seems to make sense not to allow hitting the same button for the same sensor again until the actual job outcome is in. I would go with that, actually for now. The cooldown idea is also relevant, but we need to discuss this better. Probably rate-limiting on the server is the best use of our time. (and for that we need some decisions and data modeling on account level) |
|
Sorry @joshuaunity my bad. When I read your comment, I interpreted it as a suggestion to add a spinner. I did not realize the spinner was already there. (Even though you added a screenshot, I thought this was a quick design of your own.) I now realize the spinner is already there, and to answer @nhoening, it keeps being shown until the forecasting job is done, which takes about 5 to 20 seconds or so, depending on the number of days selected. So your suggestion was rather to change the styling of the spinner. I also now see we use these bootstrap spinners elsewhere already, so I'll gladly take up your suggestion, thanks! |
Signed-off-by: F.N. Claessen <claessen@seita.nl>

Adds a "Create forecast" side-panel to the sensor page, letting users trigger a regression forecast with a single click — no CLI or API knowledge required.
Behaviour
FLEXMEASURES_PLANNING_HORIZONconfig) and can be adjusted up to 7 days via a duration input fieldPOST /api/v3_0/sensors/{id}/forecasts/trigger(using the selected duration, nostart→ defaults to now), pollsGET /api/v3_0/sensors/{id}/forecasts/{uuid}every 3 s, surfaces progress via Toast messages, and refreshes the chart data on success (without a full page reload)Changes
View (
ui/views/sensors.py)create-childrenpermission viauser_can_create_children(sensor)before callingget_timerange(DB short-circuit for users without permission)FLEXMEASURES_PLANNING_HORIZONfrom app config and passes the ISO string, humanized string, and integer days to the templateTemplate (
ui/templates/sensors/index.html)sidepanel-containerblock matching the style of the existing "Upload data" panelsensorsToShowUpdatedto reload chart data via the existingembedAndLoadhandler ingraphs.htmlTests (
ui/tests/test_sensor_views.py)New test file with 8 cases: page access, 404, login redirect, panel visibility per permission level (own-account user / admin / other-account user), button state at the 2-day boundary, and a mock-based guard verifying
get_timerangeis not called without permission.Documentation
documentation/views/sensors.rst— new "Creating a forecast" section with cross-reference; updated to use plain-language permissions and config-based durationdocumentation/features/forecasting.rst— new "Forecasting via the UI" subsection alongside the existing CLI and API sections; plain-language permissions, config-based default duration, and a bridge sentence directing users to the API for more controldocumentation/changelog.rst— entry addedOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.