This commit is contained in:
IoT Manager
2023-10-11 01:50:08 +02:00
parent 7f7ef1a696
commit 3931021a0e
3 changed files with 45 additions and 22 deletions

View File

@@ -4,12 +4,12 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" /> <meta name="viewport" content="width=device-width,initial-scale=1" />
<title>IoT Manager 4.5.3</title> <title>IoT Manager 4.5.4</title>
<link rel="icon" type="image/png" href="/favicon.ico" /> <link rel="icon" type="image/png" href="/favicon.ico" />
<link rel="stylesheet" href="/build/bundle.css?4530" /> <link rel="stylesheet" href="/build/bundle.css?4540" />
<script defer src="/build/bundle.js?4530"></script> <script defer src="/build/bundle.js?4540"></script>
</head> </head>
<body></body> <body></body>

View File

@@ -59,7 +59,7 @@
//****************************************************variable section**********************************************************/ //****************************************************variable section**********************************************************/
//******************************************************************************************************************************/ //******************************************************************************************************************************/
let myip = document.location.hostname; let myip = document.location.hostname;
if (devMode) myip = "192.168.1.228"; if (devMode) myip = "192.168.1.235";
//Flags //Flags
let firstDevListRequest = true; let firstDevListRequest = true;
@@ -94,7 +94,8 @@
let settingsJson = {}; let settingsJson = {};
let ssidJson = {}; let ssidJson = {};
let errorsJson = {}; let errorsJson = {};
let myProfileJson = {}; let flashProfileJson = {};
let otaJson = {};
let deviceList = []; let deviceList = [];
deviceList = [ deviceList = [
{ {
@@ -132,7 +133,8 @@
errorsJson: false, errorsJson: false,
statusJson: false, statusJson: false,
paramsJson: false, paramsJson: false,
myProfileJson: false, flashProfileJson: false,
otaJson: false,
}; };
//=============================================== //===============================================
@@ -441,12 +443,24 @@
if (header === "prfile") { if (header === "prfile") {
let out = {}; let out = {};
if (await getPayloadAsJson(blob, size, out)) { if (await getPayloadAsJson(blob, size, out)) {
myProfileJson = out.json; flashProfileJson = out.json;
parsed.myProfileJson = true; parsed.flashProfileJson = true;
if (blobDebug) console.log("[✔]", "myProfileJson: ", myProfileJson); if (blobDebug) console.log("[✔]", "flashProfileJson: ", flashProfileJson);
} else { } else {
parsed.myProfileJson = false; parsed.flashProfileJson = false;
if (blobDebug) console.log("[e]", "myProfileJson parse error"); 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; pageReady.system = true;
} }
if (currentPageName === "/profile|" && parsed.myProfileJson) { //&& parsed.otaJson
if (currentPageName === "/profile|" && parsed.flashProfileJson) {
clearParcedFlags(); clearParcedFlags();
if (debug) console.log("✔✔", "profile page parced"); if (debug) console.log("✔✔", "profile page parced");
pageReady.profile = true; pageReady.profile = true;
@@ -661,8 +676,9 @@
}; };
const markProfileAsPerThisDevProfile = async () => { const markProfileAsPerThisDevProfile = async () => {
profile.projectProp.platformio.default_envs = flashProfileJson.projectProp.platformio.default_envs;
for (const [compilerCategory, compilerCategoryModules] of Object.entries(profile.modules)) { for (const [compilerCategory, compilerCategoryModules] of Object.entries(profile.modules)) {
let devCategoryModules = myProfileJson.modules[compilerCategory]; let devCategoryModules = flashProfileJson.modules[compilerCategory];
compilerCategoryModules.forEach((compilerModule) => { compilerCategoryModules.forEach((compilerModule) => {
compilerModule.active = false; compilerModule.active = false;
if (devCategoryModules) { if (devCategoryModules) {
@@ -942,7 +958,7 @@
if (widget.widget === "chart" && widget.type !== "bar") { if (widget.widget === "chart" && widget.type !== "bar") {
let input = getInput(); let input = getInput();
input.page = config.page; 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; input.descr = config.descr;
//console.log("[i]", "topic ", widget.topic); //console.log("[i]", "topic ", widget.topic);
layout.push(input); layout.push(input);
@@ -1372,7 +1388,7 @@
</Route> </Route>
<Route path="/profile"> <Route path="/profile">
<Profile show={pageReady.profile} myProfileJson={myProfileJson} userdata={userdata} updateBuild={(path) => updateBuild(path)} allmodeinfo={allmodeinfo} profile={profile} serverOnline={serverOnline} /> <Profile show={pageReady.profile} flashProfileJson={flashProfileJson} userdata={userdata} updateBuild={(path) => updateBuild(path)} allmodeinfo={allmodeinfo} profile={profile} serverOnline={serverOnline} otaJson={otaJson} />
</Route> </Route>
<Route path="/login"> <Route path="/login">
<Login show={true} serverOnline={serverOnline} /> <Login show={true} serverOnline={serverOnline} />

View File

@@ -6,7 +6,8 @@
import { t, locale, locales } from "../i18n"; import { t, locale, locales } from "../i18n";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
export let show; export let show;
export let myProfileJson; export let flashProfileJson;
export let otaJson;
export let allmodeinfo; export let allmodeinfo;
export let profile; export let profile;
@@ -131,12 +132,12 @@
{#if show} {#if show}
{#if serverOnline} {#if serverOnline}
{#if allmodeinfo && myProfileJson && profile} {#if allmodeinfo && flashProfileJson && profile}
<div class="my-4"> <div class="my-4">
<div class="grd-1col1"> <div class="grd-1col1">
<Card title=""> <Card title="">
<div class="grid grid-cols-2"> <div class="grid grid-cols-2">
<p class="text-center text-gray-500 font-bold">{myProfileJson.projectProp.platformio.default_envs}</p> <p class="text-center text-gray-500 font-bold">{flashProfileJson.projectProp.platformio.default_envs}</p>
<p class="text-center text-gray-500 font-bold">{userdata.username}</p> <p class="text-center text-gray-500 font-bold">{userdata.username}</p>
</div> </div>
<div class="grid my-4 grid-cols-2 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-12 2xl:grid-cols-12 gap-4"> <div class="grid my-4 grid-cols-2 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-12 2xl:grid-cols-12 gap-4">
@@ -183,9 +184,15 @@
{#each errors as e, i} {#each errors as e, i}
<p class="text-red-500 p-0 m-0 font-bold text-xs italic">{$t(e.msg)}</p> <p class="text-red-500 p-0 m-0 font-bold text-xs italic">{$t(e.msg)}</p>
{/each} {/each}
<button class="btn-lg mt-4" on:click={() => placeOrder()}>{$t("profile.update")}</button> <button class="btn-lg mt-4 mb-4" on:click={() => placeOrder()}>{$t("profile.update")}</button>
{#if Object.keys(otaJson).length !== 0}
<div class="grid grid-cols-2 mb-4">
<p class="text-center text-gray-500 font-bold truncate">Статус последнего обновления:</p>
<p class="{otaJson.build === 0 && otaJson.fs === 0 ? 'text-green-500' : 'text-red-500'} text-center font-bold truncate">{otaJson.build === 0 && otaJson.fs === 0 ? "успешно" : "ошибка"}</p>
</div>
{/if}
{#if userBuilds} {#if userBuilds}
<table class="tbl mt-6 mb-0"> <table class="tbl mb-0">
<thead class="bg-gray-100"> <thead class="bg-gray-100">
<tr class="txt-sz txt-pad"> <tr class="txt-sz txt-pad">
<th class="tbl-hd">Название</th> <th class="tbl-hd">Название</th>
@@ -201,7 +208,7 @@
</thead> </thead>
<tbody class="bg-white"> <tbody class="bg-white">
{#each userBuilds as build, i} {#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}
<tr class="txt-sz txt-pad"> <tr class="txt-sz txt-pad">
<td class="tbl-bdy-lg ipt-lg w-full">{build.projectProp.platformio.default_envs}</td> <td class="tbl-bdy-lg ipt-lg w-full">{build.projectProp.platformio.default_envs}</td>
<td class="tbl-bdy-lg ipt-lg w-full">{build.ver}</td> <td class="tbl-bdy-lg ipt-lg w-full">{build.ver}</td>
@@ -250,7 +257,7 @@
</tbody> </tbody>
</table> </table>
{/if} {/if}
<button class="btn-lg mt-6" on:click={() => exit()}>{$t("profile.exit")}</button> <button class="btn-lg mt-4" on:click={() => exit()}>{$t("profile.exit")}</button>
</Card> </Card>
</div> </div>
</div> </div>