diff --git a/src/App.svelte b/src/App.svelte
index 4525d57..28d6288 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -52,7 +52,7 @@
let preventMove = false;
let screenSize;
const blobDebug = false;
- const devMode = true;
+ const devMode = false;
let percent;
@@ -115,6 +115,10 @@
let paramsJson = {};
let userdata = null;
+ let allmodeinfo = null;
+ let profile = null;
+
+ let serverOnline = false;
let parsed = {
itemsJson: false,
@@ -207,11 +211,14 @@
});
if (res.ok) {
userdata = await res.json();
+ serverOnline = true;
} else {
console.log("error", res.statusText);
+ serverOnline = true;
}
} catch (e) {
console.log("error", e);
+ serverOnline = false;
}
};
@@ -608,9 +615,67 @@
clearParcedFlags();
if (debug) console.log("✔✔", "profile page parced");
pageReady.profile = true;
+ await getModInfo();
+ await getProfile();
}
}
+ const getModInfo = async () => {
+ try {
+ let res = await fetch("https://portal.iotmanager.org/compiler/allmodinfo", {
+ mode: "cors",
+ method: "GET",
+ });
+ if (res.ok) {
+ allmodeinfo = await res.json();
+ allmodeinfo = allmodeinfo.message;
+ } else {
+ console.log("error", res.statusText);
+ }
+ } catch (e) {
+ console.log("error", e);
+ }
+ };
+
+ 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;
+ await markProfileAsPerThisDevProfile();
+ } else {
+ console.log("error", res.statusText);
+ }
+ } catch (e) {
+ console.log("error", e);
+ }
+ };
+
+ const markProfileAsPerThisDevProfile = async () => {
+ for (const [compilerCategory, compilerCategoryModules] of Object.entries(profile.modules)) {
+ let devCategoryModules = myProfileJson.modules[compilerCategory];
+ compilerCategoryModules.forEach((compilerModule) => {
+ compilerModule.active = false;
+ if (devCategoryModules) {
+ devCategoryModules.forEach((devModule) => {
+ if (devModule.path === compilerModule.path) {
+ compilerModule.active = devModule.active;
+ }
+ });
+ }
+ });
+ }
+ };
+
async function initDevList() {
if (firstDevListRequest) {
//при первом запросе листа устройств запишем его целеком
@@ -1307,10 +1372,10 @@
{myProfileJson.projectProp.platformio.default_envs}
-{userdata.username}
-(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)}
-(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)}
+(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)}
+(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)}
+(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)}
+{$t(e.msg)}
{/each} - {#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)}
-(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)}
-(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)}
-{$t(e.msg)}
- {/each} - - {#if userBuilds} -| Название | -Версия | -Время | + + {#if userBuilds} +
|---|
| Название | +Версия | +Время | -Подготовка | -Сборка build | -Сборка fs | -- | - | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {build.projectProp.platformio.default_envs} | -{build.ver} | -{new Date(build.dateAdded).toLocaleString("ru", { timeZone: "Europe/Vienna" })} | - {#if build.status.preparation === 0 && build.status.build === 0 && build.status.fs === 0} -
- {"Ожидание очереди..."} - |
- - | - | - {:else} - |
- showLog(build, "py.txt")}>
- {st[build.status.preparation]}
-
- |
-
- showLog(build, "build.txt")}>
- {st[build.status.build]}
-
- |
-
- showLog(build, "fs.txt")}>{st[build.status.fs]}
- |
- {#if build.status.build === 2 && build.status.preparation === 2 && build.status.fs === 2}
-
- updateBuild("http://portal.iotmanager.org/compiler/userdata/builds/" + build.orderId)} class="tbl-bdy-lg ipt-lg w-full cursor-pointer select-none bg-green-100 hover:bg-green-200">
- Установить - |
- {:else}
- - {/if} - - {#if build.processed} + | Подготовка | +Сборка build | +Сборка fs | ++ | + |
| {build.projectProp.platformio.default_envs} | +{build.ver} | +{new Date(build.dateAdded).toLocaleString("ru", { timeZone: "Europe/Vienna" })} | + {#if build.status.preparation === 0 && build.status.build === 0 && build.status.fs === 0}
- {"Ожидание очереди..."} |
- {:else}
+ | + | + {:else} + |
+ showLog(build, "py.txt")}>
+ {st[build.status.preparation]}
+
+ |
+
+ showLog(build, "build.txt")}>
+ {st[build.status.build]}
+
+ |
+
+ showLog(build, "fs.txt")}>{st[build.status.fs]}
+ |
+ {#if build.status.build === 2 && build.status.preparation === 2 && build.status.fs === 2}
+
+ updateBuild("http://portal.iotmanager.org/compiler/userdata/builds/" + build.orderId)} class="tbl-bdy-lg ipt-lg w-full cursor-pointer select-none bg-green-100 hover:bg-green-200">
+ Установить + |
+ {:else}
+ + {/if} + + {#if build.processed} + |
+ |
+ {:else}
+ + {/if} {/if} - {/if} - |