mirror of
https://github.com/IoTManagerProject/IoTManagerWeb.git
synced 2026-03-26 15:02:21 +03:00
упростил общий список виджетов
This commit is contained in:
@@ -163,35 +163,6 @@
|
||||
let widgetCollection = [];
|
||||
let widgetCollectionBuf = [];
|
||||
|
||||
let widgetsDropdown = [];
|
||||
|
||||
//widgetsDropdown = [
|
||||
// {
|
||||
// id: "toggle",
|
||||
// val: "Переключатель",
|
||||
// },
|
||||
// {
|
||||
// id: "btn",
|
||||
// val: "Кнопка",
|
||||
// },
|
||||
// {
|
||||
// id: "select",
|
||||
// val: "Кнопка переключатель",
|
||||
// },
|
||||
// {
|
||||
// id: "range",
|
||||
// val: "Ползунок",
|
||||
// },
|
||||
// {
|
||||
// id: "anydata",
|
||||
// val: "Текст",
|
||||
// },
|
||||
// {
|
||||
// id: "inputDigit",
|
||||
// val: "Ввод цифры",
|
||||
// },
|
||||
//];
|
||||
|
||||
//web sockets
|
||||
let socket = [];
|
||||
let socketConnected = false;
|
||||
@@ -335,7 +306,6 @@
|
||||
widgetCollection = JSON.parse(widgetCollectionBuf);
|
||||
widgetCollectionBuf = [];
|
||||
widgetCollection = widgetCollection;
|
||||
createWidgetsDropdown();
|
||||
if (debug) console.log("[i]", "widgetCollection parsed");
|
||||
}
|
||||
}
|
||||
@@ -360,17 +330,6 @@
|
||||
sendCurrentPageName();
|
||||
}
|
||||
|
||||
function createWidgetsDropdown() {
|
||||
widgetCollection.forEach((widget) => {
|
||||
widgetsDropdown.push({
|
||||
id: widget.name,
|
||||
val: widget.rus,
|
||||
});
|
||||
});
|
||||
widgetsDropdown = widgetsDropdown;
|
||||
if (debug) console.log("[i]", widgetsDropdown);
|
||||
}
|
||||
|
||||
function clearData() {
|
||||
configJson = [];
|
||||
configJsonBuf = [];
|
||||
@@ -528,6 +487,19 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
//пример как формировать массив json
|
||||
function createWidgetsDropdown() {
|
||||
let widgetsDropdown = [];
|
||||
widgetCollection.forEach((widget) => {
|
||||
widgetsDropdown.push({
|
||||
id: widget.name,
|
||||
val: widget.rus,
|
||||
});
|
||||
});
|
||||
widgetsDropdown = widgetsDropdown;
|
||||
if (debug) console.log("[i]", widgetsDropdown);
|
||||
}
|
||||
|
||||
//**********************************************************post and get************************************************************/
|
||||
//editRequest("192.168.88.235", "data data data data", "file.json")
|
||||
|
||||
@@ -693,9 +665,9 @@
|
||||
<td class="tbl-bdy"><input bind:value={element.id} class="tbl-ipt w-full" type="text" /></td>
|
||||
<td class="tbl-bdy"
|
||||
><select bind:value={element.widget} class="tbl-ipt w-full">
|
||||
{#each widgetsDropdown as widget}
|
||||
<option value={widget.id}>
|
||||
{widget.val}
|
||||
{#each widgetCollection as select}
|
||||
<option value={select.name}>
|
||||
{select.label}
|
||||
</option>
|
||||
{/each}
|
||||
</select></td>
|
||||
|
||||
Reference in New Issue
Block a user