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).
master
Gina Häußge 2013-06-30 21:10:09 +02:00
parent 98d4317e6f
commit 119ee338f1
2 changed files with 22 additions and 0 deletions

View File

@ -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";
}

View File

@ -502,6 +502,12 @@
<label class="checkbox">
<input type="checkbox" id="terminal-autoscroll" data-bind="checked: autoscrollEnabled"> Autoscroll
</label>
<label class="checkbox">
<input type="checkbox" id="terminal-filterM105" data-bind="checked: filterM105"> Suppress M105 requests/responses
</label>
<label class="checkbox">
<input type="checkbox" id="terminal-filterM27" data-bind="checked: filterM27"> Suppress M27 requests/responses
</label>
<div class="input-append" style="display: none;" data-bind="visible: loginState.isUser">
<input type="text" id="terminal-command" data-bind="enable: isOperational() && loginState.isUser()">