Skip to content

feat(ui): edit flex-context commitments in the context modal#2287

Open
Flix6x wants to merge 4 commits into
feat/2230-ui-commoditiesfrom
feat/1572-ui-commitments
Open

feat(ui): edit flex-context commitments in the context modal#2287
Flix6x wants to merge 4 commits into
feat/2230-ui-commoditiesfrom
feat/1572-ui-commitments

Conversation

@Flix6x

@Flix6x Flix6x commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

Closes #1572. Stacked on #2284 (which stacks on #2281); also incorporates #2285 (user-commitment-name namespacing).

Selecting the commitments card in the flex-context modal opens a structured editor in the right panel, following the accepted design direction of integrating into the existing modal (no nested modal):

  • Each commitment gets an editable name, a commodity (defaulting to electricity), and baseline / up-price / down-price rows, each accepting a fixed value or a sensor (via the existing sensor search, extracted into a parameterized helper).
  • Guidance text states that a baseline plus at least one price is required; the schema stays the validating authority and PATCH errors surface as field-precise toasts (per the issue: the UI does not validate much on its own).
  • Works within each commodity tab, too, since the editor routes through the active commodity scope from feat(ui): edit per-commodity flex-contexts through a commodity tab bar #2284.
  • CommitmentSchema gains the commodity field (defaulting to electricity, matching how the scheduler binds commitments to devices; small overlap with Smarter commodity-context defaults and Commitment commodity field #2272 — trivial merge either way) and now rejects empty names.
  • Added changelog items in documentation/changelog.rst

How to test

pytest flexmeasures/ui/tests flexmeasures/data/schemas flexmeasures/data/models/planning/tests/test_commitments.py

Manually (verified end-to-end in a live browser session): asset context page → Edit flex-context → add the commitments field → Add commitment → set a name, a fixed baseline (100 kW) and a sensor-based up-price → Save persists {"name": ..., "commodity": "electricity", "baseline": "100 kW", "up-price": {"sensor": 1}}; saving a commitment with an empty name is rejected with commitments.1.name: Shorter than minimum length 1.

Related Items

Closes #1572. Stacked on #2284/#2281; pairs with #2285.

🤖 Generated with Claude Code

https://claude.ai/code/session_016MLCUiSdXDqDBmg8GbYp1B

Flix6x and others added 4 commits July 10, 2026 21:48
A user commitment named e.g. 'electricity net energy' would shadow the
scheduler's internal commitment of the same name in the name-keyed
commitment-costs dict of the scheduling results. Prefix user names in
convert_to_commitments (idempotently), so users can pick any name.

Prepares the commitments editor (#1572), where users type free-form names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016MLCUiSdXDqDBmg8GbYp1B
Selecting the commitments card opens a structured editor in the right
panel (following the accepted design direction of integrating into the
existing modal): each commitment gets a name, a commodity (defaulting to
electricity), and baseline/up-price/down-price rows that accept a fixed
value or a sensor (reusing the sensor search, now extracted to a
parameterized module-level helper). Guidance text explains that a
baseline plus at least one price is required; the schema remains the
validating authority and PATCH errors surface as toasts.

CommitmentSchema gains the commodity field (defaulting to electricity,
matching how the scheduler already binds commitments to devices) and
now rejects empty names.

Works within commodity tabs too, since the editor routes through the
active commodity scope.

Verified end-to-end in a live browser session: created a commitment
with a fixed baseline and a sensor-based up-price (persisted exactly as
entered), and an empty-name commitment was rejected with a
field-precise error toast.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016MLCUiSdXDqDBmg8GbYp1B
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 flexmeasures | 🛠️ Build #33536827 | 📁 Comparing 2cc71fb against latest (922ecf6)

  🔍 Preview build  

6 files changed · + 1 added · ± 5 modified

+ Added

± Modified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant