Files
flipper/desktop/plugins/public/ui-debugger/components/FrameworkEventsTable.tsx
Luke De Feo 22d1bc2552 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
2023-08-21 04:24:16 -07:00

75 lines
1.7 KiB
TypeScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {PartitionOutlined} from '@ant-design/icons';
import {
DataTable,
DataTableColumn,
DataTableManager,
Layout,
usePlugin,
} from 'flipper-plugin';
import React, {useEffect, useRef} from 'react';
import {FrameworkEvent, Id} from '../ClientTypes';
import {plugin} from '../index';
import {Button, Tooltip} from 'antd';
export function FrameworkEventsTable({nodeId}: {nodeId: Id}) {
const instance = usePlugin(plugin);
const managerRef = useRef<DataTableManager<FrameworkEvent> | null>(null);
useEffect(() => {
if (nodeId != null) {
managerRef.current?.resetFilters();
managerRef.current?.addColumnFilter('nodeId', nodeId as string);
}
}, [nodeId]);
return (
<Layout.Container grow>
<DataTable<FrameworkEvent>
dataSource={instance.frameworkEvents}
tableManagerRef={managerRef}
columns={columns}
extraActions={
<Tooltip title="Back to tree">
<Button
onClick={() => {
instance.uiActions.onSetViewMode({mode: 'default'});
}}
icon={<PartitionOutlined />}></Button>
</Tooltip>
}
/>
</Layout.Container>
);
}
const columns: DataTableColumn<FrameworkEvent>[] = [
{
key: 'timestamp',
onRender: (row: FrameworkEvent) => {
return new Date(row.timestamp).toLocaleTimeString();
},
},
{
key: 'treeId',
},
{
key: 'nodeId',
},
{
key: 'type',
},
{
key: 'thread',
},
];