From 119ee338f1500ce12b94aae510f9b1cb94b42da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sun, 30 Jun 2013 21:10:09 +0200 Subject: [PATCH] Client side filtering of M105 request/response and M27 request/response Since it's client side, if you leave these on when not printing, the log will go completely blank over time due to filling up with M105s. Re-enabling M105s will immediately restore the whole log (although it won't hold much information value). --- octoprint/static/js/ui.js | 16 ++++++++++++++++ octoprint/templates/index.jinja2 | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/octoprint/static/js/ui.js b/octoprint/static/js/ui.js index 40585297..75f39f71 100644 --- a/octoprint/static/js/ui.js +++ b/octoprint/static/js/ui.js @@ -701,6 +701,19 @@ function TerminalViewModel(loginStateViewModel) { self.isLoading = ko.observable(undefined); self.autoscrollEnabled = ko.observable(true); + self.filterM105 = ko.observable(false); + self.filterM27 = ko.observable(false); + + self.regexM105 = /(Send: M105)|(Recv: ok T:)/; + self.regexM27 = /(Send: M27)|(Recv: SD printing byte)/; + + self.filterM105.subscribe(function(newValue) { + self.updateOutput(); + }); + + self.filterM27.subscribe(function(newValue) { + self.updateOutput(); + }); self.fromCurrentData = function(data) { self._processStateData(data.state); @@ -741,6 +754,9 @@ function TerminalViewModel(loginStateViewModel) { var output = ""; for (var i = 0; i < self.log.length; i++) { + if (self.filterM105() && self.log[i].match(self.regexM105)) continue; + if (self.filterM27() && self.log[i].match(self.regexM27)) continue; + output += self.log[i] + "\n"; } diff --git a/octoprint/templates/index.jinja2 b/octoprint/templates/index.jinja2 index 8113cc79..898ae8fd 100644 --- a/octoprint/templates/index.jinja2 +++ b/octoprint/templates/index.jinja2 @@ -502,6 +502,12 @@ + +