Skip to content

Commit

Permalink
Group log filtering for info and UI-event messages
Browse files Browse the repository at this point in the history
  • Loading branch information
e-halinen committed Sep 20, 2023
1 parent 5bb0ccd commit 0b91c36
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/renderer/components/HelmetProject/RunLog/RunLog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, {useState} from 'react';

const RunLog = ({isScenarioRunning, entries, closeRunLog}) => {

const [showUIEVENT, setShowUIEVENT] = useState(true);
const [showINFO, setShowINFO] = useState(true);
const [showWARN, setShowWARN] = useState(true);
const [showERROR, setShowERROR] = useState(true);
Expand All @@ -19,11 +18,6 @@ const RunLog = ({isScenarioRunning, entries, closeRunLog}) => {
<div className="Log__header">

<div className="Log__header-controls">
<button className={"Log__header-control" + (showUIEVENT ? " Log__header-control--on" : "")}
onClick={(e) => setShowUIEVENT(prevState => !prevState)}
>
UI-event
</button>
<button className={"Log__header-control" + (showINFO ? " Log__header-control--on" : "")}
onClick={(e) => setShowINFO(prevState => !prevState)}
>
Expand Down Expand Up @@ -52,14 +46,14 @@ const RunLog = ({isScenarioRunning, entries, closeRunLog}) => {
{entries.map((entry) => {
switch (entry.level) {
case "UI-event":
return showUIEVENT ?
return showINFO ?
<div className={"Log__entry Log__entry--ui"} key={entry.id}>
{`[${entry.level}] ${entry.message}`}
</div>
:
"";

case "INFO":
case "INFO" || "UI-event":
const d = new Date(entry.time);
const timestamp = `${('00'+d.getHours()).slice(-2)}:${('00'+d.getMinutes()).slice(-2)}`;
return showINFO ?
Expand Down

0 comments on commit 0b91c36

Please sign in to comment.