fix octoprint
This commit is contained in:
parent
029acb235b
commit
c658ac48b9
2 changed files with 16 additions and 7 deletions
|
|
@ -54,8 +54,12 @@
|
||||||
}
|
}
|
||||||
segment = line.message;
|
segment = line.message;
|
||||||
}
|
}
|
||||||
if (line.progress) API.show.progress(line.progress, "exporting");
|
if (line.progress) {
|
||||||
if (line.data) lines.push(line.data);
|
API.show.progress(line.progress, "exporting");
|
||||||
|
}
|
||||||
|
if (line.data) {
|
||||||
|
lines.push(line.data);
|
||||||
|
}
|
||||||
}, function(done) {
|
}, function(done) {
|
||||||
currentPrint.exported = true;
|
currentPrint.exported = true;
|
||||||
times[`${seq++}_${segment}`] = Date.now() - mark;
|
times[`${seq++}_${segment}`] = Date.now() - mark;
|
||||||
|
|
@ -161,7 +165,7 @@
|
||||||
API.show.alert("host missing protocol (http:// or https://)");
|
API.show.alert("host missing protocol (http:// or https://)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SECURE && !isSecure(host)) {
|
if (API.const.SECURE && !API.util.isSecure(host)) {
|
||||||
API.show.alert("host must begin with 'https' on a secure site");
|
API.show.alert("host must begin with 'https' on a secure site");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -180,10 +184,11 @@
|
||||||
} else {
|
} else {
|
||||||
API.show.alert("octoprint error\nstatus: "+status+"\nmessage: "+ajax.responseText);
|
API.show.alert("octoprint error\nstatus: "+status+"\nmessage: "+ajax.responseText);
|
||||||
}
|
}
|
||||||
|
API.show.progress(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ajax.upload.addEventListener('progress', function(evt) {
|
ajax.upload.addEventListener('progress', function(evt) {
|
||||||
setProgress(Math.ceil(evt.loaded/evt.total), "sending");
|
API.show.progress(evt.loaded/evt.total, "sending");
|
||||||
});
|
});
|
||||||
ajax.open("POST", host+"/api/files/local");
|
ajax.open("POST", host+"/api/files/local");
|
||||||
ajax.setRequestHeader("X-Api-Key", apik);
|
ajax.setRequestHeader("X-Api-Key", apik);
|
||||||
|
|
@ -362,11 +367,11 @@
|
||||||
} else {
|
} else {
|
||||||
API.show.alert("grid:host error\nstatus: "+status+"\nmessage: "+xhtr.responseText, 10000);
|
API.show.alert("grid:host error\nstatus: "+status+"\nmessage: "+xhtr.responseText, 10000);
|
||||||
}
|
}
|
||||||
setProgress(0);
|
API.show.progress(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhtr.upload.addEventListener('progress', function(evt) {
|
xhtr.upload.addEventListener('progress', function(evt) {
|
||||||
setProgress(Math.ceil(evt.loaded/evt.total), "sending");
|
API.show.progress(Math.ceil(evt.loaded/evt.total), "sending");
|
||||||
});
|
});
|
||||||
filename = $('print-filename').value;
|
filename = $('print-filename').value;
|
||||||
xhtr.open("POST",
|
xhtr.open("POST",
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,8 @@
|
||||||
LOCAL,
|
LOCAL,
|
||||||
MODES,
|
MODES,
|
||||||
VIEWS,
|
VIEWS,
|
||||||
SETUP
|
SETUP,
|
||||||
|
SECURE
|
||||||
},
|
},
|
||||||
var: {
|
var: {
|
||||||
layer_lo: 0,
|
layer_lo: 0,
|
||||||
|
|
@ -250,6 +251,9 @@
|
||||||
clear: clearWorkspace,
|
clear: clearWorkspace,
|
||||||
save: saveWorkspace,
|
save: saveWorkspace,
|
||||||
},
|
},
|
||||||
|
util: {
|
||||||
|
isSecure
|
||||||
|
},
|
||||||
view: {
|
view: {
|
||||||
get: function() { return viewMode },
|
get: function() { return viewMode },
|
||||||
set: setViewMode,
|
set: setViewMode,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue