Skip to content

Feat: Graph modal upgrade - flex-config integration#1926

Merged
nhoening merged 67 commits intofeat/allow-Ssensorstoshow-schemafrom
feat/sensortoshow-modal-upgrade
Mar 17, 2026
Merged

Feat: Graph modal upgrade - flex-config integration#1926
nhoening merged 67 commits intofeat/allow-Ssensorstoshow-schemafrom
feat/sensortoshow-modal-upgrade

Conversation

@joshuaunity
Copy link
Copy Markdown
Contributor

@joshuaunity joshuaunity commented Jan 23, 2026

Description

This PR adapts the new SensorsToShowSchema, which introduced the concept of plots and aset flex-config references.

Look & Feel

Before:

image

After:

image

How to test

  1. Visit any asset with sensors
  2. Navigate to the graph page
  3. Click on the "Edit Graphs" button
  4. Observe the new changes and test them out
  5. Make sure both new and old features work as expected

Related Items

This PR Closes #1881

Sign-off

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on code under GPL or other license that is incompatible with FlexMeasures

Signed-off-by: joshuaunity <[email protected]>
@joshuaunity joshuaunity self-assigned this Jan 23, 2026
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Jan 23, 2026

Documentation build overview

📚 flexmeasures | 🛠️ Build #31853181 | 📁 Comparing d917895 against latest (f1707fc)


🔍 Preview build

Show files changed (11 files in total): 📝 11 modified | ➕ 0 added | ➖ 0 deleted
File Status
changelog.html 📝 modified
genindex.html 📝 modified
_autosummary/flexmeasures.data.models.charts.belief_charts.html 📝 modified
_autosummary/flexmeasures.data.models.generic_assets.html 📝 modified
_autosummary/flexmeasures.data.schemas.generic_assets.html 📝 modified
_autosummary/flexmeasures.data.schemas.sensors.html 📝 modified
_autosummary/flexmeasures.utils.coding_utils.html 📝 modified
_autosummary/flexmeasures.utils.html 📝 modified
_autosummary/flexmeasures.utils.unit_utils.html 📝 modified
api/v3_0.html 📝 modified
views/asset-data.html 📝 modified

@joshuaunity joshuaunity changed the base branch from main to feat/allow-Ssensorstoshow-schema January 25, 2026 21:46
… side, including dissabling logic

Signed-off-by: joshuaunity <[email protected]>
…sures/flexmeasures into feat/sensortoshow-modal-upgrade
…sures/flexmeasures into feat/sensortoshow-modal-upgrade
Signed-off-by: joshuaunity <[email protected]>
…sures/flexmeasures into feat/sensortoshow-modal-upgrade
@joshuaunity joshuaunity requested a review from nhoening February 3, 2026 08:31
…sures/flexmeasures into feat/sensortoshow-modal-upgrade
@joshuaunity joshuaunity added enhancement New feature or request UI labels Feb 4, 2026
Copy link
Copy Markdown
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start!
I noticed these things when I tested:

Also, the "Asset Config" tab should be the first option: on the left, open per default. (I believe we want users to use those fields if possible, and use the sensor search if they need more than that). And I would call it "Flex Config".

When selecting an asset, I sometimes see "flex-model" twice under Config-Type.

When I select a different config-type, previously selected field & details should be emptied. Actually, it seems the list of available fields is not replaced, as well.

Some help texts.

  • Next to "field" let's have an info icon, explaining that here, fields can be selected (Q: do you only show fields withUnder "Field Details", let's

I wanted to remove such a new field, but nothing happened, also no error.
Removing a traditional field got me "Uncaught ReferenceError: removeSensorFromGraph is not defined"

Comment thread flexmeasures/ui/static/js/components.js
Comment thread flexmeasures/ui/static/js/components.js Outdated
@joshuaunity joshuaunity requested a review from nhoening February 10, 2026 08:42
Copy link
Copy Markdown
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additions I'd like to see:

  • Can we add the flex-config information to the plot legends? Now I see "sensor-name (asset-name)" in the legend. But if I selected a sensor for its function in the flex-model, we should make that information visible, as to make the UX clearer. So in the case I selected soc-min, I'd like to see "sensor-name (soc-min for asset-name)". I know this might be a bit tricky to accomplish. But it's important for users to see why a plot was added.
  • On compontens.js, I asked for docstrings of the functions, but I believe you only added one.
  • The form for flex config settings should have some info icons for help. E.g. which assets are shown in the dropdown? Will fields without value be hidden?

