Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
davemarco committed Sep 12, 2024
1 parent 23c1de2 commit 6c45d69
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions new-log-viewer/src/components/StatusBar/LogLevelFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import React, {useContext, useState} from "react";
import React, {
useContext,
useState
} from "react";

import Option from "@mui/joy/Option";
import Select from "@mui/joy/Select";
Expand All @@ -7,7 +10,7 @@ import {StateContext} from "../../contexts/StateContextProvider";
import {
LOG_LEVEL,
LOG_LEVEL_NAMES_LIST,
LOG_LEVEL_VALUES_LIST
LOG_LEVEL_VALUES_LIST,
} from "../../typings/logs";

export default function LogLevelFilter () {
Expand All @@ -22,21 +25,20 @@ export default function LogLevelFilter () {
event: React.SyntheticEvent | null,
newValue: Array<string> | null
) => {
const selectedLogLevels: LOG_LEVEL[] = newValue
? newValue.map((value) => Number(value)) // Convert strings to numbers
: [];
// convert strings to numbers.
const selected: LOG_LEVEL[] = newValue ?
newValue.map((value) => Number(value)) : [];

setSelectedLogLevels(selectedLogLevels);
changeLogLevelFilter(selectedLogLevels);
setSelectedLogLevels(selected);
changeLogLevelFilter(selected);
console.log(`You have chosen "${newValue}"`);
};

return (
<Select
// Convert selected log levels to strings for value
// Convert selected log levels to strings for value.
value={selectedLogLevels.map(String)}
multiple
onChange={handleChange}
sx={{minWidth: "13rem"}}
slotProps={{
listbox: {
Expand All @@ -45,6 +47,7 @@ export default function LogLevelFilter () {
},
},
}}
onChange={handleChange}
>
{LOG_LEVEL_NAMES_LIST.map((logLevelName, index) => (
<Option
Expand Down

0 comments on commit 6c45d69

Please sign in to comment.