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 =
| {mode: 'default'}
| {mode: 'frameworkEventsTable'; treeRootId: Id};
| {mode: 'frameworkEventsTable'; nodeId: Id};
export type NodeSelection = {
id: Id;

View File

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

View File

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

View File

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

View File

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