- Add DELETE endpoint for buttons with confirmation dialog - Add editable GPIO pin input fields in button list - Update PUT endpoint to handle both recipe and GPIO pin changes - Enhanced button management UI with delete buttons and inline editing - All changes use HTMX for seamless UI updates 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
60 lines
2.4 KiB
HTML
60 lines
2.4 KiB
HTML
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>GPIO Pin</th>
|
|
<th>Recipe</th>
|
|
<th>Status</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for button in buttons %}
|
|
<tr>
|
|
<td>{{ button.name }}</td>
|
|
<td>
|
|
<div class="input-group input-group-sm" style="width: 120px;">
|
|
<span class="input-group-text">GPIO</span>
|
|
<input type="number" class="form-control"
|
|
value="{{ button.gpio_pin }}"
|
|
min="0" max="40"
|
|
hx-put="/buttons/{{ button.id }}"
|
|
hx-trigger="change"
|
|
name="gpio_pin">
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<select class="form-select form-select-sm"
|
|
hx-put="/buttons/{{ button.id }}"
|
|
hx-trigger="change"
|
|
name="recipe_id">
|
|
<option value="">No Recipe</option>
|
|
{% for recipe in recipes %}
|
|
<option value="{{ recipe.id }}"
|
|
{% if button.recipe_id == recipe.id %}selected{% endif %}>
|
|
{{ recipe.name }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td>
|
|
<span class="badge bg-{{ 'success' if button.recipe_name else 'warning' }}">
|
|
{{ 'Configured' if button.recipe_name else 'Not Configured' }}
|
|
</span>
|
|
</td>
|
|
<td>
|
|
<button class="btn btn-danger btn-sm"
|
|
hx-delete="/buttons/{{ button.id }}"
|
|
hx-target="#button-list"
|
|
hx-swap="innerHTML"
|
|
hx-confirm="Are you sure you want to delete this button?"
|
|
title="Delete Button">
|
|
<i class="bi bi-trash"></i> Delete
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div> |