Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

166 fix: Errors etc. #168

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions frontend_app/src/components/Modal/LicenseRegisterModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ const LicenseRegisterModal = () => {
>
<InputBase
variant="outlined"
margin="normal"
required
fullWidth
name="enterpriseKey"
Expand Down Expand Up @@ -220,7 +219,7 @@ const LicenseRegisterModal = () => {
<Link
target="_blank"
color="inherit"
href="https://ds2.ai/buy-license/"
to="https://ds2.ai/buy-license/"
style={{ color: "var(--secondary1)" }}
>
<u>{t("Buy License")}</u>
Expand Down
60 changes: 33 additions & 27 deletions frontend_app/src/components/Train/SettingGpuOption.js
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 = ({
Expand Down Expand Up @@ -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);
Expand All @@ -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 = () => {
Expand Down Expand Up @@ -182,8 +189,8 @@ const SettingGpuOption = ({
// />
// );
// else
return (
<>
return (
<>
<Grid sx={{ p: 1.5 }}>
{serverDataList ? (
<>
Expand All @@ -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 (
<Grid item xs={12}>
<Grid item key={serverName} xs={12}>
<Grid container sx={{ mb: 1 }}>
<span
style={{
Expand Down Expand Up @@ -254,7 +262,7 @@ const SettingGpuOption = ({
: false;

return (
<Grid container sx={{ mb: 0.5 }}>
<Grid container key={serverName} sx={{ mb: 0.5 }}>
{isStatusZero && (
<Checkbox
id={`gpu_${gpuId}_checkbox`}
Expand All @@ -272,9 +280,7 @@ const SettingGpuOption = ({
}
/>
)}
<span style={{ fontSize: "15px" }}>
{gpuName}
</span>
<span style={{ fontSize: "15px" }}>{gpuName}</span>
</Grid>
);
})}
Expand Down Expand Up @@ -304,8 +310,8 @@ const SettingGpuOption = ({
)}
</Grid>
<LicenseRegisterModal />
</>
);
</>
);
};

export default SettingGpuOption;
4 changes: 2 additions & 2 deletions frontend_app/src/layouts/Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ const Admin = ({ history, ...rest }) => {
}}
>
<MySnackbar
variant={messages.category}
variant={messages.category ?? "success"}
className={classes.margin}
message={t(messages.message)}
/>
Expand All @@ -553,7 +553,7 @@ const Admin = ({ history, ...rest }) => {
>
<MySnackbarAction
classFrom="sample"
variant={messages.category}
variant={messages.category ?? "success"}
className={classes.margin}
message={t(messages.message)}
/>
Expand Down