Clear connectivity logs button
Summary: Add the option to clear the connectivity logs. Reviewed By: antonk52 Differential Revision: D47797301 fbshipit-source-id: ce9414f3057cab367d34524717c83bfbf0703c0c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fa1c2db026
commit
c3a40ab0ab
@@ -19,7 +19,7 @@ import {
|
|||||||
Tabs,
|
Tabs,
|
||||||
theme,
|
theme,
|
||||||
} from 'flipper-plugin';
|
} from 'flipper-plugin';
|
||||||
import {CloseCircleFilled} from '@ant-design/icons';
|
import {CloseCircleFilled, DeleteOutlined} from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
CommandRecordEntry,
|
CommandRecordEntry,
|
||||||
ConnectionRecordEntry,
|
ConnectionRecordEntry,
|
||||||
@@ -28,6 +28,7 @@ import {
|
|||||||
import SetupDoctorScreen from '../sandy-chrome/SetupDoctorScreen';
|
import SetupDoctorScreen from '../sandy-chrome/SetupDoctorScreen';
|
||||||
import {ConsoleLogs} from './ConsoleLogs';
|
import {ConsoleLogs} from './ConsoleLogs';
|
||||||
import {FlipperMessages} from './FlipperMessages';
|
import {FlipperMessages} from './FlipperMessages';
|
||||||
|
import {Button} from 'antd';
|
||||||
|
|
||||||
const rows = createDataSource<ConnectionRecordEntry>([], {
|
const rows = createDataSource<ConnectionRecordEntry>([], {
|
||||||
limit: 200000,
|
limit: 200000,
|
||||||
@@ -130,6 +131,10 @@ function getRowStyle(entry: ConnectionRecordEntry): CSSProperties | undefined {
|
|||||||
return (logTypes[entry.type]?.style as any) ?? baseRowStyle;
|
return (logTypes[entry.type]?.style as any) ?? baseRowStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearMessages() {
|
||||||
|
rows.clear();
|
||||||
|
}
|
||||||
|
|
||||||
export function ConnectivityHub() {
|
export function ConnectivityHub() {
|
||||||
const columns = createColumnConfig();
|
const columns = createColumnConfig();
|
||||||
|
|
||||||
@@ -137,6 +142,16 @@ export function ConnectivityHub() {
|
|||||||
undefined | DataTableManager<ConnectionRecordEntry>
|
undefined | DataTableManager<ConnectionRecordEntry>
|
||||||
>();
|
>();
|
||||||
|
|
||||||
|
const clearButton = (
|
||||||
|
<Button
|
||||||
|
title="Clear logs"
|
||||||
|
onClick={() => {
|
||||||
|
clearMessages();
|
||||||
|
}}>
|
||||||
|
<DeleteOutlined />
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
|
||||||
const LogView = () => (
|
const LogView = () => (
|
||||||
<DataTable<ConnectionRecordEntry>
|
<DataTable<ConnectionRecordEntry>
|
||||||
dataSource={rows}
|
dataSource={rows}
|
||||||
@@ -146,6 +161,7 @@ export function ConnectivityHub() {
|
|||||||
onRowStyle={getRowStyle}
|
onRowStyle={getRowStyle}
|
||||||
enableHorizontalScroll={false}
|
enableHorizontalScroll={false}
|
||||||
tableManagerRef={tableManagerRef}
|
tableManagerRef={tableManagerRef}
|
||||||
|
extraActions={clearButton}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user