File size: 2,843 Bytes
97db660
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!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>