mirror of
https://github.com/IoTManagerProject/IoTManagerWeb.git
synced 2026-03-26 15:02:21 +03:00
final
This commit is contained in:
@@ -4,6 +4,6 @@
|
|||||||
"svelteBracketNewLine": false,
|
"svelteBracketNewLine": false,
|
||||||
"svelteAllowShorthand": false,
|
"svelteAllowShorthand": false,
|
||||||
"svelteIndentScriptAndStyle": true,
|
"svelteIndentScriptAndStyle": true,
|
||||||
"printWidth": 60,
|
"printWidth": 600,
|
||||||
"sxBracketSameLine": true
|
"sxBracketSameLine": true
|
||||||
}
|
}
|
||||||
@@ -24,23 +24,15 @@
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
json = json
|
json = json.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||||
.replace(/&/g, "&")
|
json = json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
|
||||||
.replace(/</g, "<")
|
return match;
|
||||||
.replace(/>/g, ">");
|
});
|
||||||
json = json.replace(
|
|
||||||
/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,
|
|
||||||
function (match) {
|
|
||||||
return match;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return json;
|
return json;
|
||||||
};
|
};
|
||||||
|
|
||||||
function wigetsUpdate() {
|
function wigetsUpdate() {
|
||||||
wigets = JSON.parse(
|
wigets = JSON.parse(document.getElementById("text1").value);
|
||||||
document.getElementById("text1").value
|
|
||||||
);
|
|
||||||
findNewPage();
|
findNewPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,14 +89,9 @@
|
|||||||
let pages = [];
|
let pages = [];
|
||||||
function findNewPage() {
|
function findNewPage() {
|
||||||
pages = [];
|
pages = [];
|
||||||
const newPage = Array.from(
|
const newPage = Array.from(new Set(Array.from(wigets, ({ page }) => page)));
|
||||||
new Set(Array.from(wigets, ({ page }) => page))
|
|
||||||
);
|
|
||||||
newPage.forEach(function (item, i, arr) {
|
newPage.forEach(function (item, i, arr) {
|
||||||
pages = [
|
pages = [...pages, JSON.parse(JSON.stringify({ page: item }))];
|
||||||
...pages,
|
|
||||||
JSON.parse(JSON.stringify({ page: item })),
|
|
||||||
];
|
|
||||||
});
|
});
|
||||||
pages.sort(function (a, b) {
|
pages.sort(function (a, b) {
|
||||||
if (a.page < b.page) {
|
if (a.page < b.page) {
|
||||||
@@ -133,16 +120,13 @@
|
|||||||
<a class="menu__item" href="/">{"Управление"}</a>
|
<a class="menu__item" href="/">{"Управление"}</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="menu__item" href="/config"
|
<a class="menu__item" href="/config">{"Конфигуратор"}</a>
|
||||||
>{"Конфигуратор"}</a>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="menu__item" href="/connection"
|
<a class="menu__item" href="/connection">{"Подключение"}</a>
|
||||||
>{"Подключение"}</a>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="menu__item" href="/utilities"
|
<a class="menu__item" href="/utilities">{"Утилиты"}</a>
|
||||||
>{"Утилиты"}</a>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="menu__item" href="/log">{"Лог"}</a>
|
<a class="menu__item" href="/log">{"Лог"}</a>
|
||||||
@@ -161,9 +145,7 @@
|
|||||||
{#each wigets as widget, i}
|
{#each wigets as widget, i}
|
||||||
{#if widget.page === pagesName.page}
|
{#if widget.page === pagesName.page}
|
||||||
{#if widget.widget === "input"}
|
{#if widget.widget === "input"}
|
||||||
<Input
|
<Input bind:value={widget.status} widget={widget} />
|
||||||
bind:value={widget.status}
|
|
||||||
widget={widget} />
|
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
@@ -171,14 +153,7 @@
|
|||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
<Card title="Редактор JSON">
|
<Card title="Редактор JSON">
|
||||||
<textarea
|
<textarea on:input={wigetsUpdate} rows="10" class="json-input w-full" id="text1">{syntaxHighlight(JSON.stringify(wigets))}</textarea>
|
||||||
on:input={wigetsUpdate}
|
|
||||||
rows="10"
|
|
||||||
class="json-input w-full"
|
|
||||||
id="text1"
|
|
||||||
>{syntaxHighlight(
|
|
||||||
JSON.stringify(wigets)
|
|
||||||
)}</textarea>
|
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</Route>
|
</Route>
|
||||||
@@ -198,14 +173,7 @@
|
|||||||
<Route path="/utilities">
|
<Route path="/utilities">
|
||||||
<div class="cards-grid">
|
<div class="cards-grid">
|
||||||
<Card title="Редактор JSON">
|
<Card title="Редактор JSON">
|
||||||
<textarea
|
<textarea on:input={wigetsUpdate} rows="10" class="json-input w-full" id="text1">{syntaxHighlight(JSON.stringify(wigets))}</textarea>
|
||||||
on:input={wigetsUpdate}
|
|
||||||
rows="10"
|
|
||||||
class="json-input w-full"
|
|
||||||
id="text1"
|
|
||||||
>{syntaxHighlight(
|
|
||||||
JSON.stringify(wigets)
|
|
||||||
)}</textarea>
|
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</Route>
|
</Route>
|
||||||
|
|||||||
Reference in New Issue
Block a user