запрашиваем профиль компилятора

This commit is contained in:
IoT Manager
2023-10-10 12:26:09 +02:00
parent 2b37fa9172
commit 9181cf6201
3 changed files with 44 additions and 13 deletions

View File

@@ -4,12 +4,12 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" /> <meta name="viewport" content="width=device-width,initial-scale=1" />
<title>IoT Manager 4.5.2</title> <title>IoT Manager 4.5.3</title>
<link rel="icon" type="image/png" href="/favicon.ico" /> <link rel="icon" type="image/png" href="/favicon.ico" />
<link rel="stylesheet" href="/build/bundle.css?4520" /> <link rel="stylesheet" href="/build/bundle.css?4530" />
<script defer src="/build/bundle.js?4520"></script> <script defer src="/build/bundle.js?4530"></script>
</head> </head>
<body></body> <body></body>

View File

@@ -52,7 +52,7 @@
let preventMove = false; let preventMove = false;
let screenSize; let screenSize;
const blobDebug = false; const blobDebug = false;
const devMode = false; const devMode = true;
let percent; let percent;

View File

@@ -13,9 +13,11 @@
let errors = []; let errors = [];
let allmodeinfo = null; let allmodeinfo = null;
let userBuilds = null; let userBuilds = null;
let profile = null;
var updateInterval; var updateInterval;
onMount(async () => { onMount(async () => {
await getProfile();
await getModInfo(); await getModInfo();
await getUserBuilds(); 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) => { const delBuild = async (ord) => {
try { try {
const JWT = Cookies.get("token_iotm2"); const JWT = Cookies.get("token_iotm2");
@@ -142,7 +166,7 @@
</script> </script>
{#if show} {#if show}
{#if allmodeinfo && myProfileJson} {#if allmodeinfo && myProfileJson && profile}
<div class="my-4"> <div class="my-4">
<div class="grd-1col1"> <div class="grd-1col1">
<Card title=""> <Card title="">
@@ -151,32 +175,39 @@
<p class="text-center text-gray-500 font-bold">{userdata.username}</p> <p class="text-center text-gray-500 font-bold">{userdata.username}</p>
</div> </div>
<div class="grid my-4 grid-cols-2 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-12 2xl:grid-cols-12 gap-4"> <div class="grid my-4 grid-cols-2 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-12 2xl:grid-cols-12 gap-4">
{#each myProfileJson.modules.virtual_elments as m, i} <!--{#each Object.entries(allmodeinfo) as [key, param]}
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]} <div>
<p class="cursor-pointer select-none text-black text-xs font-medium mr-2 px-0.5 py-0.5 rounded text-center">{key.substring(key.lastIndexOf("/") + 1, key.length)}</p>
</div>
{/each}-->
{#each profile.modules.virtual_elments as m, i}
{#if allmodeinfo[m.path]?.usedLibs[profile.projectProp.platformio.default_envs]}
<div> <div>
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<p on:click={() => (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)}</p> <p on:click={() => (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)}</p>
</div> </div>
{/if} {/if}
{/each} {/each}
{#each myProfileJson.modules.sensors as m, i} {#each profile.modules.sensors as m, i}
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]} {#if allmodeinfo[m.path]?.usedLibs[profile.projectProp.platformio.default_envs]}
<div> <div>
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<p on:click={() => (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)}</p> <p on:click={() => (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)}</p>
</div> </div>
{/if} {/if}
{/each} {/each}
{#each myProfileJson.modules.executive_devices as m, i} {#each profile.modules.executive_devices as m, i}
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]} {#if allmodeinfo[m.path]?.usedLibs[profile.projectProp.platformio.default_envs]}
<div> <div>
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<p on:click={() => (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)}</p> <p on:click={() => (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)}</p>
</div> </div>
{/if} {/if}
{/each} {/each}
{#each myProfileJson.modules.screens as m, i} {#each profile.modules.screens as m, i}
{#if allmodeinfo[m.path]?.usedLibs[myProfileJson.projectProp.platformio.default_envs]} {#if allmodeinfo[m.path]?.usedLibs[profile.projectProp.platformio.default_envs]}
<div> <div>
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<p on:click={() => (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)}</p> <p on:click={() => (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)}</p>