From 1e341e8d3fe4b0b1403e007911f2a7d69e21a8ee Mon Sep 17 00:00:00 2001 From: JunggeunIm Date: Tue, 1 Nov 2022 14:20:03 +0900 Subject: [PATCH] fix: Errors etc. --- .../components/Modal/LicenseRegisterModal.js | 3 +- .../src/components/Train/SettingGpuOption.js | 60 ++++++++++--------- frontend_app/src/layouts/Admin.js | 4 +- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/frontend_app/src/components/Modal/LicenseRegisterModal.js b/frontend_app/src/components/Modal/LicenseRegisterModal.js index 161530e9..7c20ce10 100644 --- a/frontend_app/src/components/Modal/LicenseRegisterModal.js +++ b/frontend_app/src/components/Modal/LicenseRegisterModal.js @@ -161,7 +161,6 @@ const LicenseRegisterModal = () => { > { {t("Buy License")} diff --git a/frontend_app/src/components/Train/SettingGpuOption.js b/frontend_app/src/components/Train/SettingGpuOption.js index cb2031b5..dcb7f652 100644 --- a/frontend_app/src/components/Train/SettingGpuOption.js +++ b/frontend_app/src/components/Train/SettingGpuOption.js @@ -1,4 +1,4 @@ -import React, {useEffect, useState} from "react"; +import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import Button from "components/CustomButtons/Button"; @@ -8,11 +8,14 @@ import { Checkbox, Grid } from "@mui/material"; import LagacySettingGpuOption from "./LegacySettingGpuOption"; import ModalAddServer from "./ModalAddServer"; import ModalDeleteServer from "./ModalDeleteServer"; -import {openErrorSnackbarRequestAction, setPlanModalOpenRequestAction} from "../../redux/reducers/messages"; +import { + openErrorSnackbarRequestAction, + setPlanModalOpenRequestAction, +} from "../../redux/reducers/messages"; import * as api from "../../controller/api"; -import {useDispatch, useSelector} from "react-redux"; -import {IS_ENTERPRISE} from "../../variables/common"; -import {checkIsValidKey} from "../Function/globalFunc"; +import { useDispatch, useSelector } from "react-redux"; +import { IS_ENTERPRISE } from "../../variables/common"; +import { checkIsValidKey } from "../Function/globalFunc"; import LicenseRegisterModal from "../Modal/LicenseRegisterModal"; const SettingGpuOption = ({ @@ -46,7 +49,6 @@ const SettingGpuOption = ({ const [tokenValue, setTokenValue] = useState(""); const [availableGpuListTotal, setAvailableGpuListTotal] = useState(gpuList); - const submitAddServer = () => { console.log("hostValue", hostValue); console.log("tokenValue", tokenValue); @@ -59,28 +61,33 @@ const SettingGpuOption = ({ return; } - api.postAddServer({ - ip: hostValue, - access_token: tokenValue, - }).then((res) => { + api + .postAddServer({ + ip: hostValue, + access_token: tokenValue, + }) + .then((res) => { if (res.data?.gpu_info) { - setAvailableGpuListTotal(Object.assign({}, availableGpuListTotal, { - [res.data.name]: res.data.gpu_info - })) + setAvailableGpuListTotal( + Object.assign({}, availableGpuListTotal, { + [res.data.name]: res.data.gpu_info, + }) + ); closeAddServerModal(); } else { - dispatch(openErrorSnackbarRequestAction(t("Please check the connection."))); + dispatch( + openErrorSnackbarRequestAction(t("Please check the connection.")) + ); } }); - }; const submitDelete = () => { console.log("selectedServer"); console.log(selectedServer); api.deleteAddServer(selectedServer).then((res) => { - window.location.reload(); - }); + window.location.reload(); + }); }; const openAddServerModal = () => { @@ -182,8 +189,8 @@ const SettingGpuOption = ({ // /> // ); // else - return ( - <> + return ( + <> {serverDataList ? ( <> @@ -207,10 +214,11 @@ const SettingGpuOption = ({ let serverDict = availableGpuListTotal[serverName]; // let serverName = serverDict.name; let isLocalServer = serverName === "localhost"; - let isChecked = serverDict?.length === checkedDict[serverName]?.length; + let isChecked = + serverDict?.length === checkedDict[serverName]?.length; return ( - + + {isStatusZero && ( )} - - {gpuName} - + {gpuName} ); })} @@ -304,8 +310,8 @@ const SettingGpuOption = ({ )} - - ); + + ); }; export default SettingGpuOption; diff --git a/frontend_app/src/layouts/Admin.js b/frontend_app/src/layouts/Admin.js index 9fa48b11..878f9725 100644 --- a/frontend_app/src/layouts/Admin.js +++ b/frontend_app/src/layouts/Admin.js @@ -537,7 +537,7 @@ const Admin = ({ history, ...rest }) => { }} > @@ -553,7 +553,7 @@ const Admin = ({ history, ...rest }) => { >