From 9181cf62013a9d9014ab86e3d89a8babaf9f9519 Mon Sep 17 00:00:00 2001 From: IoT Manager <67171972+IoTManagerProject@users.noreply.github.com> Date: Tue, 10 Oct 2023 12:26:09 +0200 Subject: [PATCH] =?UTF-8?q?=D0=B7=D0=B0=D0=BF=D1=80=D0=B0=D1=88=D0=B8?= =?UTF-8?q?=D0=B2=D0=B0=D0=B5=D0=BC=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB?= =?UTF-8?q?=D1=8C=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=B8=D0=BB=D1=8F=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 6 ++--- src/App.svelte | 2 +- src/pages/Profile.svelte | 49 ++++++++++++++++++++++++++++++++-------- 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/public/index.html b/public/index.html index 8b97c0b..7d7c3d2 100644 --- a/public/index.html +++ b/public/index.html @@ -4,12 +4,12 @@ - IoT Manager 4.5.2 + IoT Manager 4.5.3 - + - + diff --git a/src/App.svelte b/src/App.svelte index 6063a05..4525d57 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -52,7 +52,7 @@ let preventMove = false; let screenSize; const blobDebug = false; - const devMode = false; + const devMode = true; let percent; diff --git a/src/pages/Profile.svelte b/src/pages/Profile.svelte index ffa7bac..330c6b4 100644 --- a/src/pages/Profile.svelte +++ b/src/pages/Profile.svelte @@ -13,9 +13,11 @@ let errors = []; let allmodeinfo = null; let userBuilds = null; + let profile = null; var updateInterval; onMount(async () => { + await getProfile(); await getModInfo(); await getUserBuilds(); }); @@ -83,6 +85,28 @@ } }; + const getProfile = async () => { + try { + const JWT = Cookies.get("token_iotm2"); + let res = await fetch("https://portal.iotmanager.org/compiler/profile", { + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${JWT}`, + }, + mode: "cors", + method: "GET", + }); + if (res.ok) { + profile = await res.json(); + profile = profile.message; + } else { + console.log("error", res.statusText); + } + } catch (e) { + console.log("error", e); + } + }; + const delBuild = async (ord) => { try { const JWT = Cookies.get("token_iotm2"); @@ -142,7 +166,7 @@ {#if show} - {#if allmodeinfo && myProfileJson} + {#if allmodeinfo && myProfileJson && profile}
@@ -151,32 +175,39 @@

{userdata.username}

- {#each myProfileJson.modules.virtual_elments as m, i} - {#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]} + + + {#each profile.modules.virtual_elments as m, i} + {#if allmodeinfo[m.path]?.usedLibs[profile.projectProp.platformio.default_envs]}

(m.active = !m.active)} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}

{/if} {/each} - {#each myProfileJson.modules.sensors as m, i} - {#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]} + {#each profile.modules.sensors as m, i} + {#if allmodeinfo[m.path]?.usedLibs[profile.projectProp.platformio.default_envs]}

(m.active = !m.active)} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}

{/if} {/each} - {#each myProfileJson.modules.executive_devices as m, i} - {#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]} + {#each profile.modules.executive_devices as m, i} + {#if allmodeinfo[m.path]?.usedLibs[profile.projectProp.platformio.default_envs]}

(m.active = !m.active)} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}

{/if} {/each} - {#each myProfileJson.modules.screens as m, i} - {#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]} + {#each profile.modules.screens as m, i} + {#if allmodeinfo[m.path]?.usedLibs[profile.projectProp.platformio.default_envs]}

(m.active = !m.active)} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{m.path.substring(m.path.lastIndexOf("/") + 1, m.path.length)}