Tightened up when we show the spinner when preparing the data files.

master
Pacman Ghost 3 years ago
parent 403ef6cdc1
commit 5433630a5c
  1. 1
      asl_rulebook2/webapp/static/css/prepare.css
  2. 10
      asl_rulebook2/webapp/static/prepare.js

@ -33,6 +33,7 @@ code { display: block ; margin: 5px 0 5px 20px ; }
padding: 10px ; padding: 10px ;
background: #f0f0f0 ; background: #f0f0f0 ;
font-size: 80% ; font-style: italic ; text-align: center ; font-size: 80% ; font-style: italic ; text-align: center ;
transition: opacity 5s ;
} }
#download-panel { #download-panel {

@ -185,13 +185,15 @@ gPrepareApp.component( "progress-panel", {
data() { return { data() { return {
socketIOClient: null, socketIOClient: null,
statusBlocks: [], statusBlocks: [],
isDone: false, isDone: false, isError: false
} ; }, } ; },
// FUDGE! Opening the PDF is synchronous, which makes the webserver unresponsive while it's happening,
// so we delay showing the "features" link to the user until we get past that point.
template: ` template: `
<div id="progress-panel"> <div id="progress-panel">
<status-block v-for="sb in statusBlocks" :statusBlock=sb :key=sb /> <status-block v-for="sb in statusBlocks" :statusBlock=sb :key=sb />
<div v-if="!isDone" class="loading"> <div v-if="!isDone && !isError" :style="{ opacity: statusBlocks.length >= 3 ? 1 : 0 }" class="loading">
<img src="/static/images/loading.gif" /> <img src="/static/images/loading.gif" />
<div style="margin-top:3px;"> <div style="margin-top:3px;">
While you're waiting, you can <br> check out the features <a href="/doc/features/index.html" target="_blank">here</a>. While you're waiting, you can <br> check out the features <a href="/doc/features/index.html" target="_blank">here</a>.
@ -211,8 +213,10 @@ gPrepareApp.component( "progress-panel", {
// initialize the socketio client // initialize the socketio client
this.socketIOClient = io.connect() ; //eslint-disable-line no-undef this.socketIOClient = io.connect() ; //eslint-disable-line no-undef
this.socketIOClient.on( "disconnect", () => { this.socketIOClient.on( "disconnect", () => {
if ( ! this.isDone ) if ( ! this.isDone ) {
this.$emit( "fatal", "The server has gone away. Please restart it, then reload this page." ) ; this.$emit( "fatal", "The server has gone away. Please restart it, then reload this page." ) ;
this.isError = true ;
}
} ) ; } ) ;
this.socketIOClient.on( "status", (msg) => { this.addStatusBlock( msg ) ; } ) ; this.socketIOClient.on( "status", (msg) => { this.addStatusBlock( msg ) ; } ) ;
this.socketIOClient.on( "progress", (msg) => { this.addProgressMsg( "info", msg ) ; } ) ; this.socketIOClient.on( "progress", (msg) => { this.addProgressMsg( "info", msg ) ; } ) ;

Loading…
Cancel
Save