Skip to content

Commit 7ba9d53

Browse files
authored
Merge pull request #41 from baloise/main
add loading spinner
2 parents df75f46 + d1c3c42 commit 7ba9d53

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/static/scripts/mask.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ document.getElementById('btnLLMReset').addEventListener('click', function() {
6969
document.getElementById('inputForm').addEventListener('submit', function(event) {
7070
event.preventDefault(); // Prevent the default form submission
7171

72+
document.getElementById('loading-spinner').style.display = 'flex';
73+
7274
const inputData = document.getElementById('inputData').value;
7375
const backendType = document.getElementById('backendType').value;
7476
const inputLLMurl = document.getElementById('inputLLMurl').value;
@@ -94,8 +96,10 @@ document.getElementById('inputForm').addEventListener('submit', function(event)
9496
.then(text => {
9597
// Display the response in the textarea
9698
document.getElementById('responseFieldText').value = JSON.stringify(text.original_text, null, 2); // Format the JSON response
97-
document.getElementById('responseFieldEntities').value = JSON.stringify(text.entities, null, 2); // Format the JSON response
98-
document.getElementById('responseFieldAnonText').value = JSON.stringify(text.anonymized_text, null, 2); // Format the string response
99+
document.getElementById('responseFieldEntities').value = JSON.stringify(text.entities, null, 2);
100+
document.getElementById('responseFieldAnonText').value = JSON.stringify(text.anonymized_text, null, 2);
101+
102+
document.getElementById('loading-spinner').style.display = 'none';
99103
})
100104
.catch((error) => {
101105
console.error('Error:', error); // Handle any errors

src/static/styles/style.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,19 @@ footer {
107107
.url-nounderline {
108108
text-decoration: none;
109109
color: var(--link-color);
110+
}
111+
112+
#loading-spinner {
113+
display: none; /* Initially hidden */
114+
width: 25px;
115+
height: 25px;
116+
border-radius: 50%;
117+
border: 3px solid #f3f3f3;
118+
border-top: 3px solid #000000;
119+
animation: spin 1s linear infinite;
120+
}
121+
122+
@keyframes spin {
123+
from { transform: rotate(0deg); }
124+
to { transform: rotate(360deg); }
110125
}

src/templates/html/mask.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ <h1>YoYo MaskЯ</h1>
2525
<div class="flex-item">
2626
<h3>Input</h3>
2727
</div>
28+
<div class="flex-item">
29+
<div id="loading-spinner"></div>
30+
</div>
2831
<div class="flex-item">
2932
<form id="inputForm">
3033
<textarea class="default-textarea" type="text" id="inputData" placeholder="Enter text to anonymize or load text from a file" required></textarea>

0 commit comments

Comments
 (0)