кнопки

This commit is contained in:
Dmitry Borisenko
2022-12-14 00:52:42 +01:00
parent 2d6ca261c3
commit 326726adab
4 changed files with 42 additions and 16 deletions

View File

@@ -34,18 +34,18 @@
const debug = true; const debug = true;
const LOG_MAX_MESSAGES = 100; const LOG_MAX_MESSAGES = 100;
const reconnectTimeout = 30000; const reconnectTimeout = 30000;
const waitingAckTimeout = 5000; const waitingAckTimeout = 6000;
const rebootingTimeout = 20000; const rebootingTimeout = 20000;
const updatingTimeout = 130000; const updatingTimeout = 130000;
let opened = false; let opened = false;
let preventMove = false; let preventMove = false;
const blobDebug = false; const blobDebug = false;
const devMode = false; const devMode = true;
//****************************************************variable section**********************************************************/ //****************************************************variable section**********************************************************/
//******************************************************************************************************************************/ //******************************************************************************************************************************/
let myip = document.location.hostname; let myip = document.location.hostname;
if (devMode) myip = "192.168.88.237"; if (devMode) myip = "192.168.88.229";
//Flags //Flags
let firstDevListRequest = true; let firstDevListRequest = true;
@@ -1242,6 +1242,17 @@
return d.getMilliseconds(); return d.getMilliseconds();
} }
function moduleOrder(id, key, value) {
console.log("order: ", id, key, value);
let json = {
id: id,
key: key,
value: value,
};
console.log(json);
wsSendMsg(selectedWs, "/order|" + JSON.stringify(json));
}
function test() { function test() {
//wsSendMsg(selectedWs, "/test|"); //wsSendMsg(selectedWs, "/test|");
//console.log("[i]", "test"); //console.log("[i]", "test");
@@ -1313,7 +1324,7 @@
<DashboardPage show={pageReady.dash} layoutJson={layoutJson} pages={pages} wsPush={(ws, topic, status) => wsPush(ws, topic, status)} /> <DashboardPage show={pageReady.dash} layoutJson={layoutJson} pages={pages} wsPush={(ws, topic, status) => wsPush(ws, topic, status)} />
</Route> </Route>
<Route path="/config"> <Route path="/config">
<ConfigPage show={pageReady.config} bind:configJson bind:scenarioTxt widgetsJson={widgetsJson} itemsJson={itemsJson} saveConfig={() => saveConfig()} cleanLogs={() => cleanLogs()} rebootEsp={() => rebootEsp()} /> <ConfigPage show={pageReady.config} bind:configJson bind:scenarioTxt widgetsJson={widgetsJson} itemsJson={itemsJson} saveConfig={() => saveConfig()} cleanLogs={() => cleanLogs()} rebootEsp={() => rebootEsp()} moduleOrder={(id, key, value) => moduleOrder(id, key, value)} />
</Route> </Route>
<Route path="/connection"> <Route path="/connection">
<ConnectionPage show={pageReady.connection} rebootEsp={() => rebootEsp()} ssidClick={() => ssidClick()} saveSett={() => saveSett()} saveMqtt={() => saveMqtt()} settingsJson={settingsJson} errorsJson={errorsJson} ssidJson={ssidJson} /> <ConnectionPage show={pageReady.connection} rebootEsp={() => rebootEsp()} ssidClick={() => ssidClick()} saveSett={() => saveSett()} saveMqtt={() => saveMqtt()} settingsJson={settingsJson} errorsJson={errorsJson} ssidJson={ssidJson} />

View File

@@ -191,6 +191,8 @@
let p = str.indexOf(found) + found.length; let p = str.indexOf(found) + found.length;
return str.substring(p); return str.substring(p);
} }
export let moduleOrder = (id, key, value) => {};
</script> </script>
{#if show} {#if show}
@@ -248,12 +250,23 @@
<td /> <td />
<td /> <td />
<td /> <td />
<td class="tbl-bdy-sm text-right"> {#if key.startsWith("btn")}
<p class="txt-ita">{key}</p> <td class="tbl-bdy-sm text-right">
</td> <button on:click={() => moduleOrder(element.id, key.substring(4), element[key])} class="h-3 sm:h-6 md:h-6 lg:h-6 xl:h-6 2xl:h-6 w-auto bg-blue-100 inline-flex items-center border border-gray-300 hover:bg-blue-200">{key.substring(4)}</button>
<td class="tbl-bdy-sm text-center"> </td>
<input bind:value={element[key]} class="ipt-sm w-full" type="text" /> {#if element[key] != "nil"}
</td> <td class="tbl-bdy-sm text-center">
<input bind:value={element[key]} class="ipt-sm w-full" type="text" />
</td>
{/if}
{:else}
<td class="tbl-bdy-sm text-right">
<p class="txt-ita">{key}</p>
</td>
<td class="tbl-bdy-sm text-center">
<input bind:value={element[key]} class="ipt-sm w-full" type="text" />
</td>
{/if}
</tr> </tr>
{/if} {/if}
{/each} {/each}

View File

@@ -18,7 +18,7 @@
function timeOut() { function timeOut() {
empty = false; empty = false;
setTimeout(timeIsOut, 1000); setTimeout(timeIsOut, 3000);
} }
export let pages; export let pages;

View File

@@ -168,11 +168,13 @@
</div> </div>
<div class="flex justify-center w-1/3"> <div class="flex justify-center w-1/3">
<select class="border border-indigo-500 border-4 text-center" bind:value={choosingVersion}> <select class="border border-indigo-500 border-4 text-center" bind:value={choosingVersion}>
{#each Object.entries(versionsList) as [key, param]} {#if versionsList}
<option value={param}> {#each Object.entries(versionsList) as [key, param]}
{param} <option value={param}>
</option> {param}
{/each} </option>
{/each}
{/if}
</select> </select>
</div> </div>
</div> </div>