Fix random crash when updating monitor and monitor is not visible

due to continuous data coming from printer
Apply astyle
Add  sanity check in dialog
This commit is contained in:
Luc
2020-05-29 10:07:31 +02:00
parent 896a4c5491
commit 52115cb10f
9 changed files with 52 additions and 17 deletions

6
.gitignore vendored
View File

@@ -1 +1,7 @@
node_modules
dist/images/jogdial.svg
dist/images/jogdial1.svg
dist/images/jogdial2.svg
dist/images/printer.tpl.htm
dist/images/repetier.htm
dist/index.html

View File

Binary file not shown.

View File

Binary file not shown.

16
package-lock.json generated
View File

@@ -11032,7 +11032,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@@ -11329,7 +11330,8 @@
"npm-normalize-package-bin": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"npm-packlist": {
"version": "1.4.8",
@@ -11448,7 +11450,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -11504,6 +11507,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -11547,12 +11551,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},

View File

@@ -26,7 +26,7 @@ import { SendCommand } from "../http"
import { useStoreon } from "storeon/preact"
const { isVerboseData } = require(`../${process.env.TARGET_ENV}`)
import { showDialog } from "../dialog"
import { preferences } from "../app"
import { Page, preferences } from "../app"
/*
* Local variables
@@ -98,7 +98,10 @@ function updateContentType() {
const { dispatch } = useStoreon()
if (verboseOutput) currentOutput = monitorDataVerbose
else currentOutput = monitorDataQuiet
dispatch("monitor/set", currentOutput)
const { showTerminal } = useStoreon("showTerminal")
const { activePage } = useStoreon("activePage")
if (showTerminal && activePage == Page.dashboard)
dispatch("monitor/set", currentOutput)
}
/*

View File

@@ -104,6 +104,7 @@ function hideDialog() {
const DialogPage = () => {
const { showDialog } = useStoreon("showDialog")
const { dialogData } = useStoreon("dialogData")
if (!dialogData) return
//console.log(dialogData)
if (!showDialog) {
disableNode(document.getElementById("mainwindow"), false)

View File

@@ -219,20 +219,26 @@ function processCommands() {
pausePing(true)
currentHttpCommand = new XMLHttpRequest()
let isdownload = false
if (typeof httpCommandList[0].id !="undefined"){
if (httpCommandList[0].id=="download")isdownload=true
if (typeof httpCommandList[0].id != "undefined") {
if (httpCommandList[0].id == "download") isdownload = true
}
if (isdownload) currentHttpCommand.responseType="blob"
if (isdownload) currentHttpCommand.responseType = "blob"
currentHttpCommand.onreadystatechange = function() {
if (currentHttpCommand.readyState == 4) {
if (currentHttpCommand.status == 200) {
defaultHttpResultFn(isdownload?currentHttpCommand.response:currentHttpCommand.responseText)
defaultHttpResultFn(
isdownload
? currentHttpCommand.response
: currentHttpCommand.responseText
)
} else {
if (currentHttpCommand.status == 401)
requestAuthentication()
defaultHttpErrorFn(
currentHttpCommand.status,
isdownload?currentHttpCommand.response:currentHttpCommand.responseText
isdownload
? currentHttpCommand.response
: currentHttpCommand.responseText
)
}
}

View File

@@ -802,7 +802,13 @@ const FilesControls = () => {
<span class="hide-low text-button">{T("S50")}</span>
</button>
</div>
<div class={(fileSystemLoaded[currentFilesType] && canUpload()) ? "p-1" : "d-none"}>
<div
class={
fileSystemLoaded[currentFilesType] && canUpload()
? "p-1"
: "d-none"
}
>
<button
type="button"
title={T("S89")}
@@ -829,7 +835,12 @@ const FilesControls = () => {
<button
type="button"
title={T("S90")}
class={(fileSystemLoaded[currentFilesType] && canCreateDirectory()) ? "btn btn-info" : "d-none"}
class={
fileSystemLoaded[currentFilesType] &&
canCreateDirectory()
? "btn btn-info"
: "d-none"
}
onClick={clickCreateDirectory}
>
<FolderPlus />
@@ -863,8 +874,10 @@ const FilesPanel = () => {
if (!showFiles) return null
const { filesStatus } = useStoreon("filesStatus")
const { filesList } = useStoreon("filesList")
if (typeof fileSystemLoaded[currentFilesType] == "undefined")fileSystemLoaded[currentFilesType] = false
if (fileSystemLoaded[currentFilesType] == false && prefs.autoload) refreshFilesList()
if (typeof fileSystemLoaded[currentFilesType] == "undefined")
fileSystemLoaded[currentFilesType] = false
if (fileSystemLoaded[currentFilesType] == false && prefs.autoload)
refreshFilesList()
return (
<div class="w-100 panelCard">
<div class="p-2 ">

View File

@@ -19,4 +19,4 @@
*/
import { h } from "preact"
export const Esp3dVersion = () => <span>3.0.0.27</span>
export const Esp3dVersion = () => <span>3.0.0.28</span>