From 4dea9f08efe2a66e7a70656dd96cc6bd2e4e0eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 15 Oct 2020 13:55:11 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Highlight=20warnings=20in=20term?= =?UTF-8?q?inal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/js/app/viewmodels/terminal.js | 23 +++++++++++++++---- src/octoprint/templates/tabs/terminal.jinja2 | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/terminal.js b/src/octoprint/static/js/app/viewmodels/terminal.js index a041974aa..dbb8ec1f8 100644 --- a/src/octoprint/static/js/app/viewmodels/terminal.js +++ b/src/octoprint/static/js/app/viewmodels/terminal.js @@ -288,11 +288,26 @@ $(function () { self.updateOutput(); }; - self._toInternalFormat = function (line, type) { - if (type == undefined) { - type = "line"; + self._toInternalFormat = function (line, display, type) { + if (display === undefined) { + display = "line"; } - return {line: escapeUnprintableCharacters(line), type: type}; + + if (type === undefined) { + if (line.startsWith("Recv:")) { + type = "recv"; + } else if (line.startsWith("Send:")) { + type = "send"; + } else if (line.startsWith("Warn:")) { + type = "warn"; + } + } + + return { + line: escapeUnprintableCharacters(line), + display: display, + type: type + }; }; self._processStateData = function (data) { diff --git a/src/octoprint/templates/tabs/terminal.jinja2 b/src/octoprint/templates/tabs/terminal.jinja2 index eb0cc291b..20eed9104 100644 --- a/src/octoprint/templates/tabs/terminal.jinja2 +++ b/src/octoprint/templates/tabs/terminal.jinja2 @@ -1,5 +1,5 @@
-
+