Object detail page added. but error.

This commit is contained in:
Michael Woods
2025-12-26 14:35:07 -05:00
parent 7d99eecc61
commit fda75aa822
2 changed files with 2 additions and 13 deletions

View File

@@ -9,6 +9,7 @@ from packetserver.http.server import templates
from packetserver.http.routers.objects import router as api_router # to call internal endpoints
from packetserver.http.database import DbDependency
from packetserver.http.routers.objects import get_object_metadata as api_get_metadata
from packetserver.http.routers.objects import ObjectUpdate
router = APIRouter(tags=["objects_html"])

View File

@@ -61,7 +61,7 @@
<tbody>
{% for obj in objects %}
<tr>
<td><strong>{{ obj.name }}</strong></td>
<td><a href="/objects/{{ obj.uuid }}"><strong>{{ obj.name }}</strong></a></td>
<td>
{% if obj.size < 1024 %}
{{ obj.size }} bytes
@@ -91,7 +91,6 @@
<a href="/api/v1/objects/{{ obj.uuid }}/text" class="btn btn-sm btn-outline-info" target="_blank">View Text</a>
{% endif %}
<a href="/api/v1/objects/{{ obj.uuid }}/download" class="btn btn-sm btn-primary">Download</a>
<button type="button" class="btn btn-sm btn-danger" onclick="deleteObject('{{ obj.uuid }}', '{{ obj.name | e }}')">Delete</button>
</td>
</tr>
{% endfor %}
@@ -101,16 +100,5 @@
<p>No objects uploaded yet.</p>
{% endif %}
<script>
async function deleteObject(uuid, name) {
if (!confirm(`Permanently delete ${name}?`)) return;
const response = await fetch(`/api/v1/objects/${uuid}`, { method: 'DELETE' });
if (response.ok) {
location.reload();
} else {
alert('Delete failed');
}
}
</script>
{% endblock %}