If you haven't used this program before, a few things need to be prepared first.
It will take around 10-15 minutes.
If there are problems, you can try to prepare your data files manually,
as described here.
{{fatalErrorMsg}}
`,
mounted() {
// initialize the UI
$( "button" ).button() ;
this.isLoaded = true ;
},
methods: {
onFileSelected( file ) {
this.isProcessing = true ;
if ( ! file ) {
// this is a test of progress logging
this.uploadPdfData( null ) ;
return ;
}
if ( typeof file == "string" ) {
// this is PDF file data given to us by the test suite - just return it as is
this.uploadPdfData( file ) ;
return ;
}
this.$nextTick( () => {
gProgressPanel.addStatusBlock( "Uploading the PDF..." ) ;
// read the selected file
let fileReader = new FileReader() ;
fileReader.onload = () => {
let pdfData = fileReader.result ;
pdfData = removeBase64Prefix( pdfData ) ;
this.uploadPdfData( pdfData ) ;
} ;
fileReader.readAsDataURL( file ) ;
} ) ;
},
uploadPdfData( pdfData ) {
// upload the PDF file to the backend
let data = { pdfData: pdfData } ;
if ( gUrlParams.get( "test" ) ) {
[ "npasses", "status", "warnings", "errors", "delay" ].forEach( (arg) => {
let val = gUrlParams.get( arg ) ;
if ( val )
data[arg] = val ;
} ) ;
}
$.ajax( {
url: gPrepareDataFilesUrl, //eslint-disable-line no-undef
type: "POST",
data: JSON.stringify( data ),
contentType: "application/json",
} ).done( () => {
// tell the backend to start processing
gProgressPanel.socketIOClient.emit( "start" ) ;
} ).fail( (xhr, status, errorMsg) => {
this.fatalErrorMsg = "Couldn't start processing: " + errorMsg ;
} ) ;
},
onDone( downloadUrl ) {
// make the download available to the user
$( this.$refs.progressPanel.$el ).css( {
background: "#f0f0f0", color: "#444",
"border-color": "#aaa",
} ) ;
this.downloadUrl = downloadUrl ;
},
onFatalError( msg ) {
this.fatalErrorMsg = msg ;
},
},
} ) ;
// --------------------------------------------------------------------
gPrepareApp.component( "upload-panel", {
data() { return {
isTestMode: gUrlParams.get( "test" ),
uploadIconUrl: makeImageUrl( "eASLRB.png" ),
} ; },
template: `
Click on the button to start a test run.
Click on the button, and select your copy of MMP's eASLRB.
You must use the offical MMP eASLRB.
A scan of a printed rulebook will not work!
You should use v1.07 of the eASLRB PDF (normal version, not the "inherited zoom" version). Other versions may work, but may have warnings and/or errors.
`,
methods: {
onUploadProxy() {
// check if the test suite has left us some PDF file data to use
let $elem = $( "#testing-zip-data" ) ;
if ( $elem.length > 0 && $elem.val().length > 0 ) {
// yup - just return that
this.$emit( "file-selected", $elem.val() ) ;
$elem.val( "" ) ;
return ;
}
$elem.remove() ; // nb: this tells download-panel we are not being run by the test suite
// NOTE: It's difficult to style a file element, so we make it hidden, and present
// a