Merge pull request #9 from dacarley/unresponsive-on-first-file-upload

Fixed the issue where the UI becomes unresponsive on the first file upload
This commit is contained in:
OneFinityCNC
2021-03-03 00:09:19 -05:00
committed by GitHub
2 changed files with 58 additions and 58 deletions

View File

@@ -524,15 +524,20 @@ module.exports = {
},
load_toolpath: function (file, file_time) {
load_toolpath: async function (file, file_time) {
this.toolpath = {};
if (!file) return;
api.get('path/' + file).done(function (toolpath) {
if (this.last_file_time != file_time) return;
this.showGcodeMessage = true;
let done = false;
while (!done) {
const toolpath = await api.get(`path/${file}`);
if (typeof toolpath.progress == 'undefined') {
done = true;
toolpath.filename = file;
this.toolpath_progress = 1;
this.showGcodeMessage = false;
@@ -544,13 +549,10 @@ module.exports = {
Vue.set(state, 'path_min_' + axis, bounds.min[axis]);
Vue.set(state, 'path_max_' + axis, bounds.max[axis]);
}
} else {
this.showGcodeMessage = true;
this.toolpath_progress = toolpath.progress;
this.load_toolpath(file, file_time); // Try again
}
}.bind(this));
}
},