Allow exploring all events in table view

Summary: This lets you debug when events go off screen

Reviewed By: lblasa

Differential Revision: D48395787

fbshipit-source-id: 51a6eb74fa0f61c34f25e86a6ee40bf5969379ee
This commit is contained in:
Luke De Feo
2023-08-21 04:24:16 -07:00
committed by Facebook GitHub Bot
parent 1bffe8bc6b
commit 22d1bc2552
5 changed files with 30 additions and 33 deletions

View File

@@ -66,7 +66,7 @@ export type NestedNode = {
export type ViewMode = export type ViewMode =
| {mode: 'default'} | {mode: 'default'}
| {mode: 'frameworkEventsTable'; treeRootId: Id}; | {mode: 'frameworkEventsTable'; nodeId: Id};
export type NodeSelection = { export type NodeSelection = {
id: Id; id: Id;

View File

@@ -20,17 +20,17 @@ import {FrameworkEvent, Id} from '../ClientTypes';
import {plugin} from '../index'; import {plugin} from '../index';
import {Button, Tooltip} from 'antd'; import {Button, Tooltip} from 'antd';
export function FrameworkEventsTable({treeId}: {treeId?: Id}) { export function FrameworkEventsTable({nodeId}: {nodeId: Id}) {
const instance = usePlugin(plugin); const instance = usePlugin(plugin);
const managerRef = useRef<DataTableManager<FrameworkEvent> | null>(null); const managerRef = useRef<DataTableManager<FrameworkEvent> | null>(null);
useEffect(() => { useEffect(() => {
if (treeId != null) { if (nodeId != null) {
managerRef.current?.resetFilters(); managerRef.current?.resetFilters();
managerRef.current?.addColumnFilter('treeId', treeId as string); managerRef.current?.addColumnFilter('nodeId', nodeId as string);
} }
}, [treeId]); }, [nodeId]);
return ( return (
<Layout.Container grow> <Layout.Container grow>

View File

@@ -103,7 +103,7 @@ export function Component() {
} }
if (viewMode.mode === 'frameworkEventsTable') { if (viewMode.mode === 'frameworkEventsTable') {
return <FrameworkEventsTable treeId={viewMode.treeRootId} />; return <FrameworkEventsTable nodeId={viewMode.nodeId} />;
} }
return ( return (

View File

@@ -78,20 +78,18 @@ export const FrameworkEventsInspector: React.FC<Props> = ({
<Typography.Title level={3}>Event timeline</Typography.Title> <Typography.Title level={3}>Event timeline</Typography.Title>
<Layout.Horizontal center gap padh="medium"> <Layout.Horizontal center gap padh="medium">
{node.tags.includes('TreeRoot') && ( <Tooltip title="Explore events in table">
<Tooltip title="Explore all tree events in table">
<Button <Button
shape="circle" shape="circle"
icon={<TableOutlined />} icon={<TableOutlined />}
onClick={() => onClick={() =>
onSetViewMode({ onSetViewMode({
mode: 'frameworkEventsTable', mode: 'frameworkEventsTable',
treeRootId: node.id, nodeId: node.id,
}) })
} }
/> />
</Tooltip> </Tooltip>
)}
<Dropdown <Dropdown
overlayStyle={{minWidth: 200}} overlayStyle={{minWidth: 200}}
overlay={ overlay={

View File

@@ -159,14 +159,13 @@ export const ContextMenu: React.FC<{
frameworkEvents.getAllRecordsByIndex({nodeId: hoveredNode.id})) ?? frameworkEvents.getAllRecordsByIndex({nodeId: hoveredNode.id})) ??
[]; [];
const frameworkEventsTable = hoveredNode?.tags.includes('TreeRoot') && const frameworkEventsTable = matchingFrameworkEvents.length > 0 && (
matchingFrameworkEvents.length > 0 && (
<UIDebuggerMenuItem <UIDebuggerMenuItem
text="Explore events" text="Explore events"
onClick={() => { onClick={() => {
onSetViewMode({ onSetViewMode({
mode: 'frameworkEventsTable', mode: 'frameworkEventsTable',
treeRootId: hoveredNode?.id ?? '', nodeId: hoveredNode?.id ?? '',
}); });
}} }}
icon={<TableOutlined />} icon={<TableOutlined />}