Feat: Graph modal upgrade - flex-config integration#1926
Feat: Graph modal upgrade - flex-config integration#1926joshuaunity wants to merge 39 commits intofeat/allow-Ssensorstoshow-schemafrom
Conversation
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
… side, including dissabling logic Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…sures/flexmeasures into feat/sensortoshow-modal-upgrade
…sures/flexmeasures into feat/sensortoshow-modal-upgrade
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…eatures Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…sures/flexmeasures into feat/sensortoshow-modal-upgrade
…sures/flexmeasures into feat/sensortoshow-modal-upgrade
nhoening
left a comment
There was a problem hiding this comment.
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"
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…n. Also added some docstring Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
nhoening
left a comment
There was a problem hiding this comment.
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 newrootparameter 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"
i caught this yesterday as well, i havent pushed my updates yet
This is in progress
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
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 <oghenerobojosh01@gmail.com>
|
@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 |
nhoening
left a comment
There was a problem hiding this comment.
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..."
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
|
The following are left
|
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? |
I see the issue now, you are using an outdated structure. Below is an image of the new change to the format/structure
This new format was adopted to reduce the number of calls to the backend by setting the needed value right in the JSON so the UI can use that, instead of making another call, as well as JSON processing to find the value it needs This is what the graph looks like after refactoring to render subcharts again
|
That seems to be storing the same information in two places, making me think of problems keeping the information in sync. For instance, when the user makes a change to either one of those fields in the flex-context/flex-model, would they need to actively update their sensors_to_show, too, for the change to be picked up in the chart? |
Hmm, they would. I'll have to write UI logic to keep the data fresh on reload. But since I want fewer calls, I can add a button to the top right, where users can click to update underlying data. |
|
Not the direction I would take. I would keep only the reference and not the values in sensors_to_show, and look up the values only when loading chart data, as part of the existing endpoint. No new calls. |
… causing validation error Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Caching Strategy for Asset Plot CardsThe Problem
The Solution
Why This Is Acceptable
Feel free to test this on your end to experience the improved UX. |
… sensors Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
There was a problem hiding this comment.
I tried loading a flex-model field and two things did not work for me:
- The soc-max field was shown, but I also added a soc-min field to the asset which was not in the dropdown, also after reloading the page
- The value of the field did not show up under "Field Details"
Also. removing a plot from a graph gave this error:
Cannot read properties of undefined (reading 'splice')
at removeAssetPlotFromGraph (graphs?start_time=2024-04-09T00:00:00+02:00&end_time=2024-04-13T00:00:00+02:00:1781:76)
at HTMLElement.<anonymous> (components.js?v=0.31.0.dev93:195:7)
And one more thing: When I remove a graph I had selected, the buttons in the sensor search part of the modal still say "Add to X graph" (should go back to saying "Add to new graph")
Co-authored-by: Nicolas Höning <nicolas@seita.nl> Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
Co-authored-by: Nicolas Höning <nicolas@seita.nl> Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
…sors Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…s the first option, in turn the first option coudlnt be selected Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…e bug Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…ected card has been remvoed, still shows 'Add to X graph' Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
I tried this, but didnt experience the same thing. See the video below if that replicates your situation Uploading Screencast from 2026-03-03 22-26-17.mp4… |
There was a problem hiding this comment.
UX:
- My asset's flex-model field (soc-max) is now shown, also with its value, but I can't always add it to a graph. The button says "Add plot". When I select a graph, that does not change (should it? like in the sensor part of the modal?). In my example, I had no graphs yet. I created one, but was not able to add the plot to it (
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'id') at addPlotBtn.onclick (graphs:1400:43). Reloading the dialogue might help, but it should work even if I am ceating new graphs. - When I close the dialogue, and re-open it, the asset is unselected, but the other fields still show the previous values. Maybe all fields should keep their previous values?
- When I add a simple soc-min field, the legend says "Temporary Sensor (soc-min for (my-asset))". It should just say "soc-min for my-asset"
- The legend title is "sensor.description". It used to be "Sensor". We should simply say "Legend", not that it can be sensors or fixed values.
- I am having trouble using the sensor search to find a sensor that is defined on the very asset I am editing the graphs for. Can you check if that works for you? Strange.
- Actually, the sensor search in that part of the dialogue can also look at the whole site, like the flex-config search (using the
root).
A few smaller things:
- please update the "After" screenshot in the PR description, it is now not showing the new part of the dialogue
- I want us to test the new features in the tutorial, see 2 inline comments here which I made in the schema PR. I realise the update should be done here, as only this PR has the actual graph capabilities.
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
i dont under stand what you mean here. Can you share a screenshot? |
No, I am traveling now. But do you know what I mean with the legend title? |
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Was this what you tried? I tried to replicate what you said here. (The video controls may block my gesture at the bottom right of the screen, I suggest watching in full screen) Screencast.from.2026-03-05.18-50-10.mp4 |
|
I will have to try again tomorrow, did some tests now but it's getting late. It might have to do with me testing with soc-usage and as that is an array it's not behaving well. Maybe you can test that locally on your end. |







Description
This PR adapts the new
SensorsToShowSchema, which introduced the concept of plots and aset flex-config references.Look & Feel
Before

After

How to test
Further Improvements
Related Items
This PR Closes #1881
Sign-off