From 9a2ff5d88d979c5e00baf4d220cdc98c8e33c553 Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Wed, 26 Jul 2023 09:17:28 -0700 Subject: [PATCH] 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 --- .../src/chrome/ConnectivityHub.tsx | 60 ++++++++++++++----- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/desktop/flipper-ui-core/src/chrome/ConnectivityHub.tsx b/desktop/flipper-ui-core/src/chrome/ConnectivityHub.tsx index 9472b6d3743..c17a990b4e4 100644 --- a/desktop/flipper-ui-core/src/chrome/ConnectivityHub.tsx +++ b/desktop/flipper-ui-core/src/chrome/ConnectivityHub.tsx @@ -12,12 +12,14 @@ import React, {createRef, CSSProperties, useState} from 'react'; import { createDataSource, DataFormatter, + DataInspector, DataTable, DataTableColumn, DataTableManager, Tab, Tabs, theme, + styled, } from 'flipper-plugin'; import {CloseCircleFilled, DeleteOutlined} from '@ant-design/icons'; import { @@ -131,13 +133,40 @@ function getRowStyle(entry: ConnectionRecordEntry): CSSProperties | undefined { 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) => ( + <> +

Details

+ + + ); + + return ( + + {selection != null ? ( + renderExtra(selection) + ) : ( + + Select an entry to visualize details + + )} + + ); +} + function clearMessages() { rows.clear(); } export function ConnectivityHub() { const columns = createColumnConfig(); - const [_selection, setSelection] = useState< + const [selection, setSelection] = useState< ConnectionRecordEntry | undefined >(); const tableManagerRef = createRef< @@ -155,19 +184,22 @@ export function ConnectivityHub() { ); - const LogView = () => ( - - dataSource={rows} - columns={columns} - enableAutoScroll - enableMultiPanels - onSelect={setSelection} - onRowStyle={getRowStyle} - enableHorizontalScroll={false} - tableManagerRef={tableManagerRef} - extraActions={clearButton} - /> - ); + const LogView = () => { + return ( + + + dataSource={rows} + columns={columns} + enableAutoScroll + onRowStyle={getRowStyle} + onSelect={setSelection} + tableManagerRef={tableManagerRef} + extraActions={clearButton} + /> + + + ); + }; return (