Skip to content

Commit

Permalink
Merge d407ad8 into 27c8b70
Browse files Browse the repository at this point in the history
  • Loading branch information
Flix6x committed Mar 21, 2024
2 parents 27c8b70 + d407ad8 commit bbd1eb3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
11 changes: 8 additions & 3 deletions flexmeasures/data/queries/generic_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,21 @@ def get_asset_group_queries(
asset_queries = {}

# 1. Custom asset groups by combinations of asset types
asset_types_to_remove = []
if custom_aggregate_type_groups:
for asset_type_group_name, asset_types in custom_aggregate_type_groups.items():
asset_queries[asset_type_group_name] = query_assets_by_type(asset_types)
# Remember subgroups
asset_types_to_remove += asset_types

# 2. Include a group per asset type - using the pluralised asset type name
if group_by_type:
for asset_type in db.session.scalars(select(GenericAssetType)).all():
asset_queries[pluralize(asset_type.name)] = query_assets_by_type(
asset_type.name
)
# Add asset type as a group if not already covered by custom group
if asset_type.name not in asset_types_to_remove:
asset_queries[pluralize(asset_type.name)] = query_assets_by_type(
asset_type.name
)

# 3. Include a group per account (admins only) # TODO: we can later adjust this for accounts who admin certain others, not all
if group_by_account and user_has_admin_access(current_user, "read"):
Expand Down
4 changes: 0 additions & 4 deletions flexmeasures/ui/templates/views/new_dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
// create markers, keep them in separate lists (by asset type) to be put into layers

{% for asset_group_name in asset_groups %}
{% if asset_group_name not in aggregate_type_groups %}
var {{ asset_groups[asset_group_name].parameterized_name }}_markers = [];

{% for asset in asset_groups[asset_group_name].assets if asset.location %}
Expand Down Expand Up @@ -161,7 +160,6 @@ <h4>{{ asset.name }} </h4>
{{ asset_groups[asset_group_name].parameterized_name }}_markers.push(marker_for_{{ (asset.id) }});
}
{% endfor %}
{% endif %}
{% endfor %}

// create Map with tiles
Expand All @@ -178,14 +176,12 @@ <h4>{{ asset.name }} </h4>

// add a layer for each asset type
{% for asset_group_name in asset_groups %}
{% if asset_group_name not in aggregate_type_groups %}
{% if asset_groups[asset_group_name].count > 0 %}
var {{ asset_groups[asset_group_name].parameterized_name }}_layer = new L.LayerGroup({{ asset_groups[asset_group_name].parameterized_name }}_markers);
mcgLayerSupportGroup.checkIn({{ asset_groups[asset_group_name].parameterized_name }}_layer);
control.addOverlay({{ asset_groups[asset_group_name].parameterized_name }}_layer, "{{ asset_group_name | capitalize }}")
{{ asset_groups[asset_group_name].parameterized_name }}_layer.addTo(assetMap);
{% endif %}
{% endif %}
{% endfor %}
mcgLayerSupportGroup.addTo(assetMap);
control.addTo(assetMap);
Expand Down
10 changes: 9 additions & 1 deletion flexmeasures/ui/utils/view_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,16 @@ def asset_icon_name(asset_type_name: str) -> str:
<i class="icon-battery"></i>
"""
# power asset exceptions
if "evse" in asset_type_name.lower():
if "evse" in asset_type_name.lower() or "charge point" in asset_type_name.lower():
return "icon-charging_station"
if "project" in asset_type_name.lower():
return "icon-calculator"
if "tariff" in asset_type_name.lower():
return "icon-time"
if "site" in asset_type_name.lower():
return "icon-empty-marker"
if "scenario" in asset_type_name.lower():
return "icon-binoculars"
# weather exceptions
if asset_type_name == "irradiance":
return "wi wi-horizon-alt"
Expand Down

0 comments on commit bbd1eb3

Please sign in to comment.