Add sidebar to visualise entry details
Summary: Follow-up from previous diff. Details can be visualised. Reviewed By: antonk52 Differential Revision: D47797513 fbshipit-source-id: 9a560e3c7da1c9ceffd421ac2670559fdb255204
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8fc56925a9
commit
9a2ff5d88d
@@ -12,12 +12,14 @@ import React, {createRef, CSSProperties, useState} from 'react';
|
|||||||
import {
|
import {
|
||||||
createDataSource,
|
createDataSource,
|
||||||
DataFormatter,
|
DataFormatter,
|
||||||
|
DataInspector,
|
||||||
DataTable,
|
DataTable,
|
||||||
DataTableColumn,
|
DataTableColumn,
|
||||||
DataTableManager,
|
DataTableManager,
|
||||||
Tab,
|
Tab,
|
||||||
Tabs,
|
Tabs,
|
||||||
theme,
|
theme,
|
||||||
|
styled,
|
||||||
} from 'flipper-plugin';
|
} from 'flipper-plugin';
|
||||||
import {CloseCircleFilled, DeleteOutlined} from '@ant-design/icons';
|
import {CloseCircleFilled, DeleteOutlined} from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
@@ -131,13 +133,40 @@ function getRowStyle(entry: ConnectionRecordEntry): CSSProperties | undefined {
|
|||||||
return (logTypes[entry.type]?.style as any) ?? baseRowStyle;
|
return (logTypes[entry.type]?.style as any) ?? baseRowStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Placeholder = styled(Layout.Container)({
|
||||||
|
center: true,
|
||||||
|
color: theme.textColorPlaceholder,
|
||||||
|
fontSize: 18,
|
||||||
|
});
|
||||||
|
|
||||||
|
function Sidebar({selection}: {selection: undefined | ConnectionRecordEntry}) {
|
||||||
|
const renderExtra = (extra: any) => (
|
||||||
|
<>
|
||||||
|
<p>Details</p>
|
||||||
|
<DataInspector data={extra} expandRoot />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Layout.ScrollContainer pad>
|
||||||
|
{selection != null ? (
|
||||||
|
renderExtra(selection)
|
||||||
|
) : (
|
||||||
|
<Placeholder grow pad="large">
|
||||||
|
Select an entry to visualize details
|
||||||
|
</Placeholder>
|
||||||
|
)}
|
||||||
|
</Layout.ScrollContainer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function clearMessages() {
|
function clearMessages() {
|
||||||
rows.clear();
|
rows.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ConnectivityHub() {
|
export function ConnectivityHub() {
|
||||||
const columns = createColumnConfig();
|
const columns = createColumnConfig();
|
||||||
const [_selection, setSelection] = useState<
|
const [selection, setSelection] = useState<
|
||||||
ConnectionRecordEntry | undefined
|
ConnectionRecordEntry | undefined
|
||||||
>();
|
>();
|
||||||
const tableManagerRef = createRef<
|
const tableManagerRef = createRef<
|
||||||
@@ -155,19 +184,22 @@ export function ConnectivityHub() {
|
|||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
|
||||||
const LogView = () => (
|
const LogView = () => {
|
||||||
<DataTable<ConnectionRecordEntry>
|
return (
|
||||||
dataSource={rows}
|
<Layout.Right resizable width={400}>
|
||||||
columns={columns}
|
<DataTable<ConnectionRecordEntry>
|
||||||
enableAutoScroll
|
dataSource={rows}
|
||||||
enableMultiPanels
|
columns={columns}
|
||||||
onSelect={setSelection}
|
enableAutoScroll
|
||||||
onRowStyle={getRowStyle}
|
onRowStyle={getRowStyle}
|
||||||
enableHorizontalScroll={false}
|
onSelect={setSelection}
|
||||||
tableManagerRef={tableManagerRef}
|
tableManagerRef={tableManagerRef}
|
||||||
extraActions={clearButton}
|
extraActions={clearButton}
|
||||||
/>
|
/>
|
||||||
);
|
<Sidebar selection={selection} />
|
||||||
|
</Layout.Right>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout.Container grow>
|
<Layout.Container grow>
|
||||||
|
|||||||
Reference in New Issue
Block a user