From 3931021a0eb9bdb884bbdad86dcf67b359e1fcc8 Mon Sep 17 00:00:00 2001 From: IoT Manager <67171972+IoTManagerProject@users.noreply.github.com> Date: Wed, 11 Oct 2023 01:50:08 +0200 Subject: [PATCH] 454 --- public/index.html | 6 +++--- src/App.svelte | 40 ++++++++++++++++++++++++++++------------ src/pages/Profile.svelte | 21 ++++++++++++++------- 3 files changed, 45 insertions(+), 22 deletions(-) diff --git a/public/index.html b/public/index.html index 7d7c3d2..0a91112 100644 --- a/public/index.html +++ b/public/index.html @@ -4,12 +4,12 @@ - IoT Manager 4.5.3 + IoT Manager 4.5.4 - + - + diff --git a/src/App.svelte b/src/App.svelte index 28d6288..89826a8 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -59,7 +59,7 @@ //****************************************************variable section**********************************************************/ //******************************************************************************************************************************/ let myip = document.location.hostname; - if (devMode) myip = "192.168.1.228"; + if (devMode) myip = "192.168.1.235"; //Flags let firstDevListRequest = true; @@ -94,7 +94,8 @@ let settingsJson = {}; let ssidJson = {}; let errorsJson = {}; - let myProfileJson = {}; + let flashProfileJson = {}; + let otaJson = {}; let deviceList = []; deviceList = [ { @@ -132,7 +133,8 @@ errorsJson: false, statusJson: false, paramsJson: false, - myProfileJson: false, + flashProfileJson: false, + otaJson: false, }; //=============================================== @@ -441,12 +443,24 @@ if (header === "prfile") { let out = {}; if (await getPayloadAsJson(blob, size, out)) { - myProfileJson = out.json; - parsed.myProfileJson = true; - if (blobDebug) console.log("[✔]", "myProfileJson: ", myProfileJson); + flashProfileJson = out.json; + parsed.flashProfileJson = true; + if (blobDebug) console.log("[✔]", "flashProfileJson: ", flashProfileJson); } else { - parsed.myProfileJson = false; - if (blobDebug) console.log("[e]", "myProfileJson parse error"); + parsed.flashProfileJson = false; + if (blobDebug) console.log("[e]", "flashProfileJson parse error"); + } + } + + if (header === "otaupd") { + let out = {}; + if (await getPayloadAsJson(blob, size, out)) { + otaJson = out.json; + parsed.otaJson = true; + if (blobDebug) console.log("[✔]", "otaJson: ", otaJson); + } else { + parsed.otaJson = false; + if (blobDebug) console.log("[e]", "otaJson parse error"); } } @@ -611,7 +625,8 @@ pageReady.system = true; } - if (currentPageName === "/profile|" && parsed.myProfileJson) { + //&& parsed.otaJson + if (currentPageName === "/profile|" && parsed.flashProfileJson) { clearParcedFlags(); if (debug) console.log("✔✔", "profile page parced"); pageReady.profile = true; @@ -661,8 +676,9 @@ }; const markProfileAsPerThisDevProfile = async () => { + profile.projectProp.platformio.default_envs = flashProfileJson.projectProp.platformio.default_envs; for (const [compilerCategory, compilerCategoryModules] of Object.entries(profile.modules)) { - let devCategoryModules = myProfileJson.modules[compilerCategory]; + let devCategoryModules = flashProfileJson.modules[compilerCategory]; compilerCategoryModules.forEach((compilerModule) => { compilerModule.active = false; if (devCategoryModules) { @@ -942,7 +958,7 @@ if (widget.widget === "chart" && widget.type !== "bar") { let input = getInput(); input.page = config.page; - widget.topic = settingsJson.mqttPrefix + "/" + settingsJson.id + "/" + config.id + "-date"; + input.topic = settingsJson.mqttPrefix + "/" + settingsJson.id + "/" + config.id + "-date"; input.descr = config.descr; //console.log("[i]", "topic ", widget.topic); layout.push(input); @@ -1372,7 +1388,7 @@ - updateBuild(path)} allmodeinfo={allmodeinfo} profile={profile} serverOnline={serverOnline} /> + updateBuild(path)} allmodeinfo={allmodeinfo} profile={profile} serverOnline={serverOnline} otaJson={otaJson} /> diff --git a/src/pages/Profile.svelte b/src/pages/Profile.svelte index 3994705..61bced2 100644 --- a/src/pages/Profile.svelte +++ b/src/pages/Profile.svelte @@ -6,7 +6,8 @@ import { t, locale, locales } from "../i18n"; import Cookies from "js-cookie"; export let show; - export let myProfileJson; + export let flashProfileJson; + export let otaJson; export let allmodeinfo; export let profile; @@ -131,12 +132,12 @@ {#if show} {#if serverOnline} - {#if allmodeinfo && myProfileJson && profile} + {#if allmodeinfo && flashProfileJson && profile}
-

{myProfileJson.projectProp.platformio.default_envs}

+

{flashProfileJson.projectProp.platformio.default_envs}

{userdata.username}

@@ -183,9 +184,15 @@ {#each errors as e, i}

{$t(e.msg)}

{/each} - + + {#if Object.keys(otaJson).length !== 0} +
+

Статус последнего обновления:

+

{otaJson.build === 0 && otaJson.fs === 0 ? "успешно" : "ошибка"}

+
+ {/if} {#if userBuilds} - +
@@ -201,7 +208,7 @@ {#each userBuilds as build, i} - {#if build.projectProp.platformio.default_envs === myProfileJson.projectProp.platformio.default_envs} + {#if build.projectProp.platformio.default_envs === flashProfileJson.projectProp.platformio.default_envs} @@ -250,7 +257,7 @@
Название
{build.projectProp.platformio.default_envs} {build.ver}
{/if} - +