feat(ui): edit flex-context commitments in the context modal#2287
Open
Flix6x wants to merge 4 commits into
Open
feat(ui): edit flex-context commitments in the context modal#2287Flix6x wants to merge 4 commits into
Flix6x wants to merge 4 commits into
Conversation
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
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016MLCUiSdXDqDBmg8GbYp1B
Documentation build overview
6 files changed ·
|
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.
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):
CommitmentSchemagains thecommodityfield (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.documentation/changelog.rstHow to test
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 withcommitments.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