From 1b5bdbbf53e309cd1d03835f61a75a9add34aefa Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <67171972+IoTManagerProject@users.noreply.github.com> Date: Tue, 1 Feb 2022 16:01:19 +0100 Subject: [PATCH] =?UTF-8?q?=D0=BC=D0=BD=D0=BE=D0=B6=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B2=D0=BE=20=D1=80=D0=B0=D0=B7=D0=BD=D1=8B=D1=85=20=D0=B8?= =?UTF-8?q?=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.svelte | 401 ++++++++++++++++++++++++++++--------------------- 1 file changed, 227 insertions(+), 174 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index e74ec5c..05594db 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -22,6 +22,8 @@ let debug = true; let LOG_MAX_MESSAGES = 10; let reconnectTimeout = 60000; + let opened = false; + let preventMove = false; //****************************************************variable section**********************************************************/ //******************************************************************************************************************************/ @@ -163,6 +165,25 @@ let widgetsJson = []; let widgetsJsonFlag = false; + let itemsJson = []; + + itemsJson = [ + { + name: "1. Аналоговый сенсор", + type: "Reading", + subtype: "AnalogAdc", + id: "t", + widget: "anydataTmp", + page: "Сенсоры", + descr: "Температура", + map: "1,1024,1,1024", + plus: 0, + multiply: 1, + pin: 0, + int: 15, + }, + ]; + //web sockets let socket = []; let socketConnected = false; @@ -445,7 +466,7 @@ } } - //***********************************************************dashboard************************************************************/ + //***********************************************************dashboard***************************************************************/ function findNewPage() { pages = []; const newPage = Array.from(new Set(Array.from(wigets, ({ page }) => page))); @@ -467,7 +488,7 @@ findNewPage(); } - //***********************************************************logging************************************************************/ + //***********************************************************logging******************************************************************/ const addCoreMsg = (msg) => { if (coreMessages.length > Number(LOG_MAX_MESSAGES)) { coreMessages = coreMessages.slice(0); @@ -485,8 +506,8 @@ }); }; - //***********************************************************dev list************************************************************/ - function dropdownChange() { + //***********************************************************dev list******************************************************************/ + function devicesDropdownChange() { socketConnected = selectedDeviceData.status; wsSelected = selectedDeviceData.ws; clearData(); @@ -514,7 +535,7 @@ } } - //****************************************************************json************************************************************/ + //****************************************************************json******************************************************************/ function getJsonObject(array, number) { let num = 0; let out = {}; @@ -562,7 +583,7 @@ if (debug) console.log("[i]", widgetsDropdown); } - //**********************************************************post and get************************************************************/ + //**********************************************************post and get*****************************************************************/ //editRequest("192.168.88.235", "data data data data", "file.json") function editRequest(url, data, filename) { @@ -613,27 +634,42 @@ if (debug) console.log("[i]", "user open add params ", id); } + //**********************************************************modal*************************************************************************/ function showModal() { showModalFlag = !showModalFlag; } - //initialisation======================================================================================= + function onCheck() { + let width = screen.width; + console.log("width", width); + if (width < 900) { + preventMove = true; + } else { + preventMove = false; + } + } + + //************************************************elements and presets dropdown************************************************************/ + + function elementsDropdownChange() {} + + //*******************************************************initialisation********************************************************************/ onMount(async () => { console.log("[i]", "mounted"); connectToAllDevices(); wsTestMsgTask(); socketConnected = selectedDeviceData.status; - dropdownChange(); + devicesDropdownChange(); findNewPage(); }); -
- -
+
+ +
- devicesDropdownChange()}> {#each deviceList as device}
-
+ - - + - -
+ + + + + + + + + + + +