From f4443d2d6697b794e98d5356df36375356b7f0cf Mon Sep 17 00:00:00 2001
From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com>
Date: Sun, 18 Sep 2022 19:26:23 +0200
Subject: [PATCH] =?UTF-8?q?=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B9=D0=BD?=
=?UTF-8?q?=D1=8B=D0=B5=20id?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/index.html | 2 +-
src/App.svelte | 18 +++++++++---------
src/pages/Config.svelte | 7 +++++++
src/widgets/Chart.svelte | 4 ++--
4 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/public/index.html b/public/index.html
index 8ce6492..f717663 100644
--- a/public/index.html
+++ b/public/index.html
@@ -4,7 +4,7 @@
-
IoT Manager 4.2.9
+ IoT Manager 4.3.0
diff --git a/src/App.svelte b/src/App.svelte
index c8c52b6..718cd35 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -39,7 +39,7 @@
let updatingTimeout = 80000;
let opened = false;
let preventMove = false;
- let devMode = true;
+ let devMode = false;
//****************************************************variable section**********************************************************/
//******************************************************************************************************************************/
@@ -312,7 +312,7 @@
deviceList = deviceList;
deviceListParced = true;
- if (debug) console.log("✔", "deviceList json parced");
+ if (debug) console.log("✔", "deviceList parced");
onParced();
whenDeviceListWasUpdated();
connectToAllDevices();
@@ -335,7 +335,7 @@
errorsJson = JSON.parse(data);
errorsJson = errorsJson;
errorsJsonParced = true;
- if (debug) console.log("✔", "errorsJson json parced");
+ if (debug) console.log("✔", "errorsJson parced");
onParced();
}
}
@@ -346,7 +346,7 @@
settingsJson = settingsJson;
//sortingLayout();
settingsJsonParced = true;
- if (debug) console.log("✔", "settingsJson json parced");
+ if (debug) console.log("✔", "settingsJson parced");
onParced();
}
}
@@ -448,7 +448,7 @@
console.log("[1]", ws, "blob package received");
//как только прилетел весь блоб мы начнем его читать ридером и заодно запросим json-ы всех параметров
combineLayoutsInOne(ws);
- wsSendMsg(ws, "/statuses|"); ///params|
+ wsSendMsg(ws, "/params|");
}
//сборщик paramsJson сообщений
if (data.includes('"params":"')) {
@@ -470,7 +470,7 @@
let statusJson = JSON.parse(data);
if (Array.isArray(statusJson.status)) {
updateWidgetArr(statusJson);
- if (debug) console.log("[i] status (arr)", ws, JSON.stringify(statusJson));
+ if (debug) console.log("[i] status (arr)", ws);
} else {
updateWidget(statusJson);
if (debug) console.log("[i] status (dgt)", ws, JSON.stringify(statusJson));
@@ -643,7 +643,7 @@
async function onParced() {
if (currentPageName === "/|") {
clearParcedFlags();
- if (debug) console.log("✔", "dashboard packet received");
+ if (debug) console.log("✔", "dashboard data received");
dashReady = true;
}
if (currentPageName === "/config|" && itemsJsonParced && widgetsJsonParced && configJsonParced && settingsJsonParced && scenarioJsonParced) {
@@ -677,7 +677,7 @@
function saveConfig() {
wsSendMsg(selectedWs, "/tuoyal|" + JSON.stringify(generateLayout()));
- del();
+ modify();
wsSendMsg(selectedWs, "/gifnoc|" + JSON.stringify(configJson));
wsSendMsg(selectedWs, "/oiranecs|" + JSON.stringify(scenarioJson));
clearData();
@@ -726,7 +726,7 @@
return input;
}
- function del() {
+ function modify() {
for (let i = 0; i < configJson.length; i++) {
let config = configJson[i];
delete config["show"];
diff --git a/src/pages/Config.svelte b/src/pages/Config.svelte
index 07c4563..deb0258 100644
--- a/src/pages/Config.svelte
+++ b/src/pages/Config.svelte
@@ -25,6 +25,7 @@
if (itemsJsonBind === item.num) {
delete item.num;
delete item.name;
+ item.id = item.id + randomInteger(0, 100);
configJson.push(item);
configJson = configJson;
itemsJsonBind = 0;
@@ -34,6 +35,12 @@
}
}
+ function randomInteger(min, max) {
+ // получить случайное число от (min-0.5) до (max+0.5)
+ let rand = min - 0.5 + Math.random() * (max - min + 1);
+ return Math.round(rand);
+ }
+
function deleteLineFromConfig(num) {
for (let i = 0; i < configJson.length; i++) {
if (num === i) {
diff --git a/src/widgets/Chart.svelte b/src/widgets/Chart.svelte
index 24f30eb..c832f85 100644
--- a/src/widgets/Chart.svelte
+++ b/src/widgets/Chart.svelte
@@ -38,7 +38,7 @@
function collectDataToArr() {
if (prevStatus !== widget.status && !firstTime) {
if (Array.isArray(widget.status)) {
- console.log("[i]", "=======================================================");
+ //console.log("[i]", "=======================================================");
prevStatus = widget.status;
for (let i = 0; i < widget.status.length; i++) {
@@ -54,7 +54,7 @@
if (widget.maxCount == 0 || widget.maxCount == "0") {
clearCart();
- console.log("[i]", "clear cart data");
+ //console.log("[i]", "clear cart data");
return;
}