From 5c39e9a8a3d9bdd4e337923004384d208008f6d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 23 Nov 2016 14:28:50 +0100 Subject: [PATCH] Demote pip upgrade message from stderr to stdout in client output Having that output stay on stderr and hence in shiny red looks way too alarming considering that it's only a pip update that is not THAT critical usually (and we don't want to do it automatically anyhow considering how often that appears to break stuff). --- .../plugins/pluginmanager/static/js/pluginmanager.js | 11 ++++++++++- .../softwareupdate/static/js/softwareupdate.js | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js index 61e1ed6c..1787dc62 100644 --- a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js +++ b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js @@ -646,6 +646,7 @@ $(function() { self.loglines.removeAll(); self.loglines.push({line: line, stream: "message"}); + self._scrollWorkingOutputToEnd(); self.workingDialog.modal("show"); }; @@ -746,7 +747,7 @@ $(function() { if (messageType == "loglines" && self.working()) { _.each(data.loglines, function(line) { - self.loglines.push(line); + self.loglines.push(self._preprocessLine(line)); }); self._scrollWorkingOutputToEnd(); } else if (messageType == "result") { @@ -861,6 +862,14 @@ $(function() { self.requestData(); } }; + + self._forcedStdoutLine = /You are using pip version .*?, however version .*? is available\.|You should consider upgrading via the '.*?' command\./; + self._preprocessLine = function(line) { + if (line.stream == "stderr" && line.line.match(self._forcedStdoutLine)) { + line.stream = "stdout"; + } + return line; + } } // view model class, parameters for constructor, container to bind to diff --git a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js index 294c65d4..c9234e0b 100644 --- a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js +++ b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js @@ -539,7 +539,7 @@ $(function() { case "loglines": { if (self.working()) { _.each(messageData.loglines, function(line) { - self.loglines.push(line); + self.loglines.push(self._preprocessLine(line)); }); self._scrollWorkingOutputToEnd(); } @@ -557,6 +557,7 @@ $(function() { self.loglines.push({line: _.repeat("+", text.length), stream: "separator"}); self.loglines.push({line: text, stream: "message"}); self.loglines.push({line: _.repeat("+", text.length), stream: "separator"}); + self._scrollWorkingOutputToEnd(); self._updatePopup({ text: text, hide: false, @@ -584,6 +585,7 @@ $(function() { }; self.loglines.push({line: text, stream: "message"}); + self._scrollWorkingOutputToEnd(); self.waitingForRestart = true; self.restartTimeout = setTimeout(function() { @@ -694,6 +696,13 @@ $(function() { } }; + self._forcedStdoutLine = /You are using pip version .*?, however version .*? is available\.|You should consider upgrading via the '.*?' command\./; + self._preprocessLine = function(line) { + if (line.stream == "stderr" && line.line.match(self._forcedStdoutLine)) { + line.stream = "stdout"; + } + return line; + } } // view model class, parameters for constructor, container to bind to