Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions src/web_interface/static/fact_loading.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 13 additions & 2 deletions src/web_interface/static/js/loading.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
function showImg() {
$('#form').hide();
$('#loading_img').css({'display': 'block'});
$('#loading-img').css({'display': 'block'});
}

function hideImg() {
$('#form').show();
$('#loading_img').css({'display': 'none'});
$('#loading-img').css({'display': 'none'});
}

function loadLoadingAnimation(elementId) {
fetch("/static/fact_loading.svg")
.then(response => response.text())
.then(data => {
document.getElementById(elementId).innerHTML = data;
})
.catch(error => {
console.error('Error loading loading animation:', error);
});
}
4 changes: 1 addition & 3 deletions src/web_interface/templates/database/database_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ <h3 class="mb-3">Search Firmware Database</h3>
</div>


<button type="submit" value=submit class="btn btn-primary" id="input_submit" onclick="showImg()">
<button type="submit" value=submit class="btn btn-primary" id="input_submit">
<i class="fas fa-search"></i> Search
</button>

</form>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it redundant here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there was still the <img ...> element in the code, but since starting the search loads the next page directly, it was not actually visible here.

<img id="loading_img" src="{{ url_for('.static', filename='Pacman.gif') }}" style="display: none; margin: auto;"/>
</div>
</div>

Expand Down
5 changes: 4 additions & 1 deletion src/web_interface/templates/show_analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
}
});
</script>
<script type="text/javascript" src="{{ url_for('static', filename='js/loading.js') }}"></script>

<style>
{# styling for file preview line lumbers #}
Expand Down Expand Up @@ -119,9 +120,11 @@ <h3>

<div id="summary-div">
<div class="mb-3 border" id="loading-summary-gif" style="display: none; padding: 5px; text-align: center">
<img src="{{ url_for("static", filename = "Pacman.gif") }}" alt="loading gif">
<p>Loading summary for included files...</p>
</div>
<script>
loadLoadingAnimation('loading-summary-gif');
</script>
</div>
<script type="text/javascript" src="{{ url_for('static', filename='js/show_analysis_summary.js') }}"></script>

Expand Down
4 changes: 3 additions & 1 deletion src/web_interface/templates/show_analysis/preview.j2
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@
</div>
</div>
<div id="preview-loading-gif" class="border" style="display: block; padding: 5px; text-align: center">
<img src="{{ url_for('static', filename = 'Pacman.gif') }}" alt="loading...">
</div>
<script>
loadLoadingAnimation('preview-loading-gif');
</script>
<div id="preview-content" class="m-0 mt-2 p-0"></div>
</div>

Expand Down
8 changes: 6 additions & 2 deletions src/web_interface/templates/upload/upload.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,12 @@ <h3 class="mb-3">Upload Firmware</h3>
</form>
</div>

<img id="loading_img" src="{{ url_for('.static', filename='Pacman.gif') }}"
alt="loading..." style="display: none; margin: auto;"/>
<div class="mb-3" id="loading-img" style="display: none; padding: 5px; text-align: center">
<p>Upload in progress...</p>
</div>
<script>
loadLoadingAnimation('loading-img');
</script>
</div>
</div>

Expand Down