From 6a9d06a4ce80efb07219c4d1c1dbbac90f6ad093 Mon Sep 17 00:00:00 2001 From: bizzguy Date: Mon, 1 Feb 2021 03:56:37 -0800 Subject: [PATCH] Misc UI fixes (#1873) Summary: Continue with cleanup of Network plugin mock screens. This mostly consists of replacing FlexColumn, FlexRow and FlexBox with equivalent Sandy components. Here is the new screen: - replace text buttons with Button - add NUX info to "Copy Highlighted Calls" button - add message when no calls have been highlighted - in routes list remove padding on line items ![image](https://user-images.githubusercontent.com/337874/106415468-d58f6480-6414-11eb-93a8-498fd81b54d9.png) Here is the prior screen: ![image](https://user-images.githubusercontent.com/337874/106415499-e8099e00-6414-11eb-8e0e-48875a945621.png) ## Changelog Network Plugin - Additional cleanup of UI on mock screen Pull Request resolved: https://github.com/facebook/flipper/pull/1873 Test Plan: Create and modify mocks Verify that the functionality has not been affected by UI changes Reviewed By: passy Differential Revision: D26172915 Pulled By: mweststrate fbshipit-source-id: f0af143d8509b53585076737832657fb095e75a6 --- .../network/ManageMockResponsePanel.tsx | 87 +++++++++---------- .../plugins/network/MockResponseDetails.tsx | 56 +++++------- 2 files changed, 62 insertions(+), 81 deletions(-) diff --git a/desktop/plugins/network/ManageMockResponsePanel.tsx b/desktop/plugins/network/ManageMockResponsePanel.tsx index 5f3d902de..564173588 100644 --- a/desktop/plugins/network/ManageMockResponsePanel.tsx +++ b/desktop/plugins/network/ManageMockResponsePanel.tsx @@ -8,11 +8,9 @@ */ import { - Layout, + Button, ManagedTable, Text, - FlexBox, - FlexRow, Glyph, styled, colors, @@ -26,6 +24,9 @@ import {MockResponseDetails} from './MockResponseDetails'; import {NetworkRouteContext} from './index'; import {RequestId} from './types'; +import {message} from 'antd'; +import {NUX, Layout} from 'flipper-plugin'; + type Props = { routes: {[id: string]: Route}; highlightedRows: Set | null | undefined; @@ -37,16 +38,6 @@ const ColumnSizes = {route: 'flex'}; const Columns = {route: {value: 'Route', resizable: false}}; -const Button = styled(FlexBox)({ - color: colors.blackAlpha50, - alignItems: 'center', - padding: 5, - flexShrink: 0, - whiteSpace: 'nowrap', - overflow: 'hidden', - textOverflow: 'ellipsis', -}); - const TextEllipsis = styled(Text)({ overflowX: 'hidden', textOverflow: 'ellipsis', @@ -110,11 +101,11 @@ function RouteRow(props: { handleRemoveId: () => void; }) { return ( - - + + - - + + {props.showWarning && ( )} @@ -125,8 +116,8 @@ function RouteRow(props: { ) : ( {props.text} )} - - + + ); } @@ -173,35 +164,37 @@ export function ManageMockResponsePanel(props: Props) { - - + + + + + + { const newHeaders = produce( route.responseHeaders, @@ -223,7 +212,7 @@ function _buildMockResponseHeaderRows( }); }}> - + ), }, }, @@ -317,26 +306,25 @@ export function MockResponseDetails({id, route, isDuplicated}: Props) { - { - const newHeaders = { - ...route.responseHeaders, - [nextHeaderId.toString()]: {key: '', value: ''}, - }; - setNextHeaderId(nextHeaderId + 1); - networkRouteManager.modifyRoute(id, { - responseHeaders: newHeaders, - }); - }}> - -  Add Header - - + + + +