From 22f1e80c60bce43e19517aa8550ed60f69243311 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Mon, 10 Oct 2022 00:16:36 +0200 Subject: [PATCH] =?UTF-8?q?=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.svelte | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index e744210..938639d 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -335,7 +335,8 @@ } if (header === "scenar") { scenarioTxt = await getPayloadAsTxt(blob, size); - if (blobDebug) console.log("[i]", "scenarioTxt: ", scenarioTxt); + //if (blobDebug) + console.log("[i]", "scenarioTxt: ", scenarioTxt); } if (header === "settin") { let out = {}; @@ -437,6 +438,7 @@ if (blobDebug) console.log("[e]", "devParams parse error"); } } + if (header === "charta") { let txt = await getPayloadAsTxt(blob, size); txt = "[" + txt.substring(0, txt.length - 1) + "]"; @@ -445,7 +447,7 @@ chartJson = JSON.parse(txt); if (blobDebug) console.log("[i]", "chart data json: ", chartJson); } catch (e) { - if (blobDebug) console.log("[e]", "chart json parce error, return"); + if (blobDebug) console.log("[e]", "chart json data parce error, return"); return; } let out = {}; @@ -454,7 +456,7 @@ addJson = out.json; if (blobDebug) console.log("[i]", "chart add json: ", addJson); } else { - if (blobDebug) console.log("[e]", "chart json parce error, return"); + if (blobDebug) console.log("[e]", "chart json add-ns parce error, return"); return; } let finalDataJson = {}; @@ -464,9 +466,20 @@ ...finalDataJson, ...addJson, }; - console.log("[✔]", "chartJson: ", finalDataJson); + if (blobDebug) console.log("[✔]", "chartJson: ", finalDataJson); apdateWidgetByArray(finalDataJson); } + + if (header === "chartb") { + let out = {}; + if (await getPayloadAsJson(blob, size, out)) { + let status = out.json; + apdateWidgetByArray(status); + if (blobDebug) console.log("[✔]", "chart status: ", status); + } else { + if (blobDebug) console.log("[e]", "status parse error"); + } + } } async function getJsonAsJson(blob, size, out) { @@ -503,8 +516,8 @@ async function onParced() { if (currentPageName === "/|") { - clearParcedFlags(); - if (debug) console.log("✔", "dashboard data received"); + //clearParcedFlags(); + //if (debug) console.log("✔", "dashboard data received"); pageReady.dash = true; } @@ -803,18 +816,15 @@ function layoutOrderForMobileApp() {} function clearData() { - configJson = []; - widgetsJson = []; itemsJson = []; - layoutJson = []; - //layoutJsonBlobArray = []; - //chartJsonBlobArray = []; - - scenarioTxt = ""; - + widgetsJson = []; + configJson = []; + scenarioTxt = "-"; settingsJson = {}; + //ssidJson = {}; errorsJson = {}; - //coreMessages = []; + layoutJson = []; + paramsJson = {}; //? for (const [key, value] of Object.entries(pageReady)) { pageReady[key] = false; @@ -826,12 +836,7 @@ } function clearParcedFlags() { - //не сбрасывай эти флаги они живут сами по себе - //chartJsonFlag = {}; - //layoutJsonFlag = {}; - console.log("[i]", "parced flags cleared"); - for (const [key, value] of Object.entries(parsed)) { parsed[key] = false; } @@ -876,9 +881,9 @@ function wsSendMsg(ws, msg) { if (socket[ws] && socket[ws].readyState === 1) { socket[ws].send(msg); - if (debug) console.log("[i]", getIP(ws), ws, "msg send success", msg); + if (debug) console.log("[i]", getIP(ws), ws, "msg send success"); } else { - if (debug) console.log("[e]", getIP(ws), ws, "msg not send", msg); + if (debug) console.log("[e]", getIP(ws), ws, "msg not send"); } }