fix(ui): fix live assist console logs
This commit is contained in:
parent
5954979e86
commit
da6d5ae011
7 changed files with 28 additions and 13 deletions
|
|
@ -56,7 +56,7 @@ function Player(props: IProps) {
|
|||
</div>
|
||||
{bottomBlock === CONSOLE ? (
|
||||
<div style={{ maxWidth, width: '100%' }}>
|
||||
<ConsolePanel />
|
||||
<ConsolePanel isLive />
|
||||
</div>
|
||||
) : null}
|
||||
{!fullView && !isMultiview ? (
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import React, { useEffect } from 'react';
|
||||
import React, { CSSProperties, useEffect } from 'react';
|
||||
import cn from 'classnames';
|
||||
import stl from './bottomBlock.module.css';
|
||||
|
||||
let timer = null;
|
||||
const BottomBlock = ({
|
||||
children = null,
|
||||
className = '',
|
||||
|
|
@ -10,6 +9,13 @@ const BottomBlock = ({
|
|||
onMouseEnter = () => {},
|
||||
onMouseLeave = () => {},
|
||||
...props
|
||||
}: {
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
additionalHeight?: number;
|
||||
onMouseEnter?: () => void;
|
||||
onMouseLeave?: () => void;
|
||||
style?: Partial<CSSProperties>;
|
||||
}) => {
|
||||
useEffect(() => {}, []);
|
||||
|
||||
|
|
@ -6,7 +6,7 @@ const Content = ({
|
|||
children,
|
||||
className,
|
||||
...props
|
||||
}) => (
|
||||
}: { children?: React.ReactNode; className?: string }) => (
|
||||
<div className={ cn(className, stl.content) } { ...props } >
|
||||
{ children }
|
||||
</div>
|
||||
|
|
@ -12,6 +12,12 @@ const Header = ({
|
|||
onFilterChange,
|
||||
showClose = true,
|
||||
...props
|
||||
}: {
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
closeBottomBlock?: () => void;
|
||||
onFilterChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
||||
showClose?: boolean;
|
||||
}) => (
|
||||
<div className={ cn("relative border-r border-l py-1", stl.header) } >
|
||||
<div className={ cn("w-full h-full flex justify-between items-center", className) } >
|
||||
|
|
@ -29,7 +29,7 @@ const LEVEL_TAB = {
|
|||
|
||||
const TABS = [ALL, ERRORS, WARNINGS, INFO].map((tab) => ({ text: tab, key: tab }));
|
||||
|
||||
function renderWithNL(s = '') {
|
||||
function renderWithNL(s: string | null = '') {
|
||||
if (typeof s !== 'string') return '';
|
||||
return s.split('\n').map((line, i) => <div key={i + line.slice(0, 6)} className={cn({ 'ml-20': i !== 0 })}>{line}</div>);
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ const getIconProps = (level: any) => {
|
|||
|
||||
const INDEX_KEY = 'console';
|
||||
|
||||
function ConsolePanel() {
|
||||
function ConsolePanel({ isLive }: { isLive: boolean }) {
|
||||
const {
|
||||
sessionStore: { devTools },
|
||||
} = useStore()
|
||||
|
|
@ -75,10 +75,13 @@ function ConsolePanel() {
|
|||
const jump = (t: number) => player.jump(t)
|
||||
|
||||
const { logList, exceptionsList, logListNow, exceptionsListNow } = store.get()
|
||||
const list = useMemo(() =>
|
||||
logList.concat(exceptionsList).sort((a, b) => a.time - b.time),
|
||||
const list = isLive ?
|
||||
useMemo(() => logListNow.concat(exceptionsListNow).sort((a, b) => a.time - b.time),
|
||||
[logListNow.length, exceptionsListNow.length]
|
||||
) as ILog[]
|
||||
: useMemo(() => logList.concat(exceptionsList).sort((a, b) => a.time - b.time),
|
||||
[ logList.length, exceptionsList.length ],
|
||||
) as ILog[]
|
||||
) as ILog[]
|
||||
let filteredList = useRegExListFilterMemo(list, l => l.value, filter)
|
||||
filteredList = useTabListFilterMemo(filteredList, l => LEVEL_TAB[l.level], ALL, activeTab)
|
||||
|
||||
|
|
@ -101,7 +104,7 @@ function ConsolePanel() {
|
|||
timeoutStartAutoscroll()
|
||||
}
|
||||
|
||||
const _list = useRef(null); // TODO: fix react-virtualized types & incapsulate scrollToRow logic
|
||||
const _list = useRef(null); // TODO: fix react-virtualized types & encapsulate scrollToRow logic
|
||||
useEffect(() => {
|
||||
if (_list.current) {
|
||||
// @ts-ignore
|
||||
|
|
@ -132,7 +135,7 @@ function ConsolePanel() {
|
|||
return (
|
||||
// @ts-ignore
|
||||
<CellMeasurer cache={cache} columnIndex={0} key={key} rowIndex={index} parent={parent}>
|
||||
{({ measure }: any) => (
|
||||
{() => (
|
||||
<ConsoleRow
|
||||
style={style}
|
||||
log={item}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ function ConsoleRow(props: Props) {
|
|||
|
||||
const toggleExpand = () => {
|
||||
setExpanded(!expanded);
|
||||
setTimeout(() => recalcHeight(), 0);
|
||||
setTimeout(() => recalcHeight?.(), 0);
|
||||
};
|
||||
return (
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { Icon } from 'UI';
|
||||
|
||||
export default function CloseButton({ size, onClick, className = '', style }){
|
||||
export default function CloseButton({ size, onClick, className = '', style }: { size?: number | string; onClick?: () => void; className?: string; style?: React.CSSProperties }){
|
||||
return (
|
||||
<button onClick={ onClick } className={ `${ className } cursor-pointer` } style={ style } >
|
||||
<Icon name="close" size={ size } color="gray-medium"/>
|
||||
Loading…
Add table
Reference in a new issue