mirror of
https://github.com/IoTManagerProject/IoTManagerWeb.git
synced 2026-03-26 23:12:34 +03:00
454
This commit is contained in:
@@ -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 @@
|
||||
</Route>
|
||||
|
||||
<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 path="/login">
|
||||
<Login show={true} serverOnline={serverOnline} />
|
||||
|
||||
@@ -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}
|
||||
<div class="my-4">
|
||||
<div class="grd-1col1">
|
||||
<Card title="">
|
||||
<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>
|
||||
</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">
|
||||
@@ -183,9 +184,15 @@
|
||||
{#each errors as e, i}
|
||||
<p class="text-red-500 p-0 m-0 font-bold text-xs italic">{$t(e.msg)}</p>
|
||||
{/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}
|
||||
<table class="tbl mt-6 mb-0">
|
||||
<table class="tbl mb-0">
|
||||
<thead class="bg-gray-100">
|
||||
<tr class="txt-sz txt-pad">
|
||||
<th class="tbl-hd">Название</th>
|
||||
@@ -201,7 +208,7 @@
|
||||
</thead>
|
||||
<tbody class="bg-white">
|
||||
{#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">
|
||||
<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>
|
||||
@@ -250,7 +257,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
{/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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user