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 widgetCollection = [];
|
||||||
let widgetCollectionBuf = [];
|
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
|
//web sockets
|
||||||
let socket = [];
|
let socket = [];
|
||||||
let socketConnected = false;
|
let socketConnected = false;
|
||||||
@@ -335,7 +306,6 @@
|
|||||||
widgetCollection = JSON.parse(widgetCollectionBuf);
|
widgetCollection = JSON.parse(widgetCollectionBuf);
|
||||||
widgetCollectionBuf = [];
|
widgetCollectionBuf = [];
|
||||||
widgetCollection = widgetCollection;
|
widgetCollection = widgetCollection;
|
||||||
createWidgetsDropdown();
|
|
||||||
if (debug) console.log("[i]", "widgetCollection parsed");
|
if (debug) console.log("[i]", "widgetCollection parsed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -360,17 +330,6 @@
|
|||||||
sendCurrentPageName();
|
sendCurrentPageName();
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWidgetsDropdown() {
|
|
||||||
widgetCollection.forEach((widget) => {
|
|
||||||
widgetsDropdown.push({
|
|
||||||
id: widget.name,
|
|
||||||
val: widget.rus,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
widgetsDropdown = widgetsDropdown;
|
|
||||||
if (debug) console.log("[i]", widgetsDropdown);
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearData() {
|
function clearData() {
|
||||||
configJson = [];
|
configJson = [];
|
||||||
configJsonBuf = [];
|
configJsonBuf = [];
|
||||||
@@ -528,6 +487,19 @@
|
|||||||
return true;
|
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************************************************************/
|
//**********************************************************post and get************************************************************/
|
||||||
//editRequest("192.168.88.235", "data data data data", "file.json")
|
//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"><input bind:value={element.id} class="tbl-ipt w-full" type="text" /></td>
|
||||||
<td class="tbl-bdy"
|
<td class="tbl-bdy"
|
||||||
><select bind:value={element.widget} class="tbl-ipt w-full">
|
><select bind:value={element.widget} class="tbl-ipt w-full">
|
||||||
{#each widgetsDropdown as widget}
|
{#each widgetCollection as select}
|
||||||
<option value={widget.id}>
|
<option value={select.name}>
|
||||||
{widget.val}
|
{select.label}
|
||||||
</option>
|
</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select></td>
|
</select></td>
|
||||||
|
|||||||
Reference in New Issue
Block a user