EduConnect / app /admin /templates /data_management.html
dtyago's picture
Cleanup code for better UX
5b1d21d
<!DOCTYPE html>
<html>
<head>
<title>Econnect Data Management</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/css/mvp.css" rel="stylesheet" media="screen">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
</head>
<body>
<h1>Face DB</h1>
<div>
<p>Total Faces: {{ faces.face_count }}</p>
<h2>Registered faces:</h2>
<p>{{ faces.all_faces }}</p>
<hr>
<h2>All collections:</h2>
<p>{{ faces.all_collections }}</p>
</div>
<hr>
<div class="container">
<h2>User Registration</h2>
<form id="deleteForm" action="/admin/delete_faces" method="post" enctype="multipart/form-data">
<h2>Delete and clean vectordb:</h2>
<!-- Updated button to only trigger the modal -->
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#confirmationModal">Delete ALL</button>
</form>
{% if error %}
<p class="error"><strong>Error:</strong> {{ error }}</p>
{% endif %}
</div>
<!-- Modal -->
<div class="modal fade" id="confirmationModal" tabindex="-1" role="dialog" aria-labelledby="confirmationModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="confirmationModalLabel">Confirm Deletion</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Are you sure you want to delete ALL faces?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" id="confirmDelete">Delete All</button>
</div>
</div>
</div>
</div>
<!-- Bootstrap and jQuery scripts -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', (event) => {
document.getElementById('confirmDelete').addEventListener('click', function() {
document.getElementById('deleteForm').submit();
});
});
</script>
</body>
</html>