From 5f97fa13e2471b631dee9be2f8b31ada971b3a58 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Sun, 11 Sep 2022 14:14:16 +0200 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B1=D0=B8=D1=80=D0=B0=D0=B5=D0=BC=20?= =?UTF-8?q?=D0=B1=D0=B0=D0=B3=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 2 +- src/App.svelte | 35 +++++++++++++++++++++-------------- src/widgets/Chart.svelte | 1 + src/widgets/Input.svelte | 8 ++++---- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/public/index.html b/public/index.html index a8364ba..276db14 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@ - IoT Manager 4.2.5 + IoT Manager 4.2.6 diff --git a/src/App.svelte b/src/App.svelte index 2e5c75e..3c24a93 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -38,7 +38,7 @@ let updatingTimeout = 80000; let opened = false; let preventMove = false; - let devMode = false; + let devMode = true; //****************************************************variable section**********************************************************/ //******************************************************************************************************************************/ @@ -445,7 +445,7 @@ if (data === "/st/layout.json") { } if (data === "/end/layout.json") { - createLayoutUnderLoading(ws); + //createLayoutUnderLoading(ws); } //сборщик paramsJson сообщений if (data.includes('"params":"')) { @@ -456,6 +456,8 @@ ...JSON.parse(data), }; paramsJson = paramsJson; + console.log("[i] paramsJson:", paramsJson); + createLayoutUnderLoading(ws); onParced(); } } @@ -518,7 +520,7 @@ devLayout[i].ws = ws; topic = topic.substring(topic.lastIndexOf("/") + 1, topic.length); if (key === topic) { - console.log("[i]", "value " + topic + " updated"); + console.log("[i]", "updated " + topic, value); devLayout[i].status = value; break; } @@ -615,16 +617,17 @@ wsSendMsg(selectedWs, "/mqtt|"); } - let input = {}; - - input = { - name: "inputDate", - descr: "Выберите дату", - widget: "input", - size: "small", - color: "orange", - type: "date", - }; + function getInput() { + let input = { + name: "inputDate", + descr: "Выберите дату", + widget: "input", + size: "small", + color: "orange", + type: "date", + }; + return input; + } function generateLayout() { let layout = []; @@ -639,11 +642,15 @@ widget.descr = config.descr; //widget.id = config.id; //widget.ws = selectedWs; + widget.topic = settingsJson.root + "/" + config.id; layout.push(widget); if (widget.widget === "chart") { + let input = getInput(); input.page = config.page; - input.topic = settingsJson.root + "/" + config.id + "-date"; + let topic = settingsJson.root + "/" + config.id + "-date"; + input.topic = topic; + console.log("[i]", "topic ", topic); layout.push(input); } error = false; diff --git a/src/widgets/Chart.svelte b/src/widgets/Chart.svelte index f1c6246..37768ea 100644 --- a/src/widgets/Chart.svelte +++ b/src/widgets/Chart.svelte @@ -81,6 +81,7 @@ } function clearCart() { + collectingDataArray = []; datachart = { labels: [0], datasets: [ diff --git a/src/widgets/Input.svelte b/src/widgets/Input.svelte index aec5912..ba6a1b6 100644 --- a/src/widgets/Input.svelte +++ b/src/widgets/Input.svelte @@ -6,9 +6,9 @@ //$: widget.status, calc(); function selectFromMarkerToMarker(str, tofind, number) { - if (str.indexOf(tofind) == -1) { - return "not found"; - } + //if (str.indexOf(tofind) == -1) { + // return "not found"; + //} str += tofind; let i = 0; do { @@ -32,7 +32,7 @@ return str.substring(p); } - let bindValue; + let bindValue = ""; //данная функция вызывается когда в вебе поменяли значение и его нужно отправить в сокеты //а также периписать в переменной виджета