From 06048c64b66bcbfccab339f2fbeb05a329f49916 Mon Sep 17 00:00:00 2001 From: joshuaunity Date: Mon, 21 Oct 2024 09:10:21 +0100 Subject: [PATCH] feat: auto refresh graph and smart auto saving Signed-off-by: joshuaunity --- documentation/changelog.rst | 1 + flexmeasures/ui/templates/base.html | 5 +++++ flexmeasures/ui/templates/crud/asset.html | 25 +++++++++-------------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/documentation/changelog.rst b/documentation/changelog.rst index 6fef53f86..8a2002955 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -19,6 +19,7 @@ New features * Speed up loading the accounts page,by making the pagination backend-based and adding support for that in the API [see `PR #1196 `_] * Speed up loading the account detail page by by switching to server-side pagination for assets, replacing client-side pagination [see `PR #1202 `_] * Simplify and Globalize toasts in the flexmeasures project [see `PR #1207 _`] +* "Added form to edit an asset's sensors_to_show data directly from the UI [see `PR #1212 _`] Infrastructure / Support ---------------------- diff --git a/flexmeasures/ui/templates/base.html b/flexmeasures/ui/templates/base.html index d8e73fc58..8bc076807 100644 --- a/flexmeasures/ui/templates/base.html +++ b/flexmeasures/ui/templates/base.html @@ -365,6 +365,11 @@ }); } + // even lister to refresh graph + document.addEventListener('refreshGraph', async function() { + await embedAndLoad(chartSpecsPath + 'event_starts_after=' + storeStartDate.toISOString() + '&event_ends_before=' + storeEndDate.toISOString() + '&', elementId, datasetName, previousResult, storeStartDate, storeEndDate); + }) + var combineLegend = 'true'; {% if active_page == "assets" %} var dataPath = '/api/v3_0/assets/' + {{ asset.id }}; diff --git a/flexmeasures/ui/templates/crud/asset.html b/flexmeasures/ui/templates/crud/asset.html index 3d90a32be..89b1d15d0 100644 --- a/flexmeasures/ui/templates/crud/asset.html +++ b/flexmeasures/ui/templates/crud/asset.html @@ -202,7 +202,7 @@

Edit {{ asset.name }}

{{ asset_form.sensors_to_show.label(class="col-sm-3 control-label") }}
- @@ -383,7 +383,7 @@

All child assets for {{ asset.name }}

-