Skip to content

Comments

feat: allow update of parent asset on UI#1957

Open
joshuaunity wants to merge 15 commits intomainfrom
feat/allow-update-of-parentasset-on-ui
Open

feat: allow update of parent asset on UI#1957
joshuaunity wants to merge 15 commits intomainfrom
feat/allow-update-of-parentasset-on-ui

Conversation

@joshuaunity
Copy link
Contributor

Description

In this PR, I added a new field to the asset UI edit form, allowing users to update an asset's parent asset.

Look & Feel

Before
image

After
image

How to test

  1. Open up any asset properties page
  2. Navigate to the 'edit' op up modal on the left
  3. Find the new "parent asset" field and update
  4. Confirm it successfully updates

Further Improvements

In the future, it would be more powerful if we refactored these forms to use JavaScript for their update and other controls

Related Items

This PR closes #1441

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 <oghenerobojosh01@gmail.com>
@joshuaunity joshuaunity self-assigned this Feb 6, 2026
@joshuaunity joshuaunity added the enhancement New feature or request label Feb 6, 2026
@read-the-docs-community
Copy link

read-the-docs-community bot commented Feb 6, 2026

Documentation build overview

📚 flexmeasures | 🛠️ Build #31487702 | 📁 Comparing 3b391fe against latest (d2d93ce)


🔍 Preview build

Show files changed (2 files in total): 📝 2 modified | ➕ 0 added | ➖ 0 deleted
File Status
_autosummary/flexmeasures.api.v3_0.assets.html 📝 modified
api/v3_0.html 📝 modified

@joshuaunity joshuaunity requested a review from nhoening February 6, 2026 07:57
@Flix6x Flix6x changed the title feat: alloow update of parent asst on UI feat: allow update of parent asset on UI Feb 6, 2026
joshuaunity and others added 9 commits February 9, 2026 10:56
…erties page

Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
…lexMeasures/flexmeasures into feat/allow-update-of-parentasset-on-ui
… the same name of the asset itself

Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
@joshuaunity joshuaunity requested a review from Flix6x February 12, 2026 11:02
Copy link
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.

I tested it and it works nicely!

  1. One thing missing is a check server-side (which I stated in the issue).
  • The server-side code which processes the form should check if the parent asset really belongs to the same account.
  • Also make sure the asset is not listed as its own parent asset (this can be later extended to check for circularity, the parent asset should not be in the list of children or their descendants - needs a small recursive function).
  1. Also, do not include the asset itself in the list of options given to the template.

Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
@joshuaunity
Copy link
Contributor Author

joshuaunity commented Feb 19, 2026

The server-side code which processes the form should check if the parent asset really belongs to the same account.

In the backend, I'm only sending assets in the same account, so the user doesn't even have the option to select a foreign asset

Also, make sure the asset is not listed as its own parent asset

This also doesn't happen anymore

Also, do not include the asset itself in the list of options given to the template.

Isn't this the same as the above

@nhoening

@nhoening
Copy link
Contributor

In the backend, I'm only sending assets in the same account, so the user doesn't even have the option to select a foreign asset

The backend needs to do its own checks and not trust the client.
Sure, that is more important with REST APIs, but this is not fundamentally different.
It's only one easy statement anyway

Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
@joshuaunity
Copy link
Contributor Author

joshuaunity commented Feb 20, 2026

The server-side code which processes the form should check if the parent asset really belongs to the same account.

This is now implemented

How about the other things I replied to? Are we on the same page with that?

@nhoening

@nhoening
Copy link
Contributor

The server-side code which processes the form should check if the parent asset really belongs to the same account.

This is now implemented

How about the other things I replied to? Are we on the same page with that?

@nhoening

This is vague. Which things? I checked and I'm not sure what open reply I should look up.

@joshuaunity
Copy link
Contributor Author

The server-side code which processes the form should check if the parent asset really belongs to the same account.

This is now implemented
How about the other things I replied to? Are we on the same page with that?
@nhoening

This is vague. Which things? I checked and I'm not sure what open reply I should look up.

this part

image

@nhoening
Copy link
Contributor

This also doesn't happen anymore

If you say so :) I'll take a look in the review.

Isn't this the same as the above

I believe you are correct in this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit asset: set parent ID

3 participants