Some things that don't seem to work properly:

  • I am actually confused which assets show up in the list - as I am testing it is a short list. I believe it is short because it is limited by pagination (&per_page=10). So that limitation is wrong. But also the set of assets being offered - the issue says: "assets are all assets in the same tree as the currently edited one". For this, the new root parameter of that asset endpoint can be used. On that issue, you discussed with us how to do this.
  • Searching for sensors (old-fashioned) gives JS error: "Uncaught ReferenceError: filterSensors is not defined"
  • Also, when I select a graph on the left, the button to add a sensor used to switch its text, but now it keeps saying "Add new Graph"

@joshuaunity
Copy link
Copy Markdown
Contributor Author

joshuaunity commented Feb 11, 2026

Searching for sensors (old-fashioned) gives JS error: "Uncaught ReferenceError: filterSensors is not defined"

i caught this yesterday as well, i havent pushed my updates yet

Also, when I select a graph on the left, the button to add a sensor used to switch its text, but now it keeps saying "Add new Graph"

This is in progress

I am actually confused which assets show up in the list - as I am testing it is a short list. I belie...

Yes, you are correct, to speed up development on the initial phase, i just fetched the sensors. I will implement this feature now as i did forget

On compontens.js, I asked for docstrings of the functions, but I believe you only added one.

I thought you were referring to only the util function, i can add for the rest too.

… revive other broken features

Signed-off-by: joshuaunity <[email protected]>
@nhoening
Copy link
Copy Markdown
Contributor

@joshuaunity let me know when this is ready for review

@joshuaunity
Copy link
Copy Markdown
Contributor Author

@joshuaunity let me know when this is ready for review

You can go ahead and review, as I'm currently working on the fixed value graphs

Copy link
Copy Markdown
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, at least half of my previous review has not been addressed. So then you should not tell me it's okay to review.

Please address these open items from the last review:

  • Can we add the flex-config information to the plot legends? Now I see "sensor-name (asset-name)" in the legend. But if I selected a sensor for its function in the flex-model, we should make that information visible, as to make the UX clearer. So in the case I selected soc-min, I'd like to see "sensor-name (soc-min for asset-name)". I know this might be a bit tricky to accomplish. But it's important for users to see why a plot was added.
  • The form for flex config settings should have some info icons for help. E.g. which assets are shown in the dropdown? Will fields without value be hidden?
  • Searching for sensors (old-fashioned) gives JS error: "Uncaught ReferenceError: filterSensors is not defined"

