adding static connection

This commit is contained in:
Ian Roddis committed 2026-07-02 12:18:06 -03:00
1 parent eba7896893
commit 422e217180
14 files changed
+405 -2

No files matched your search

+3
View File
@@ -29,6 +29,9 @@
{% if user.is_superuser or "imported_parts:read" in user.permissions %}
<a href="/admin/imported-parts">Imported Parts</a>
{% endif %}
{% if user.is_superuser or "static_connections:read" in user.permissions %}
<a href="/admin/static-connections">Static Connections</a>
{% endif %}
{% if user.is_superuser or "audit_log:read" in user.permissions %}
<a href="/admin/audit-log">Audit Log</a>
{% endif %}
@@ -0,0 +1,16 @@
<tr id="static-connection-{{ sc.id }}">
<td>{{ sc.id }}</td>
<td>{{ sc.od_mm }}</td>
<td>{{ sc.od_in }}</td>
<td class="row-actions">
<button class="btn btn-ghost"
hx-get="/admin/static-connections/{{ sc.id }}/edit"
hx-target="#static-connection-{{ sc.id }}"
hx-swap="outerHTML">Edit</button>
<button class="btn btn-danger"
hx-delete="/admin/static-connections/{{ sc.id }}"
hx-target="#static-connection-{{ sc.id }}"
hx-swap="outerHTML"
hx-confirm="Delete {{ sc.od_mm }} mm?">Delete</button>
</td>
</tr>
@@ -0,0 +1,19 @@
<tr id="static-connection-{{ sc.id }}">
<td colspan="4">
<form hx-post="/admin/static-connections/{{ sc.id }}"
hx-target="#static-connection-{{ sc.id }}"
hx-swap="outerHTML"
class="inline-edit">
<span class="muted">#{{ sc.id }}</span>
<label>OD (mm) <input type="number" name="od_mm" step="0.001" min="0" value="{{ sc.od_mm }}" required></label>
<label>OD (in) <input type="number" name="od_in" step="0.0001" min="0" value="{{ sc.od_in }}" required></label>
<div class="row-actions">
<button type="submit" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-ghost"
hx-get="/admin/static-connections/{{ sc.id }}/row"
hx-target="#static-connection-{{ sc.id }}"
hx-swap="outerHTML">Cancel</button>
</div>
</form>
</td>
</tr>
@@ -0,0 +1,19 @@
<div id="static-connection-list" class="card">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>OD (mm)</th>
<th>OD (in)</th>
<th></th>
</tr>
</thead>
<tbody>
{% for sc in static_connections %}
{% include "admin/_static_connection_row.html" %}
{% else %}
<tr><td colspan="4" class="muted">No static connections recorded.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
@@ -0,0 +1,19 @@
{% extends "base.html" %}
{% block title %}Static Connections · {{ app_name }}{% endblock %}
{% block body %}
{% include "_nav.html" %}
<main class="container">
<h1>Static Connections</h1>
<div class="card">
<h2>Add connection</h2>
<form hx-post="/admin/static-connections" hx-target="#static-connection-list" hx-swap="outerHTML" class="form-grid">
<label>OD (mm) <input type="number" name="od_mm" step="0.001" min="0" placeholder="e.g. 30.0" required></label>
<label>OD (in) <input type="number" name="od_in" step="0.0001" min="0" placeholder="e.g. 1.1811" required></label>
<button type="submit" class="btn btn-primary">Add</button>
</form>
</div>
{% include "admin/_static_connections_table.html" %}
</main>
{% endblock %}