From 474fae6d6293a6e2347760e03adcf696bc18ff10 Mon Sep 17 00:00:00 2001
From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com>
Date: Wed, 23 Feb 2022 22:56:17 +0100
Subject: [PATCH] 4.1.0
---
public/index.html | 2 +-
src/App.svelte | 94 +++++++++++++++++++++++------------------------
2 files changed, 48 insertions(+), 48 deletions(-)
diff --git a/public/index.html b/public/index.html
index e0e99da..baca510 100644
--- a/public/index.html
+++ b/public/index.html
@@ -4,7 +4,7 @@
-
IoT Manager 4.0.8
+ IoT Manager 4.1.0
diff --git a/src/App.svelte b/src/App.svelte
index f49f07f..c345dcb 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -40,8 +40,8 @@
//****************************************************variable section**********************************************************/
//******************************************************************************************************************************/
- let myip = document.location.hostname;
- //let myip = "192.168.88.224";
+ //let myip = document.location.hostname;
+ let myip = "192.168.88.224";
//Flags
let firstDevListRequest = true;
@@ -82,7 +82,6 @@
let layoutJsonParced = false;
let settingsJson = {};
- let settingsJsonFlag = false;
let settingsJsonParced = false;
let errorsJson = {};
@@ -97,7 +96,7 @@
let statusJsonParced = false;
let incDeviceList = [];
- let incDeviceListParced = false;
+ let deviceListParced = false;
let scenarioTxt = "";
let scenarioTxtFlag = false;
@@ -163,6 +162,7 @@
router.subscribe(handleNavigation);
function handleNavigation() {
+ console.log("[i]", "handle navigation");
clearData();
currentPageName = $router.path.toString();
//название страницы служит заголовком, поэтому отметим конец заголовка "|"
@@ -181,6 +181,16 @@
}
}
+ //*******************************************************initialisation********************************************************************/
+ onMount(async () => {
+ console.log("[i]", "mounted");
+ whenDeviceListWasUpdated();
+ firstDevListRequest = true;
+ connectToAllDevices();
+ wsTestMsgTask();
+ findNewPage();
+ });
+
//****************************************************web sockets section******************************************************/
function connectToAllDevices() {
//closeAllConnection();
@@ -279,9 +289,6 @@
if (IsJsonParse(data)) {
incDeviceList = JSON.parse(data);
incDeviceList = incDeviceList;
- incDeviceListParced = true;
- if (debug) console.log("✔", "incDeviceList json parced");
- onParced("devicelist");
if (firstDevListRequest) {
deviceList = incDeviceList;
deviceList[0].status = true;
@@ -289,16 +296,21 @@
deviceList = combineArrays(deviceList, incDeviceList);
}
firstDevListRequest = false;
- //deviceList.sort(function (a, b) {
- // if (a.name < b.name) {
- // return -1;
- // }
- // if (a.name > b.name) {
- // return 1;
- // }
- // return 0;
- //});
+
+ // deviceList.sort(function (a, b) {
+ // if (a.name < b.name) {
+ // return -1;
+ // }
+ // if (a.name > b.name) {
+ // return 1;
+ // }
+ // return 0;
+ // });
+
deviceList = deviceList;
+ deviceListParced = true;
+ if (debug) console.log("✔", "deviceList json parced");
+ onParced();
whenDeviceListWasUpdated();
connectToAllDevices();
}
@@ -311,7 +323,7 @@
wigetsUpdate();
if (debug) console.log("✔", "statusJson parced");
statusJsonParced = true;
- onParced("status");
+ onParced();
}
}
//сборщик paramsJson сообщений======================================
@@ -320,7 +332,7 @@
paramsJson = JSON.parse(data);
if (debug) console.log("✔", "paramsJson parced", ws);
paramsJsonParced = true;
- onParced("params");
+ onParced();
}
}
//сборщик ssidJson сообщений======================================
@@ -330,7 +342,7 @@
ssidJson = ssidJson;
if (debug) console.log("✔", "ssidJson parced");
ssidJsonParced = true;
- onParced("ssid");
+ onParced();
}
}
//сборщик errorsJson сообщений======================================
@@ -340,7 +352,7 @@
errorsJson = errorsJson;
errorsJsonParced = true;
if (debug) console.log("✔", "errorsJson json parced");
- onParced("errors");
+ onParced();
}
}
//сборщик settingsJson сообщений======================================
@@ -351,7 +363,7 @@
wigetsUpdate();
settingsJsonParced = true;
if (debug) console.log("✔", "settingsJson json parced");
- onParced("settings");
+ onParced();
}
}
@@ -374,12 +386,11 @@
let scenarioTxtReader = new FileReader();
scenarioTxtReader.readAsText(bb);
scenarioTxtReader.onload = () => {
- let scenarioTxtResult = scenarioTxtReader.result;
- scenarioTxt = scenarioTxtResult;
+ scenarioTxt = scenarioTxtReader.result;
scenarioTxt = scenarioTxt;
scenarioTxtParced = true;
if (debug) console.log("✔", "scenarioTxt parced");
- onParced("scenario");
+ onParced();
};
}
//сборщик configJson пакетов========================================
@@ -398,7 +409,7 @@
configJson = configJson;
configJsonParced = true;
if (debug) console.log("✔", "configJson parced");
- onParced("config");
+ onParced();
}
};
}
@@ -418,7 +429,7 @@
widgetsJson = widgetsJson;
widgetsJsonParced = true;
if (debug) console.log("✔", "widgetsJson parced");
- onParced("widgets");
+ onParced();
}
};
}
@@ -438,7 +449,7 @@
itemsJson = itemsJson;
itemsJsonParced = true;
if (debug) console.log("✔", "itemsJson parced");
- onParced("items");
+ onParced();
}
};
}
@@ -459,7 +470,7 @@
wigetsUpdate();
layoutJsonParced = true;
if (debug) console.log("✔", "layoutJson parced", ws);
- onParced("layout");
+ onParced();
}
};
}
@@ -489,7 +500,7 @@
}
}
- function onParced(file) {
+ function onParced() {
if (currentPageName === "/|" && layoutJsonParced && paramsJsonParced) {
clearParcedFlags();
if (debug) console.log("✔✔", "dashboard data parced");
@@ -507,7 +518,7 @@
if (debug) console.log("✔✔", "connection data parced");
connectionReady = true;
}
- if (currentPageName === "/list|" && incDeviceListParced) {
+ if (currentPageName === "/list|" && deviceListParced) {
clearParcedFlags();
if (debug) console.log("✔✔", "list data parced");
listReady = true;
@@ -618,15 +629,13 @@
layoutJson = [];
layoutJsonBlob.clear();
- settingsJson = {};
-
- errorsJson = {};
-
- coreMessages = [];
-
scenarioTxt = "";
scenarioTxtBlob.clear();
+ settingsJson = {};
+ errorsJson = {};
+ coreMessages = [];
+
dashReady = false;
configReady = false;
connectionReady = false;
@@ -648,7 +657,7 @@
ssidJsonParced = false;
paramsJsonParced = false;
statusJsonParced = false;
- incDeviceListParced = false;
+ deviceListParced = false;
scenarioTxtParced = false;
}
@@ -963,6 +972,7 @@
function rebootingTask() {
clearTimeout(myTimeout);
+ clearData();
connectToAllDevices();
rebootingInProgress = false;
}
@@ -1020,16 +1030,6 @@
window.alert("Версия не выбрана или сервер недоступен");
}
}
-
- //*******************************************************initialisation********************************************************************/
- onMount(async () => {
- console.log("[i]", "mounted");
- whenDeviceListWasUpdated();
- firstDevListRequest = true;
- connectToAllDevices();
- wsTestMsgTask();
- findNewPage();
- });