Skip to content

Commit 2cca3f3

Browse files
authored
Updated Logs Page to use mds components (#3114)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
1 parent 36d96a1 commit 2cca3f3

File tree

4 files changed

+41
-50
lines changed

4 files changed

+41
-50
lines changed

portal-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"local-storage-fallback": "^4.1.1",
1818
"lodash": "^4.17.21",
1919
"luxon": "^3.4.3",
20-
"mds": "https://github.com/minio/mds.git#v0.11.0",
20+
"mds": "https://github.com/minio/mds.git#v0.11.1",
2121
"react": "^18.1.0",
2222
"react-component-export-image": "^1.0.6",
2323
"react-copy-to-clipboard": "^5.0.2",

portal-ui/src/screens/Console/Logs/ErrorLogs/ErrorLogs.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import React, { Fragment, useEffect, useState } from "react";
1818
import { IMessageEvent, w3cwebsocket as W3CWebSocket } from "websocket";
19-
import { Box, Button, Grid, PageLayout, Select } from "mds";
19+
import { Box, Button, Grid, PageLayout, Select, Table, TableBody } from "mds";
2020
import { useSelector } from "react-redux";
2121
import { ErrorResponseHandler } from "../../../../common/types";
2222
import { AppState, useAppDispatch } from "../../../../store";
@@ -29,10 +29,6 @@ import {
2929
import { setHelpName } from "../../../../systemSlice";
3030
import SearchBox from "../../Common/SearchBox";
3131
import api from "../../../../../src/common/api";
32-
import Paper from "@mui/material/Paper";
33-
import Table from "@mui/material/Table";
34-
import TableBody from "@mui/material/TableBody";
35-
import TableContainer from "@mui/material/TableContainer";
3632
import LogLine from "./LogLine";
3733
import PageHeaderWrapper from "../../Common/PageHeaderWrapper/PageHeaderWrapper";
3834
import HelpMenu from "../../HelpMenu";
@@ -304,7 +300,7 @@ const ErrorLogs = () => {
304300
borderRadius: 4,
305301
}}
306302
>
307-
<TableContainer component={Paper}>
303+
<Box withBorders customBorderPadding={"0px"} useBackground>
308304
<Table aria-label="collapsible table">
309305
<TableBody>
310306
{filteredMessages.map((m) => {
@@ -313,11 +309,11 @@ const ErrorLogs = () => {
313309
</TableBody>
314310
</Table>
315311
{filteredMessages.length === 0 && (
316-
<div style={{ padding: 20, textAlign: "center" }}>
312+
<Box sx={{ padding: 20, textAlign: "center" }}>
317313
No logs to display
318-
</div>
314+
</Box>
319315
)}
320-
</TableContainer>
316+
</Box>
321317
</Box>
322318
</Grid>
323319
</Grid>

portal-ui/src/screens/Console/Logs/ErrorLogs/LogLine.tsx

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
import React, { Fragment, useState } from "react";
1717
import { DateTime } from "luxon";
18-
import TableRow from "@mui/material/TableRow";
19-
import TableCell from "@mui/material/TableCell";
20-
import Collapse from "@mui/material/Collapse";
21-
import Typography from "@mui/material/Typography";
2218
import { LogMessage } from "../types";
23-
import { Box, BoxArrowDown, BoxArrowUp, WarnFilledIcon } from "mds";
19+
import {
20+
Box,
21+
BoxArrowDown,
22+
BoxArrowUp,
23+
TableCell,
24+
TableRow,
25+
WarnFilledIcon,
26+
} from "mds";
2427

2528
import getByKey from "lodash/get";
2629

@@ -183,16 +186,14 @@ const LogLine = (props: { log: LogMessage }) => {
183186
<React.Fragment key={logTime.toString()}>
184187
<TableRow
185188
sx={{
186-
"& > *": { borderBottom: "unset" },
187189
cursor: "pointer",
188190
borderLeft: "0",
189191
borderRight: "0",
190192
}}
191-
style={{ backgroundColor: "#FDFDFD" }}
192193
>
193194
<TableCell
194195
onClick={() => setOpen(!open)}
195-
style={{ width: 280, color: "#989898", fontSize: 12 }}
196+
sx={{ width: 280, color: "#989898", fontSize: 12 }}
196197
>
197198
<Box
198199
sx={{
@@ -211,7 +212,7 @@ const LogLine = (props: { log: LogMessage }) => {
211212
</TableCell>
212213
<TableCell
213214
onClick={() => setOpen(!open)}
214-
style={{ width: 200, color: "#989898", fontSize: 12 }}
215+
sx={{ width: 200, color: "#989898", fontSize: 12 }}
215216
>
216217
<Box
217218
sx={{
@@ -224,28 +225,28 @@ const LogLine = (props: { log: LogMessage }) => {
224225
</Box>
225226
</TableCell>
226227
<TableCell onClick={() => setOpen(!open)}>
227-
<div
228-
style={{
228+
<Box
229+
sx={{
229230
display: "table",
230231
tableLayout: "fixed",
231232
width: "100%",
232233
paddingLeft: 10,
233234
paddingRight: 10,
234235
}}
235236
>
236-
<div
237-
style={{
237+
<Box
238+
sx={{
238239
display: "table-cell",
239240
whiteSpace: "nowrap",
240241
textOverflow: "ellipsis",
241242
overflow: "hidden",
242243
}}
243244
>
244245
{titleLogMessage}
245-
</div>
246-
</div>
246+
</Box>
247+
</Box>
247248
</TableCell>
248-
<TableCell onClick={() => setOpen(!open)} style={{ width: 40 }}>
249+
<TableCell onClick={() => setOpen(!open)} sx={{ width: 40 }}>
249250
<Box
250251
sx={{
251252
"& .min-icon": {
@@ -266,7 +267,7 @@ const LogLine = (props: { log: LogMessage }) => {
266267
{open ? (
267268
<TableRow>
268269
<TableCell
269-
style={{
270+
sx={{
270271
paddingBottom: 0,
271272
paddingTop: 0,
272273
width: 200,
@@ -277,28 +278,22 @@ const LogLine = (props: { log: LogMessage }) => {
277278
fontWeight: "bold",
278279
}}
279280
>
280-
<Collapse in={open} timeout="auto" unmountOnExit>
281-
<div style={{ marginTop: 10 }}>Log Details</div>
282-
</Collapse>
281+
<Box sx={{ marginTop: 10 }}>Log Details</Box>
283282
</TableCell>
284-
<TableCell colSpan={2} style={{ paddingBottom: 0, paddingTop: 0 }}>
285-
<Collapse in={open} timeout="auto" unmountOnExit>
286-
<Box sx={{ margin: 1 }}>
287-
<Typography
288-
style={{
289-
background: "#efefef",
290-
border: "1px solid #dedede",
291-
padding: 4,
292-
fontSize: 14,
293-
color: "#666666",
294-
}}
295-
>
296-
{fullMessage}
297-
</Typography>
298-
</Box>
299-
</Collapse>
283+
<TableCell sx={{ paddingBottom: 0, paddingTop: 0 }} colSpan={2}>
284+
<Box
285+
sx={{
286+
margin: 1,
287+
padding: 4,
288+
fontSize: 14,
289+
}}
290+
withBorders
291+
useBackground
292+
>
293+
{fullMessage}
294+
</Box>
300295
</TableCell>
301-
<TableCell style={{ paddingBottom: 0, paddingTop: 0, width: 40 }} />
296+
<TableCell sx={{ paddingBottom: 0, paddingTop: 0, width: 40 }} />
302297
</TableRow>
303298
) : null}
304299
</React.Fragment>

portal-ui/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8412,9 +8412,9 @@ mdn-data@2.0.4:
84128412
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.4.tgz#699b3c38ac6f1d728091a64650b65d388502fd5b"
84138413
integrity sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA==
84148414

8415-
"mds@https://github.com/minio/mds.git#v0.11.0":
8416-
version "0.11.0"
8417-
resolved "https://github.com/minio/mds.git#f8f53f26977ee21d6de5c11915f34fb12a2a01ab"
8415+
"mds@https://github.com/minio/mds.git#v0.11.1":
8416+
version "0.11.1"
8417+
resolved "https://github.com/minio/mds.git#63d4712c8e23aea76f93fec86d332f80ccba8207"
84188418
dependencies:
84198419
"@types/styled-components" "^5.1.28"
84208420
"@uiw/react-textarea-code-editor" "^2.1.9"

0 commit comments

Comments
 (0)