Fix more tab weirdness.

Move tab buttons onto tab bar.
Calculate size of maxTabs automatically on page load.
Display total execution time when a bake finishes.
This commit is contained in:
j433866 2019-04-04 10:15:13 +01:00
parent 1eadc08098
commit b90cca77a9
4 changed files with 88 additions and 131 deletions

View file

@ -275,7 +275,22 @@ class WorkerWaiter {
*/
bakingComplete() {
this.setBakingStatus(false);
let duration = new Date().getTime() - this.bakeStartTime;
duration = duration.toString() + "ms";
const progress = this.getBakeProgress();
let width = progress.total.toString().length;
if (duration.length > width) {
width = duration.length;
}
width = width < 2 ? 2 : width;
const totalStr = progress.total.toString().padStart(width, " ").replace(/ /g, "&nbsp;");
const durationStr = duration.padStart(width, " ").replace(/ /g, "&nbsp;");
const msg = `Total: ${totalStr}<br>Time: ${durationStr}`;
document.getElementById("bake-info").innerHTML = msg;
// look into changing this to something better
// for (let i = 0; i < this.outputs.length; i++) {
// if (this.outputs[i].data.error) {
@ -308,6 +323,7 @@ class WorkerWaiter {
*/
bake(input, recipeConfig, options, progress, step) {
this.setBakingStatus(true);
this.bakeStartTime = new Date().getTime();
if (typeof input === "string") {
input = [{