FlexMeasures / flexmeasures

The intelligent & developer-friendly EMS to support real-time energy flexibility apps, rapidly and scalable.
https://flexmeasures.io
Apache License 2.0
145 stars 36 forks source link

Add filter by asset type in the assest UI page #1216

Open Ragnar-the-mighty opened 5 days ago

Ragnar-the-mighty commented 5 days ago

1) Add filter by asset type I have many assets that I can see from my account. Filter by name is good but a filter by asset type would help. I think they should be cumulative filters, only show asset that passed all filters.

I would like to be able to filter by asset type. I am willing to try to add this to the UI but need a pointer to where to start.

2) Show asset type at/near the top of asset page I also want to the individual asset page to show asset type at/near the top.

nhoening commented 5 days ago
  1. You mean the /assets view right? (code here, template here)

We have ajaxified this page recently, and here is the call to the API endpoint.

The API endpoint should show nicely how we add filters, and how we use MarshMallow to define API parameters (such as your new filter).

  1. Yes, go ahead and add that information if you think it is useful.

In the single asset view (/assets/ID), we also use the API, but from within the backend code itself. FYI: It's been leading to code that sometimes gives more trouble than it's worth, so we are slowly transitioning to the more direct JS->API way of working in the frontend. However, in this case, you get the asset type already worked out (as the asset API would only give you the asset type ID - I believe here you already get the name and it should be easy work).