From bb0eeb83f11e5b4baf416865817bf38a2f6c2dcb Mon Sep 17 00:00:00 2001 From: IoT Manager <67171972+IoTManagerProject@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:17:55 +0200 Subject: [PATCH] =?UTF-8?q?=D0=B2=D0=B7=D0=B0=D0=B8=D0=BC=D0=BE=D0=B4?= =?UTF-8?q?=D0=B5=D0=B9=D1=81=D1=82=D0=B2=D0=B8=D0=B5=20=D1=81=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=80=D1=82=D0=B0=D0=BB=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lang.js | 30 +++-------- src/pages/Profile.svelte | 111 ++++++++++++++++++++++----------------- 2 files changed, 70 insertions(+), 71 deletions(-) diff --git a/src/lang.js b/src/lang.js index 8423ccf..db00979 100644 --- a/src/lang.js +++ b/src/lang.js @@ -1,32 +1,18 @@ export default { ru: { - "login.email": "Введите email", - "login.pass": "Введите пароль", + "login.email": "Email", + "login.pass": "Пароль", "login.login": "Вход", - err_of_registration: "Ошибка регестрации", - err_of_login: "Ошибка входа в систему", - err_user_exist: "Такой пользователь уже был зарегестрирован", - err_user_not_exist: "Такой пользователь не был зарегестрирован", - err_pass: "Неправильный пароль", - err_empty_fullname: "Пустое поле имени", - err_empty_user: "Пустое поле Email адреса", - err_not_email: "Неправильно введен Email", - err_pass_lenth: "Пароль должен быть от 4 до 10 символов", - ok_success_login: "Вы вошли в систему", + "profile.update": "Обновить", + ok_success: "Задача запущена", + err_order_exist: "Ваша задача выполняется! Cледующию задачу можно будет запустить после завершения", }, en: { "login.email": "Email", "login.pass": "Password", "login.login": "Login", - err_of_registration: "Ошибка регестрации", - err_of_login: "Ошибка входа в систему", - err_user_exist: "Такой пользователь уже был зарегестрирован", - err_user_not_exist: "Такой пользователь не был зарегестрирован", - err_pass: "Неправильный пароль", - err_empty_fullname: "Пустое поле имени", - err_empty_user: "Пустое поле Email адреса", - err_not_email: "Неправильно введен Email", - err_pass_lenth: "Пароль должен быть от 4 до 10 символов", - ok_success_login: "Вы вошли в систему", + "profile.update": "Update", + ok_success: "Задача запущена", + err_order_exist: "Ваша задача выполняется! Cледующию задачу можно будет запустить после завершения", }, }; diff --git a/src/pages/Profile.svelte b/src/pages/Profile.svelte index b92c41f..77aa8a8 100644 --- a/src/pages/Profile.svelte +++ b/src/pages/Profile.svelte @@ -7,6 +7,7 @@ export let myProfileJson; let errors = []; + let allmodeinfo = null; onMount(async () => { @@ -30,23 +31,22 @@ } }; - const post = async (user) => { - errors = []; + const update = async () => { try { - let res = await fetch("https://portal.iotmanager.org/api/auth/login", { + let res = await fetch("https://portal.iotmanager.org/compiler/esporder", { mode: "cors", method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json", }, - body: JSON.stringify(user), + body: JSON.stringify(myProfileJson), }); const content = await res.json(); //console.log(content); if (res.ok) { - errors = [{ msg: "ok_success_login" }]; - saveToken(content.message); + errors = [{ msg: "ok_success" }]; + console.log(content.message); } else { errors = content.message; } @@ -54,57 +54,70 @@ console.log(e); } }; - - const saveToken = async (token) => { - console.log("token to be saved: ", token); - }; {#if show} - {#if allmodeinfo && myProfileJson} -
(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)}
-{myProfileJson.projectProp.platformio.default_envs}
+{myProfileJson.username}
+((m.active = !m.active), (m.touched = true))} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none {m.touched ? 'border border-gray-400' : 'border border-green-100'} 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), (m.touched = true))} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none {m.touched ? 'border border-gray-400' : 'border border-green-100'} 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), (m.touched = true))} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none {m.touched ? 'border border-gray-400' : 'border border-green-100'} 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), (m.touched = true))} class="{m.active ? 'bg-green-100' : ''} cursor-pointer select-none {m.touched ? 'border border-gray-400' : 'border border-green-100'} 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 myProfileJson.modules.sensors as m, i} - {#if allmodeinfo[m.path]?.usedLibs[myProfileJson.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)}
-