From 3e6941f5e9277e8c90d0b164cc084badadedcb2f Mon Sep 17 00:00:00 2001 From: Benjamin Perez Date: Tue, 15 Aug 2023 14:36:22 -0600 Subject: [PATCH] Migrated available mds components in Logs Page Signed-off-by: Benjamin Perez --- .../Console/Logs/ErrorLogs/ErrorLogs.tsx | 234 ++++++------------ portal-ui/tests/utils/elements.ts | 2 +- 2 files changed, 82 insertions(+), 154 deletions(-) diff --git a/portal-ui/src/screens/Console/Logs/ErrorLogs/ErrorLogs.tsx b/portal-ui/src/screens/Console/Logs/ErrorLogs/ErrorLogs.tsx index 80ef83b52b..39f680b652 100644 --- a/portal-ui/src/screens/Console/Logs/ErrorLogs/ErrorLogs.tsx +++ b/portal-ui/src/screens/Console/Logs/ErrorLogs/ErrorLogs.tsx @@ -13,90 +13,34 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . + import React, { Fragment, useEffect, useState } from "react"; import { IMessageEvent, w3cwebsocket as W3CWebSocket } from "websocket"; -import { Theme } from "@mui/material/styles"; -import { Button, PageLayout } from "mds"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; +import { Box, Button, Grid, PageLayout, Select } from "mds"; import { useSelector } from "react-redux"; -import { FormControl, Grid, InputBase, MenuItem, Select } from "@mui/material"; - -import { ErrorResponseHandler } from "../../../../../src/common/types"; -import api from "../../../../../src/common/api"; +import { ErrorResponseHandler } from "../../../../common/types"; import { AppState, useAppDispatch } from "../../../../store"; - import { wsProtocol } from "../../../../utils/wsUtils"; import { - actionsTray, - containerForHeader, - inlineCheckboxes, - searchField, -} from "../../Common/FormComponents/common/styleLibrary"; + logMessageReceived, + logResetMessages, + setLogsStarted, +} from "../logsSlice"; +import { setHelpName } from "../../../../systemSlice"; import SearchBox from "../../Common/SearchBox"; +import api from "../../../../../src/common/api"; import Paper from "@mui/material/Paper"; import Table from "@mui/material/Table"; import TableBody from "@mui/material/TableBody"; import TableContainer from "@mui/material/TableContainer"; import LogLine from "./LogLine"; -import { - logMessageReceived, - logResetMessages, - setLogsStarted, -} from "../logsSlice"; -import makeStyles from "@mui/styles/makeStyles"; import PageHeaderWrapper from "../../Common/PageHeaderWrapper/PageHeaderWrapper"; import HelpMenu from "../../HelpMenu"; -import { setHelpName } from "../../../../systemSlice"; - -const useStyles = makeStyles((theme: Theme) => - createStyles({ - logList: { - background: "#fff", - minHeight: 400, - height: "calc(100vh - 200px)", - overflow: "auto", - fontSize: 13, - borderRadius: 4, - }, - logerror_tab: { - color: "#A52A2A", - paddingLeft: 25, - }, - nodeField: { - width: "100%", - }, - ...actionsTray, - actionsTray: { - ...actionsTray.actionsTray, - marginBottom: 0, - }, - ...searchField, - - ...inlineCheckboxes, - ...containerForHeader, - }), -); - -export const SelectStyled = withStyles((theme: Theme) => - createStyles({ - root: { - lineHeight: "50px", - "label + &": { - marginTop: theme.spacing(3), - }, - "& .MuiSelect-select:focus": { - backgroundColor: "transparent", - }, - }, - }), -)(InputBase); var c: any = null; const ErrorLogs = () => { const dispatch = useAppDispatch(); - const classes = useStyles(); const messages = useSelector((state: AppState) => state.logs.logMessages); const logsStarted = useSelector((state: AppState) => state.logs.logsStarted); @@ -223,9 +167,6 @@ const ErrorLogs = () => { .invoke("GET", `/api/v1/nodes`) .then((res: string[]) => { setNodes(res); - // if (res.length > 0) { - // setSelectedNode(res[0]); - // } setLoadingNodes(false); }) .catch((err: ErrorResponseHandler) => { @@ -243,97 +184,64 @@ const ErrorLogs = () => { } /> - - + + {!loadingNodes ? ( - - - + { - setLogType(e.target.value as string); - }} - className={classes.searchField} - disabled={loadingNodes || logsStarted} - input={} - placeholder={"Select Log Type"} - > - - All Log Types - - - MinIO - - - Application - - - + { - setSelectedUserAgent(e.target.value as string); - }} - className={classes.searchField} - disabled={userAgents.length < 1 || logsStarted} - input={} - > - - Select User Agent - - {userAgents.map((anAgent) => ( - - {anAgent} - - ))} - - +