Add sub-component support via self-referential device hierarchy

This commit is contained in:
2026-06-05 22:30:11 -05:00
parent 55ce963d79
commit 75fe4fe575
7 changed files with 248 additions and 9 deletions
+7 -1
View File
@@ -2,10 +2,16 @@
{% block title %}Add Device — Battery Tracker{% endblock %}
{% block content %}
<h1>Add Device</h1>
<h1>{% if prefill_parent %}Add Sub-component to {{ prefill_parent.name }}{% else %}Add Device{% endif %}</h1>
<div class="card">
<form method="post" action="{{ url_for('device_add') }}">
{% if prefill_parent %}
<input type="hidden" name="parent_id" value="{{ prefill_parent.id }}">
<p class="text-muted" style="margin-bottom:0.75rem;">
Adding as a sub-component of <a href="{{ url_for('device_detail', device_id=prefill_parent.id) }}">{{ prefill_parent.name }}</a>.
</p>
{% endif %}
<div class="form-group">
<label for="name">Device Name <span class="text-danger">*</span></label>
<input type="text" id="name" name="name" value="{{ form_name|default('') }}"