Add first implementation of loading modal

This commit is contained in:
Patrick Jentsch 2019-11-11 15:57:55 +01:00
parent 0392d25464
commit 388e7eaa60
3 changed files with 28 additions and 3 deletions

View File

@ -55,6 +55,7 @@ def observe_corpus_analysis_connection(app, corpus_id, session_id):
username='opaque') username='opaque')
analysis_client.connect() analysis_client.connect()
analysis_clients[session_id] = analysis_client analysis_clients[session_id] = analysis_client
socketio.emit('init_corpus_analysis', 'Ready', room=session_id)
while session_id in connected_sessions: while session_id in connected_sessions:
try: try:
analysis_client.ctrl_ping() analysis_client.ctrl_ping()

View File

@ -158,9 +158,7 @@
</header> </header>
<main class="grey lighten-5"> <main class="grey lighten-5">
{% block main_block %} {% block main_block %}{% endblock %}
{% endblock %}
</main> </main>
<footer class="page-footer"> <footer class="page-footer">
@ -188,6 +186,10 @@
document.getElementById("new-job"), document.getElementById("new-job"),
{"coverTrigger": false} {"coverTrigger": false}
); );
var loadingModal = document.getElementById("loading-modal");
console.log(loadingModal);
M.Modal.init(loadingModal, {"dismissible": false});
M.Modal.getInstance(loadingModal).open();
var entry; var entry;
for (entry of document.querySelectorAll("#slide-out a:not(.subheader)")) { for (entry of document.querySelectorAll("#slide-out a:not(.subheader)")) {
if (entry.href === window.location.href) { if (entry.href === window.location.href) {

View File

@ -3,6 +3,9 @@
{% block page_content %} {% block page_content %}
<script> <script>
socket.emit('init_corpus_analysis', {{ corpus_id }}); socket.emit('init_corpus_analysis', {{ corpus_id }});
socket.on('init_corpus_analysis', function(msg) {
if (msg === 'Ready') {M.Modal.getInstance(document.getElementById("loading-modal")).close();}
});
</script> </script>
@ -125,4 +128,23 @@ function sendQueryData() {
console.log('Query data has been sent!') console.log('Query data has been sent!')
} }
</script> </script>
<div id="loading-modal" class="modal no-autoinit">
<div class="modal-content">
<h4>Waiting for analysis software</h4>
<div class="preloader-wrapper big active">
<div class="spinner-layer spinner-blue-only">
<div class="circle-clipper left">
<div class="circle"></div>
</div>
<div class="gap-patch">
<div class="circle"></div>
</div>
<div class="circle-clipper right">
<div class="circle"></div>
</div>
</div>
</div>
</div>
</div>
{% endblock %} {% endblock %}