From be4cdd81e4b4bbfd7c229e044bb458d734aed00e Mon Sep 17 00:00:00 2001 From: Joshua Edward Date: Fri, 22 May 2026 11:29:46 +0100 Subject: [PATCH 01/21] Add asset copy functionality with tabbed interface in asset creation form Signed-off-by: Joshua Edward --- .../ui/templates/assets/asset_new.html | 170 +++++++++++++++++- flexmeasures/ui/views/assets/views.py | 7 + 2 files changed, 175 insertions(+), 2 deletions(-) diff --git a/flexmeasures/ui/templates/assets/asset_new.html b/flexmeasures/ui/templates/assets/asset_new.html index e7ba554fa2..14f8e75ef8 100644 --- a/flexmeasures/ui/templates/assets/asset_new.html +++ b/flexmeasures/ui/templates/assets/asset_new.html @@ -7,9 +7,28 @@ {% block divs %}
- +

Creating a new asset {% if parent_asset_name %} under asset {{ parent_asset_name }} {% endif %}

- + + + + +
+ + +
+
{{ asset_form.csrf_token }} {{ asset_form.hidden_tag() }} @@ -108,6 +127,45 @@

Location

+ +
+ + +
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+ +
+
+ Loading… +
+
+ +
+ +
+ +
+ @@ -174,4 +232,112 @@

Location

+ + {% endblock %} \ No newline at end of file diff --git a/flexmeasures/ui/views/assets/views.py b/flexmeasures/ui/views/assets/views.py index 384661fa6e..0fe4cbbbb7 100644 --- a/flexmeasures/ui/views/assets/views.py +++ b/flexmeasures/ui/views/assets/views.py @@ -1,6 +1,7 @@ from __future__ import annotations import json +from sqlalchemy import select from flask import redirect, url_for, current_app, request, session from flask_classful import FlaskView, route from flask_security import login_required, current_user @@ -18,6 +19,7 @@ ) from flexmeasures.data.models.generic_assets import ( GenericAsset, + GenericAssetType, get_bounding_box_of_assets, ) from flexmeasures.data.schemas.generic_assets import GenericAssetSchema as AssetSchema @@ -147,6 +149,10 @@ def get(self, id: str, **kwargs): if account: # Pre-set account asset_form.account_id.data = str(account.id) + asset_types = db.session.scalars( + select(GenericAssetType).order_by(GenericAssetType.name) + ).all() + return render_flexmeasures_template( "assets/asset_new.html", asset_form=asset_form, @@ -157,6 +163,7 @@ def get(self, id: str, **kwargs): parent_asset_name=parent_asset_name, parent_asset_id=parent_asset_id, account=account, + asset_types=asset_types, ) # otherwise, redirect to the default asset view From f5aa38b49c8e302ffd0a610b0ccd6c92fda0c505 Mon Sep 17 00:00:00 2001 From: Joshua Edward Date: Fri, 22 May 2026 12:19:18 +0100 Subject: [PATCH 02/21] feat: Enhance asset copy tab with infinite scroll and loading indicators Signed-off-by: Joshua Edward --- .../ui/templates/assets/asset_new.html | 242 +++++++++++++++--- 1 file changed, 202 insertions(+), 40 deletions(-) diff --git a/flexmeasures/ui/templates/assets/asset_new.html b/flexmeasures/ui/templates/assets/asset_new.html index 14f8e75ef8..a64fe5d0aa 100644 --- a/flexmeasures/ui/templates/assets/asset_new.html +++ b/flexmeasures/ui/templates/assets/asset_new.html @@ -161,6 +161,13 @@

Location

+
+
+
+ Loading more… +
+
+
@@ -233,72 +240,178 @@

Location