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)}