From e2cecc27bfa909c2db630902679d5c9e4132b48c Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 25 Sep 2020 18:55:58 -0400 Subject: [PATCH] Display current and remaining job time --- package-lock.json | 13 +++++++++++++ package.json | 1 + src/PrinterCard.vue | 26 +++++++++++++++----------- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index fc5444b..13d2ba2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4904,6 +4904,11 @@ "json-parse-better-errors": "^1.0.1" } }, + "parse-ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz", + "integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==" + }, "parse5": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", @@ -5438,6 +5443,14 @@ "dev": true, "optional": true }, + "pretty-ms": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz", + "integrity": "sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==", + "requires": { + "parse-ms": "^2.1.0" + } + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", diff --git a/package.json b/package.json index 308920e..2650e06 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "node-fetch": "^2.6.1", "node-gyp": "^7.1.0", "parcel-bundler": "^1.12.4", + "pretty-ms": "^7.0.1", "ts-node": "^9.0.0", "vue": "^2.6.12", "vue-class-component": "^7.2.5", diff --git a/src/PrinterCard.vue b/src/PrinterCard.vue index cefe38c..719d024 100644 --- a/src/PrinterCard.vue +++ b/src/PrinterCard.vue @@ -5,17 +5,16 @@
{{ status.state.text }}
Job File Name: {{ status.job.file.name || 'None' }}
-
- Job Completion: - {{ status.progress.completion }}% - - {{ status.progress.completion }}% - - - +
+
+ Job Completion: + {{ status.progress.completion.toFixed(2) }}% + +
+
+ Job Time: {{ formatDuration(status.progress.printTime) }} elapsed, + {{ formatDuration(status.progress.printTimeLeft) }} left +
User: {{ status.job.user || '-' }}
@@ -24,6 +23,7 @@