mirror of
https://github.com/IoTManagerProject/IoTManagerWeb.git
synced 2026-03-26 23:12:34 +03:00
графики
This commit is contained in:
@@ -335,7 +335,8 @@
|
|||||||
}
|
}
|
||||||
if (header === "scenar") {
|
if (header === "scenar") {
|
||||||
scenarioTxt = await getPayloadAsTxt(blob, size);
|
scenarioTxt = await getPayloadAsTxt(blob, size);
|
||||||
if (blobDebug) console.log("[i]", "scenarioTxt: ", scenarioTxt);
|
//if (blobDebug)
|
||||||
|
console.log("[i]", "scenarioTxt: ", scenarioTxt);
|
||||||
}
|
}
|
||||||
if (header === "settin") {
|
if (header === "settin") {
|
||||||
let out = {};
|
let out = {};
|
||||||
@@ -437,6 +438,7 @@
|
|||||||
if (blobDebug) console.log("[e]", "devParams parse error");
|
if (blobDebug) console.log("[e]", "devParams parse error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header === "charta") {
|
if (header === "charta") {
|
||||||
let txt = await getPayloadAsTxt(blob, size);
|
let txt = await getPayloadAsTxt(blob, size);
|
||||||
txt = "[" + txt.substring(0, txt.length - 1) + "]";
|
txt = "[" + txt.substring(0, txt.length - 1) + "]";
|
||||||
@@ -445,7 +447,7 @@
|
|||||||
chartJson = JSON.parse(txt);
|
chartJson = JSON.parse(txt);
|
||||||
if (blobDebug) console.log("[i]", "chart data json: ", chartJson);
|
if (blobDebug) console.log("[i]", "chart data json: ", chartJson);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (blobDebug) console.log("[e]", "chart json parce error, return");
|
if (blobDebug) console.log("[e]", "chart json data parce error, return");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let out = {};
|
let out = {};
|
||||||
@@ -454,7 +456,7 @@
|
|||||||
addJson = out.json;
|
addJson = out.json;
|
||||||
if (blobDebug) console.log("[i]", "chart add json: ", addJson);
|
if (blobDebug) console.log("[i]", "chart add json: ", addJson);
|
||||||
} else {
|
} else {
|
||||||
if (blobDebug) console.log("[e]", "chart json parce error, return");
|
if (blobDebug) console.log("[e]", "chart json add-ns parce error, return");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let finalDataJson = {};
|
let finalDataJson = {};
|
||||||
@@ -464,9 +466,20 @@
|
|||||||
...finalDataJson,
|
...finalDataJson,
|
||||||
...addJson,
|
...addJson,
|
||||||
};
|
};
|
||||||
console.log("[✔]", "chartJson: ", finalDataJson);
|
if (blobDebug) console.log("[✔]", "chartJson: ", finalDataJson);
|
||||||
apdateWidgetByArray(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) {
|
async function getJsonAsJson(blob, size, out) {
|
||||||
@@ -503,8 +516,8 @@
|
|||||||
|
|
||||||
async function onParced() {
|
async function onParced() {
|
||||||
if (currentPageName === "/|") {
|
if (currentPageName === "/|") {
|
||||||
clearParcedFlags();
|
//clearParcedFlags();
|
||||||
if (debug) console.log("✔", "dashboard data received");
|
//if (debug) console.log("✔", "dashboard data received");
|
||||||
pageReady.dash = true;
|
pageReady.dash = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,18 +816,15 @@
|
|||||||
function layoutOrderForMobileApp() {}
|
function layoutOrderForMobileApp() {}
|
||||||
|
|
||||||
function clearData() {
|
function clearData() {
|
||||||
configJson = [];
|
|
||||||
widgetsJson = [];
|
|
||||||
itemsJson = [];
|
itemsJson = [];
|
||||||
layoutJson = [];
|
widgetsJson = [];
|
||||||
//layoutJsonBlobArray = [];
|
configJson = [];
|
||||||
//chartJsonBlobArray = [];
|
scenarioTxt = "-";
|
||||||
|
|
||||||
scenarioTxt = "";
|
|
||||||
|
|
||||||
settingsJson = {};
|
settingsJson = {};
|
||||||
|
//ssidJson = {};
|
||||||
errorsJson = {};
|
errorsJson = {};
|
||||||
//coreMessages = [];
|
layoutJson = [];
|
||||||
|
paramsJson = {}; //?
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(pageReady)) {
|
for (const [key, value] of Object.entries(pageReady)) {
|
||||||
pageReady[key] = false;
|
pageReady[key] = false;
|
||||||
@@ -826,12 +836,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearParcedFlags() {
|
function clearParcedFlags() {
|
||||||
//не сбрасывай эти флаги они живут сами по себе
|
|
||||||
//chartJsonFlag = {};
|
|
||||||
//layoutJsonFlag = {};
|
|
||||||
|
|
||||||
console.log("[i]", "parced flags cleared");
|
console.log("[i]", "parced flags cleared");
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(parsed)) {
|
for (const [key, value] of Object.entries(parsed)) {
|
||||||
parsed[key] = false;
|
parsed[key] = false;
|
||||||
}
|
}
|
||||||
@@ -876,9 +881,9 @@
|
|||||||
function wsSendMsg(ws, msg) {
|
function wsSendMsg(ws, msg) {
|
||||||
if (socket[ws] && socket[ws].readyState === 1) {
|
if (socket[ws] && socket[ws].readyState === 1) {
|
||||||
socket[ws].send(msg);
|
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 {
|
} else {
|
||||||
if (debug) console.log("[e]", getIP(ws), ws, "msg not send", msg);
|
if (debug) console.log("[e]", getIP(ws), ws, "msg not send");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user