Object detail page added. but error.
This commit is contained in:
@@ -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.routers.objects import router as api_router # to call internal endpoints
|
||||||
from packetserver.http.database import DbDependency
|
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 get_object_metadata as api_get_metadata
|
||||||
|
from packetserver.http.routers.objects import ObjectUpdate
|
||||||
|
|
||||||
|
|
||||||
router = APIRouter(tags=["objects_html"])
|
router = APIRouter(tags=["objects_html"])
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% for obj in objects %}
|
{% for obj in objects %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>{{ obj.name }}</strong></td>
|
<td><a href="/objects/{{ obj.uuid }}"><strong>{{ obj.name }}</strong></a></td>
|
||||||
<td>
|
<td>
|
||||||
{% if obj.size < 1024 %}
|
{% if obj.size < 1024 %}
|
||||||
{{ obj.size }} bytes
|
{{ 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>
|
<a href="/api/v1/objects/{{ obj.uuid }}/text" class="btn btn-sm btn-outline-info" target="_blank">View Text</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="/api/v1/objects/{{ obj.uuid }}/download" class="btn btn-sm btn-primary">Download</a>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -101,16 +100,5 @@
|
|||||||
<p>No objects uploaded yet.</p>
|
<p>No objects uploaded yet.</p>
|
||||||
{% endif %}
|
{% 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 %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user