Also, I found some other things which should be improved:

  • There are fields which are booleans (e.g. ' prefer-charging-sooner). Let's not offer those.
  • I wanted to remove a field from a graph (clicking "x"), but that did not work. No error in the console.
  • There is logs in the console which should go away:
    • "Rendering graph cards..."
    • "Rendering API sensors..."

Comment thread flexmeasures/ui/templates/assets/asset_graph.html Outdated
Comment thread flexmeasures/ui/templates/assets/asset_graph.html Outdated
@joshuaunity
Copy link
Copy Markdown
Contributor Author

The following are left

The form for flex config settings should have some info icons for help. E.g. which assets are shown in the dropdown? Will fields without value be hidden?

#1926 (comment)

@nhoening
Copy link
Copy Markdown
Contributor

The following are left

The form for flex config settings should have some info icons for help. E.g. which assets are shown in the dropdown? Will fields without value be hidden?

#1926 (comment)

Okay, if you get them done by tomorrow I can probably still review.

And you said fixed values (e.g. "30 kW") are already worked on in this PR?

@joshuaunity
Copy link
Copy Markdown
Contributor Author

If the flex-config-based sensor is shown in the graph card

This is possible, will take some time. But other values, like arrays and fixed values, would still appear as is.

@nhoening
Copy link
Copy Markdown
Contributor

the 2. remove flexValue part is

Is? It looks like there is more to this sentence

I believe the field length in the audit log is limited. Can you log in the code what the complete message would be?

I mean where does the term "flexValue" come from - it's not part of the sensors_to_show structure, right?

@nhoening
Copy link
Copy Markdown
Contributor

If the flex-config-based sensor is shown in the graph card

This is possible, will take some time. But other values, like arrays and fixed values, would still appear as is.

What is the context of this? you only quoted a part of my original sentence, I don't recall it all.

@joshuaunity
Copy link
Copy Markdown
Contributor Author

If the flex-config-based sensor is shown in the graph card

This is possible, will take some time. But other values, like arrays and fixed values, would still appear as is.

What is the context of this? you only quoted a part of my original sentence, I don't recall it all.

image

This is the comment,

@nhoening
Copy link
Copy Markdown
Contributor

nhoening commented Mar 13, 2026

Let's make this a follow-up issue then.
The audit log field for messages might have to be a little larger and we should investigate various changes on graphs, flex-context and model to see if the audit log captures those okay.

@joshuaunity joshuaunity requested a review from nhoening March 13, 2026 17:07
Copy link
Copy Markdown
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried it out again, this time in the HEMS exampe (a more realistic way to try this), and it seems to work really well!

I basically have only one thing left:

In the graph cards, I'd like to make the asset config entries visually better structured, by just changing the heading and asset information a bit.

See the below example - to me it is confusing - it looks like two entries.

Image
  1. The title of that section "Asset" - that should be the field title, e.g. here "My Building 1 - site-consumption-capacity
  2. Then the next line can be context information: "Asset ID: 4237, In: Flex-Context"
  3. Why does the sensor entry have an "x" to remove it ? That should probably simply go.

Can you make the issue for checking / improving the audit log?

@Flix6x Flix6x added this to the 0.32.0 milestone Mar 17, 2026
@joshuaunity
Copy link
Copy Markdown
Contributor Author

Can you make the issue for checking / improving the audit log?

yes i can

Copy link
Copy Markdown
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent feature, thanks for the patience to get it through!

joshuaunity and others added 4 commits March 17, 2026 22:56
@nhoening nhoening merged commit cf1d6bb into feat/allow-Ssensorstoshow-schema Mar 17, 2026
5 of 7 checks passed
@nhoening nhoening deleted the feat/sensortoshow-modal-upgrade branch March 17, 2026 23:17
nhoening added a commit that referenced this pull request Mar 18, 2026
* refactor: refactored SensorsToShowSchema to validate into new shape

Signed-off-by: joshuaunity <[email protected]>

* chore: debugging - work in progress

Signed-off-by: joshuaunity <[email protected]>

* chore: debug errors

Signed-off-by: joshuaunity <[email protected]>

* fix: fixed cahrts failing to render

Signed-off-by: joshuaunity <[email protected]>

* chore: udpate test case with new schema changes

Signed-off-by: joshuaunity <[email protected]>

* tests: adapting more testcases to new schema shape

Signed-off-by: joshuaunity <[email protected]>

* fix: fix failing test

Signed-off-by: joshuaunity <[email protected]>

* fix: fixed failing api due to logic oversight

Signed-off-by: joshuaunity <[email protected]>

* fix: handle asset plot entry

Signed-off-by: joshuaunity <[email protected]>

* chore: add changelog entry

Signed-off-by: joshuaunity <[email protected]>

* Update documentation/changelog.rst

Co-authored-by: Felix Claessen <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/data/schemas/utils.py

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/data/schemas/generic_assets.py

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/data/schemas/generic_assets.py

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/data/schemas/generic_assets.py

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* fix: fixed schema bugs

Signed-off-by: joshuaunity <[email protected]>

* fix: fixed skipped validation step

Signed-off-by: joshuaunity <[email protected]>

* chore: add docstring to schema functions

Signed-off-by: joshuaunity <[email protected]>

* chore: little changes

Signed-off-by: joshuaunity <[email protected]>

* tests: expanding test case

Signed-off-by: joshuaunity <[email protected]>

* refactor: more backward compatibility refactoring

Signed-off-by: joshuaunity <[email protected]>

* chore: update docstring for SensorsToShowSchema

Signed-off-by: joshuaunity <[email protected]>

* refactor: support for old sensor to show format for flatenen functions

Signed-off-by: joshuaunity <[email protected]>

* tests: change test reference asset

Signed-off-by: joshuaunity <[email protected]>

* test: apply fixture to test case due to asset resource not found

Signed-off-by: joshuaunity <[email protected]>

* chore: multiple followups across docs and schema based on PR request changes

Signed-off-by: joshuaunity <[email protected]>

* fix: fixed failing test

Signed-off-by: joshuaunity <[email protected]>

* chore: update tpy accoutn data relating to sensors_to_show

Signed-off-by: joshuaunity <[email protected]>

* tests: update test cases

Signed-off-by: joshuaunity <[email protected]>

* refactor: refactored util function for backward compatibility

Signed-off-by: joshuaunity <[email protected]>

* tests: fixed failing tests - phase 2

Signed-off-by: joshuaunity <[email protected]>

* fix: Fix failing pipeline due to code indentation

Signed-off-by: joshuaunity <[email protected]>

* Feat/clean up duplicate flattening implementation (#1984)

* refactor: move extract_sensors_from_flex_config to schemas/generic_assets.py

Signed-off-by: F.N. Claessen <[email protected]>

* delete: internal import no longer needed

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: rename util method to flatten_sensors_to_show

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: get rid of duplicate implementation for flattening sensors to show

Signed-off-by: F.N. Claessen <[email protected]>

* feat: make doctest out of example

Signed-off-by: F.N. Claessen <[email protected]>

* style: rst-style docstrings

Signed-off-by: F.N. Claessen <[email protected]>

* feat: support multiple flex-config field names

Signed-off-by: F.N. Claessen <[email protected]>

* feat: test flatten function

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>

* Update documentation/views/asset-data.rst

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/data/schemas/generic_assets.py

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Feat: Graph modal upgrade - flex-config integration (#1926)

* chore: multiple updates

Signed-off-by: joshuaunity <[email protected]>

* chore: stabilized leeft side of modal and kicked off work onteh right side, including dissabling logic

Signed-off-by: joshuaunity <[email protected]>

* chore: completed left side of graph modal

Signed-off-by: joshuaunity <[email protected]>

* chore: work in progress

Signed-off-by: joshuaunity <[email protected]>

* refactor: more stabilization work as well as reactivation of broken features

Signed-off-by: joshuaunity <[email protected]>

* chore: reorder tabs

Signed-off-by: joshuaunity <[email protected]>

* fix: fixed bug whre options keep gettgin added teh configType dropdown. Also added some docstring

Signed-off-by: joshuaunity <[email protected]>

* fix: fixed error where graph cant be removed

Signed-off-by: joshuaunity <[email protected]>

* fix: ixed issue with graph titles not being editable

Signed-off-by: joshuaunity <[email protected]>

* fix: fixed broken units dropdown as well as some other refactoring to revive other broken features

Signed-off-by: joshuaunity <[email protected]>

* refactor: Major refactor phase 1

Signed-off-by: joshuaunity <[email protected]>

* refactor: Major refactor phase 2

Signed-off-by: joshuaunity <[email protected]>

* feat; new util function to find an asset site_asset

Signed-off-by: joshuaunity <[email protected]>

* chore: add extra info icon to form elements

Signed-off-by: joshuaunity <[email protected]>

* chore: update writeup

Signed-off-by: joshuaunity <[email protected]>

* fix: fix failing util function due to wrong formatting allowing trailing zeros

Signed-off-by: joshuaunity <[email protected]>

* fix: fixed bug where a new sensor cant be added to an existing graph

Signed-off-by: joshuaunity <[email protected]>

* refactor: Fixed graphs to properly display subcharts and mixed charts containg fixed and dynamic value plots

Signed-off-by: joshuaunity <[email protected]>

* chore: removed unused code

Signed-off-by: joshuaunity <[email protected]>

* refactor: post resolving conflicts refactoring

Signed-off-by: joshuaunity <[email protected]>

* tests: remove unsupported edgecase

Signed-off-by: joshuaunity <[email protected]>

* fix: fix issue where unsuppoerted flexocntext fields are sent to API, causing validation error

Signed-off-by: joshuaunity <[email protected]>

* feat: up to date asset data for graph modals

Signed-off-by: joshuaunity <[email protected]>

* fix: Fix bug where you cant remove sensors from a grpah with multiple sensors

Signed-off-by: joshuaunity <[email protected]>

* chore: amek all asset ref inputs equal size

Signed-off-by: joshuaunity <[email protected]>

* Update flexmeasures/ui/templates/assets/asset_graph.html

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/ui/templates/assets/asset_graph.html

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* fix: fixed error when trying to remove polts thats not a array of sensors

Signed-off-by: joshuaunity <[email protected]>

* fix: Fixed bug where the options to select a felxConfig field disables the first option, in turn the first option coudlnt be selected

Signed-off-by: joshuaunity <[email protected]>

* refactor: imporve fuction to improve readability and also fix edgecase bug

Signed-off-by: joshuaunity <[email protected]>

* fix: Fixed bug where sensors filter sectoin doesnt change after a selected card has been remvoed, still shows 'Add to X graph'

Signed-off-by: joshuaunity <[email protected]>

* chore: udpate temp sensor naming sceme

Signed-off-by: joshuaunity <[email protected]>

* chore: persisten root asset selection

Signed-off-by: joshuaunity <[email protected]>

* chore: implement new data format in toy data for testing

Signed-off-by: joshuaunity <[email protected]>

* chore: removed unused values

Signed-off-by: joshuaunity <[email protected]>

* chore: rename util function name

Signed-off-by: joshuaunity <[email protected]>

* chore: adding comments

Signed-off-by: joshuaunity <[email protected]>

* feat: dynamically render graph title on 'add plot' button

Signed-off-by: joshuaunity <[email protected]>

* chore: remvoed duplicate asset name in graph ledgend

Signed-off-by: joshuaunity <[email protected]>

* chore: fetch sensors based on site asset instead of current asset

Signed-off-by: joshuaunity <[email protected]>

* Dynamically change ledgen titles

Signed-off-by: joshuaunity <[email protected]>

* chore: little change to wording

Signed-off-by: joshuaunity <[email protected]>

* refactor: transfer initialization check into component for rendering graphs

Signed-off-by: joshuaunity <[email protected]>

* Update flexmeasures/ui/templates/assets/asset_graph.html

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/ui/templates/assets/asset_graph.html

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/ui/templates/assets/asset_graph.html

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/ui/templates/assets/asset_graph.html

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/ui/templates/assets/asset_graph.html

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/ui/templates/assets/asset_graph.html

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* Update flexmeasures/ui/templates/assets/asset_graph.html

Co-authored-by: Nicolas Höning <[email protected]>
Signed-off-by: JDev <[email protected]>

* chore: name change

Signed-off-by: joshuaunity <[email protected]>

* refactor: backward compatibility support and imporvement UI data representation

Signed-off-by: joshuaunity <[email protected]>

* fix: Fix issue where subcharts are split up into single cahrts on the frontend

Signed-off-by: joshuaunity <[email protected]>

* refactor: Improve asset identification in plot headers and enhance sensor rendering logic

Signed-off-by: joshuaunity <[email protected]>

* refactor: Simplify asset plot card rendering and improve code readability

Signed-off-by: joshuaunity <[email protected]>

* style: Adjust disabled input width and clean up class names in asset plot card

Signed-off-by: joshuaunity <[email protected]>

* style: Update plot header class for improved font size consistency

Signed-off-by: joshuaunity <[email protected]>

* chore: add changelog entry

Signed-off-by: joshuaunity <[email protected]>

* update OpenAPI specs

Signed-off-by: Nicolas Höning <[email protected]>

* address a flake8, mypy, precommit errors

Signed-off-by: Nicolas Höning <[email protected]>

---------

Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: JDev <[email protected]>
Signed-off-by: Nicolas Höning <[email protected]>
Co-authored-by: Nicolas Höning <[email protected]>

* style: black

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: JDev <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: Nicolas Höning <[email protected]>
Co-authored-by: Felix Claessen <[email protected]>
Co-authored-by: Nicolas Höning <[email protected]>
Co-authored-by: F.N. Claessen <[email protected]>
@Flix6x Flix6x mentioned this pull request Apr 10, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Scheduling UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance graphs dialogue to allow flex-config field selection

3 participants