File size: 4,379 Bytes
fa5e1fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
{% extends 'base.html' %}

{% block content %}
<style>
    /* Ensure the body takes full height for proper layout */
    html, body {
        height: 100%;
        margin: 0;
    }

    .container {
        display: flex;
        flex-direction: column;
        height: 50vh; /* Full height of the viewport */
        overflow: hidden; /* Prevent extra scrollbars */
    }

    .card {
        margin: auto;
        background-color: #2c2c3e;
        color: #f5f5f5;
        border: none;
        width: 50%; /* Centered and appropriately sized */
        max-height: calc(50vh - 50px); /* Adjust to fit within view */
        overflow-y: auto; /* Add scrolling if content overflows */
    }

    .card-header {
        background-color: #181831;
        border-bottom: 2px solid #444;
        padding: 1rem;
        text-align: center;
        position: sticky; /* Keeps header fixed */
        top: 0;
        z-index: 1000; /* Ensures it stays above scrollable content */
    }

    .text-muted {
        --bs-text-opacity: 1;
        color: rgb(121 136 151 / 75%) !important;
    }

    .form-label {
        font-weight: bold;
        color: #cfcfcf;
    }

    .form-control {
        background-color: #1e1e2f;
        color: #f5f5f5;
        border: 1px solid #444;
    }

    .form-control:focus {
        background-color: #1e1e2f;
        color: #f5f5f5;
        border-color: #4c4cff;
        box-shadow: 0 0 4px #4c4cff;
    }

    .btn-primary {
        background-color: #4c4cff;
        border-color: #4c4cff;
    }

    .btn-primary:hover {
        background-color: #3838e8;
        border-color: #3838e8;
    }

    /* Custom scrollbar */
    .card::-webkit-scrollbar {
        width: 8px;
    }

    .card::-webkit-scrollbar-thumb {
        background-color: #444;
        border-radius: 4px;
    }

    /* Loader styling */
    #loader {
        display: none; /* Hidden by default */
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 9999;
    }

    .spinner {
        width: 50px;
        height: 50px;
        border: 5px solid #f3f3f3;
        border-top: 5px solid #3498db;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

    @keyframes spin {
        0% {
            transform: rotate(0deg);
        }
        100% {
            transform: rotate(360deg);
        }
    }

    .loading-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(255, 255, 255, 0.8);
        z-index: 9998;
        display: none; /* Hidden by default */
    }
</style>

<!-- Loader HTML -->
<div id="loader" class="loading-overlay">
    <div class="spinner"></div>
</div>

<!-- Main Content -->
<div class="container mt-5">
    <div class="card shadow">
        <div class="card-header">
            <h3>Create a New Vector Database</h3>
        </div>
        <div class="card-body">
            <form id="db-form" method="post" enctype="multipart/form-data">
                <!-- Database Name Input -->
                <div class="form-group">
                    <label for="db_name" class="form-label">Database Name</label>
                    <input type="text" id="db_name" name="db_name" class="form-control" placeholder="Enter database name" required>
                </div>
            
                <!-- Folder Upload Input -->
                <div class="form-group mt-3">
                    <label for="folder" class="form-label">Upload Folder</label>
                    <input type="file" id="folder" name="folder" class="form-control" webkitdirectory directory multiple required>
                    <small class="text-muted">Note: You can upload folder having your documents.</small>
                </div>
            
                <!-- Submit Button -->
                <div class="mt-4 text-center">
                    <button type="submit" class="btn btn-primary px-5">Create</button>
                </div>
            </form>
        </div>
    </div>
</div>

<script>
    // Show loader on form submission
    const form = document.getElementById('db-form');
    const loader = document.getElementById('loader');

    form.addEventListener('submit', function (event) {
        loader.style.display = 'flex'; // Show loader
    });
</script>

{% endblock %}