diff --git a/src/octoprint/static/js/app/dataupdater.js b/src/octoprint/static/js/app/dataupdater.js index 6ccf18921..a1f9ca672 100644 --- a/src/octoprint/static/js/app/dataupdater.js +++ b/src/octoprint/static/js/app/dataupdater.js @@ -301,6 +301,8 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) { var type = event.data["type"]; var payload = event.data["payload"]; + var title, text, severity; + log.debug("Got event " + type + " with payload: " + JSON.stringify(payload)); if (type === "PrintCancelling" && payload.firmwareError) { @@ -319,9 +321,6 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) { hide: false }); } else if (type === "Error" && payload.error) { - var title = undefined, - text = undefined; - switch (payload.reason) { case "firmware": { title = gettext("Error reported by printer"); @@ -393,8 +392,6 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) { }); } } else if (type === "PrinterReset") { - var severity = undefined, - text = undefined; if (payload.idle) { text = gettext( "It looks like your printer reset while a connection was active. If this was intentional you may safely ignore this message. Otherwise you should investigate why your printer reset itself, since this will interrupt prints and also file transfers to your printer's SD." diff --git a/src/octoprint/static/js/app/viewmodels/terminal.js b/src/octoprint/static/js/app/viewmodels/terminal.js index 69b4ae2a8..3d25d34c1 100644 --- a/src/octoprint/static/js/app/viewmodels/terminal.js +++ b/src/octoprint/static/js/app/viewmodels/terminal.js @@ -62,7 +62,7 @@ $(function () { var regex = self.filterRegex(); var lineVisible = function (entry) { - return regex == undefined || !entry.line.match(regex); + return regex === undefined || !entry.line.match(regex); }; var filtered = false; @@ -95,7 +95,7 @@ $(function () { var regex = self.filterRegex(); var lineVisible = function (entry) { - return regex == undefined || !entry.line.match(regex); + return regex === undefined || !entry.line.match(regex); }; var lines = self.log(); @@ -237,7 +237,7 @@ $(function () { var last = self.plainLogLines()[self.plainLogLines().length - 1]; var disabled = "--- client too slow, log output disabled while printing ---"; - if (last != disabled) { + if (last !== disabled) { self.plainLogLines.push(disabled); } return; @@ -265,7 +265,7 @@ $(function () { return self._toInternalFormat(line); }) ); - if (newData.length != data.length) { + if (newData.length !== data.length) { var cutoff = "--- too many lines to buffer, cut off ---"; newLog.push(self._toInternalFormat(cutoff, "cut")); } @@ -280,11 +280,7 @@ $(function () { self._processHistoryLogData = function (data) { self.plainLogLines(data); - self.log( - _.map(data, function (line) { - return self._toInternalFormat(line); - }) - ); + self.log(_.map(data, self._toInternalFormat)); self.updateOutput(); }; @@ -322,7 +318,7 @@ $(function () { self.updateFilterRegex = function () { var filterRegexStr = self.activeFilters().join("|").trim(); - if (filterRegexStr == "") { + if (filterRegexStr === "") { self.filterRegex(undefined); } else { self.filterRegex(new RegExp(filterRegexStr)); @@ -461,15 +457,15 @@ $(function () { self.handleKeyDown = function (event) { var keyCode = event.keyCode; - if (keyCode == 38 || keyCode == 40) { + if (keyCode === 38 || keyCode === 40) { if ( - keyCode == 38 && + keyCode === 38 && self.cmdHistory.length > 0 && self.cmdHistoryIdx > 0 ) { self.cmdHistoryIdx--; } else if ( - keyCode == 40 && + keyCode === 40 && self.cmdHistoryIdx < self.cmdHistory.length - 1 ) { self.cmdHistoryIdx++; @@ -493,7 +489,7 @@ $(function () { }; self.handleKeyUp = function (event) { - if (event.keyCode == 13) { + if (event.keyCode === 13) { self.sendCommand(); } @@ -502,7 +498,7 @@ $(function () { }; self.onAfterTabChange = function (current, previous) { - self.tabActive = current == "#term"; + self.tabActive = current === "#term"; self.updateOutput(); };