исправил множество багов

This commit is contained in:
Dmitry Borisenko
2022-02-24 00:59:10 +01:00
parent 474fae6d62
commit 3c2cddb0d3
5 changed files with 37 additions and 49 deletions

View File

@@ -29,11 +29,11 @@
//****************************************************constants section*********************************************************/
//******************************************************************************************************************************/
let version = 408;
let version = 410;
let debug = true;
let LOG_MAX_MESSAGES = 100;
let reconnectTimeout = 20000;
let rebootingTimeout = 15000;
let rebootingTimeout = 18000;
let updatingTimeout = 80000;
let opened = false;
let preventMove = false;
@@ -48,6 +48,9 @@
let showInput = false;
let showModalFlag = false;
let rebootingUpdatingInProgress = false;
const myTimeout = undefined;
let additionalParams = false;
//dashboard
@@ -119,7 +122,7 @@
let selectedDeviceData = undefined;
let selectedWs = 0;
let flag = true;
let firstTime = true;
let newDevice = {};
let coreMessages = [];
@@ -669,18 +672,22 @@
function wsTestMsgTask() {
setTimeout(wsTestMsgTask, reconnectTimeout);
if (debug) console.log("[i]", "----timer tick----");
if (!flag) {
deviceList.forEach((device) => {
if (!getDeviceStatus(device.ws)) {
wsConnect(device.ws);
wsEventAdd(device.ws);
} else {
wsSendMsg(device.ws, "/tst|");
}
});
if (!rebootingUpdatingInProgress) {
if (debug) console.log("[i]", "----timer tick----");
if (!firstTime) {
deviceList.forEach((device) => {
if (!getDeviceStatus(device.ws)) {
wsConnect(device.ws);
wsEventAdd(device.ws);
} else {
wsSendMsg(device.ws, "/tst|");
}
});
}
firstTime = false;
} else {
if (debug) console.log("[i]", "----timer skipped----");
}
flag = false;
}
function wsSendMsg(ws, msg) {
@@ -960,13 +967,10 @@
wsSendMsg(selectedWs, "/scan|");
}
let rebootingInProgress = false;
const myTimeout = undefined;
function rebootEsp() {
if (debug) console.log("[i]", "reboot...");
wsSendMsg(selectedWs, "/reboot|");
rebootingInProgress = true;
rebootingUpdatingInProgress = true;
myTimeout = setTimeout(rebootingTask, rebootingTimeout);
}
@@ -974,7 +978,7 @@
clearTimeout(myTimeout);
clearData();
connectToAllDevices();
rebootingInProgress = false;
rebootingUpdatingInProgress = false;
}
function cancelAlarm(alarmKey) {
@@ -1020,7 +1024,7 @@
wsSendMsg(selectedWs, '/rorre|{"chver":' + choosingVersion + "}");
//начнем обновление
wsSendMsg(selectedWs, "/update|");
rebootingInProgress = true;
rebootingUpdatingInProgress = true;
myTimeout = setTimeout(rebootingTask, updatingTimeout);
} else {
console.log("update canceled");
@@ -1036,7 +1040,7 @@
<!--{#if errorsJson.wscle === 1}-->
<!--<Modal header={"Ошибка web sockets"} text={"Слишком много клиентов было открыто. Допускается не более четырех. Для исчезновения ошибки перезагрузите устройство"} />-->
<!--{/if}-->
{#if rebootingInProgress}
{#if rebootingUpdatingInProgress}
<Progress />
{/if}
<header class="h-10 w-full bg-gray-100 overflow-auto shadow-md">
@@ -1057,7 +1061,8 @@
</header>
<nav class="flex">
<input bind:checked={opened} on:change={() => onCheck()} id="menu__toggle" type="checkbox" />
<input class="w-0 h-0" bind:checked={opened} on:change={() => onCheck()} id="menu__toggle" type="checkbox" />
<label class="menu__btn" for="menu__toggle">
<span />
</label>
@@ -1078,15 +1083,6 @@
<li>
<a class="menu__item" href="/system">{"Системные"}</a>
</li>
<!--<li>-->
<!--<a class="menu__item" href="/utilities">{"Утилиты"}</a>-->
<!--</li>-->
<!--<li>-->
<!--<a class="menu__item" href="/log">{"Лог"}</a>-->
<!--</li>-->
<!--<li>-->
<!--<a class="menu__item" href="/about">{"О проекте"}</a>-->
<!--</li>-->
</ul>
</nav>
@@ -1111,16 +1107,6 @@
<Route path="/system">
<SystemPage show={systemReady} errorsJson={errorsJson} settingsJson={settingsJson} saveSett={() => saveSett()} rebootEsp={() => rebootEsp()} cancelAlarm={(alarmKey) => cancelAlarm(alarmKey)} versionsList={versionsList} bind:choosingVersion startUpdate={() => startUpdate()} coreMessages={coreMessages} />
</Route>
<!--<Route path="/utilities">-->
<!--<UtilitiesPage />-->
<!--</Route>-->
<!--<Route path="/log">-->
<!--<LogPage coreMessages={coreMessages} />-->
<!--</Route>-->
<!--<Route path="/about">-->
<!--<AboutPage wigetsUpdate={wigetsUpdate} layoutJson={layoutJson} showModal={() => showModal()} syntaxHighlight={(json) => syntaxHighlight(json)} />-->
<!--</Route>-->
{/if}
</div>
</ul>

View File

@@ -28,7 +28,7 @@
@layer components {
.alm {
@apply mb-2 w-full p-2 sm:p-2 md:p-2 lg:p-2 xl:px-4 xl:py-2 2xl:px-4 2xl:py-2 bg-white shadow-md lg:shadow-lg border border-gray-200 rounded-lg;
@apply mt-4 w-full p-2 sm:p-2 md:p-2 lg:p-2 xl:px-4 xl:py-2 2xl:px-4 2xl:py-2 bg-white shadow-md lg:shadow-lg border border-gray-200 rounded-lg;
}
.alm-hdr {
@apply text-center text-base text-red-400 font-bold pb-0;

View File

@@ -19,7 +19,7 @@
@layer components {
.crd {
@apply w-full mb-2 p-2 sm:p-2 md:p-2 lg:p-2 xl:px-4 xl:py-4 2xl:px-4 2xl:py-4 bg-white shadow-md lg:shadow-lg border border-gray-200 rounded-lg;
@apply w-full mt-4 p-2 sm:p-2 md:p-2 lg:p-2 xl:px-4 xl:py-4 2xl:px-4 2xl:py-4 bg-white shadow-md lg:shadow-lg border border-gray-200 rounded-lg;
}
.crd-hdr {
@apply text-center text-lg text-gray-500 font-bold pb-4;

View File

@@ -1,11 +1,13 @@
<script>
</script>
<div class="z-50">
<div class="fixed inset-0 bg-gray-200 bg-opacity-75 transition-opacity" aria-hidden="true" />
<div class="flex h-screen justify-center items-center">
<div class="m-auto">
<div style="border-top-color:transparent" class="w-20 h-20 border-4 border-blue-400 border-solid rounded-full animate-spin" />
<div class="fixed z-10 inset-0 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 bg-gray-50 bg-opacity-75 transition-opacity" aria-hidden="true" />
<div class="flex h-screen justify-center items-center">
<div class="m-auto">
<div style="border-top-color:transparent" class="w-20 h-20 border-4 border-blue-400 border-solid rounded-full animate-spin" />
</div>
</div>
</div>
</div>

View File

@@ -263,7 +263,7 @@
<button class="btn-lg" on:click={() => rebootEsp()}>{"Перезагрузить устройство"}</button>
</Card>
<!--LOG-->
<Card title="Лог">
<Card title="Лог" class="z-50">
<div class="h-80 overflow-y-auto">
{#each coreMessages as message, i}
<div class={message.msg.toString().includes("[E]") ? "text-xs text-red-500" : "text-xs text-black"}>{message.msg}</div>