fix(ui): remove immutable log
This commit is contained in:
parent
24d9f75864
commit
dd8f666ca5
4 changed files with 18 additions and 6 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import Log from 'Types/session/log';
|
||||
import { Log, LEVEL } from 'Types/session/log';
|
||||
import BottomBlock from '../BottomBlock';
|
||||
import { LEVEL } from 'Types/session/log';
|
||||
import { Tabs, Input, Icon, NoContent } from 'UI';
|
||||
import cn from 'classnames';
|
||||
import ConsoleRow from '../ConsoleRow';
|
||||
|
|
@ -9,7 +8,6 @@ import { getRE } from 'App/utils';
|
|||
import { PlayerContext } from 'App/components/Session/playerContext';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { List, CellMeasurer, CellMeasurerCache, AutoSizer } from 'react-virtualized';
|
||||
import { useObserver } from 'mobx-react-lite';
|
||||
import { useStore } from 'App/mstore';
|
||||
import ErrorDetailsModal from 'App/components/Dashboard/components/Errors/ErrorDetailsModal';
|
||||
import { useModal } from 'App/components/Modal';
|
||||
|
|
@ -138,6 +136,7 @@ function ConsolePanel() {
|
|||
const _rowRenderer = ({ index, key, parent, style }: any) => {
|
||||
const item = filteredList[index];
|
||||
|
||||
console.log({ ...filteredList }, { ...item })
|
||||
return (
|
||||
// @ts-ignore
|
||||
<CellMeasurer cache={cache} columnIndex={0} key={key} rowIndex={index} parent={parent}>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ interface Props {
|
|||
function ConsoleRow(props: Props) {
|
||||
const { log, iconProps, jump, renderWithNL, style, recalcHeight } = props;
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const lines = log.value.split('\n').filter((l: any) => !!l);
|
||||
console.log(log)
|
||||
const lines = log.value?.split('\n').filter((l: any) => !!l) || [];
|
||||
const canExpand = lines.length > 1;
|
||||
|
||||
const clickable = canExpand || !!log.errorId;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import logger from 'App/logger';
|
|||
|
||||
import Resource, { TYPES } from 'Types/session/resource';
|
||||
import { TYPES as EVENT_TYPES } from 'Types/session/event';
|
||||
import Log from 'Types/session/log';
|
||||
import { Log } from 'Types/session/log';
|
||||
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export const LEVEL = {
|
|||
}
|
||||
|
||||
export function isRed(log) {
|
||||
return log.level === EXCEPTION || log.level === ERROR;
|
||||
return
|
||||
}
|
||||
|
||||
export default Record({
|
||||
|
|
@ -36,4 +36,16 @@ export default Record({
|
|||
}
|
||||
});
|
||||
|
||||
interface ILog {
|
||||
level: string
|
||||
value: string
|
||||
time: number
|
||||
index?: number
|
||||
errorId?: string
|
||||
}
|
||||
|
||||
export const Log = (log: ILog) => ({
|
||||
isRed: () => log.level === EXCEPTION || log.level === ERROR,
|
||||
isYellow: () => log.level === WARNING || log.level === WARN,
|
||||
...log
|
||||
})
|
||||
Loading…
Add table
Reference in a new issue