Add sub-component support via self-referential device hierarchy
This commit is contained in:
@@ -66,7 +66,14 @@
|
||||
data-location="{{ d.location or '' }}"
|
||||
data-fill="{{ fill_state }}"
|
||||
data-name="{{ d.name|lower }}">
|
||||
<td data-label="Device"><a href="{{ url_for('device_detail', device_id=d.id) }}"><strong>{{ d.name }}</strong></a></td>
|
||||
<td data-label="Device">
|
||||
<a href="{{ url_for('device_detail', device_id=d.id) }}"><strong>{{ d.name }}</strong></a>
|
||||
{% if d.parent %}
|
||||
<br><small class="text-muted">↳ <a href="{{ url_for('device_detail', device_id=d.parent.id) }}">{{ d.parent.name }}</a></small>
|
||||
{% elif d.has_children() %}
|
||||
<br><small class="text-muted">{{ d.children|length }} sub-component{{ 's' if d.children|length != 1 }}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td data-label="Type">{{ d.device_type or '—' }}</td>
|
||||
<td data-label="Size">{{ d.battery_size or '—' }}</td>
|
||||
<td data-label="Location">{{ d.location or '—' }}</td>
|
||||
|
||||
Reference in New Issue
Block a user