diff --git a/desktop/flipper-ui/src/chrome/ShareSheetExportUrl.tsx b/desktop/flipper-ui/src/chrome/ShareSheetExportUrl.tsx deleted file mode 100644 index a2a60ccfbac..00000000000 --- a/desktop/flipper-ui/src/chrome/ShareSheetExportUrl.tsx +++ /dev/null @@ -1,224 +0,0 @@ -/** - * 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 {FlexColumn, styled, Text, FlexRow, Spacer, Input} from '../ui'; -import React, {Component} from 'react'; -import {ReactReduxContext, ReactReduxContextValue} from 'react-redux'; -import {Logger} from 'flipper-common'; -import {IdlerImpl} from '../utils/Idler'; -import { - DataExportResult, - DataExportError, - shareFlipperData, -} from '../fb-stubs/user'; -import { - exportStore, - EXPORT_FLIPPER_TRACE_EVENT, - displayFetchMetadataErrors, -} from '../utils/exportData'; -import ShareSheetErrorList from './ShareSheetErrorList'; -import {reportPlatformFailures} from 'flipper-common'; -import ShareSheetPendingDialog from './ShareSheetPendingDialog'; -import {getLogger} from 'flipper-common'; -import {MiddlewareAPI} from '../reducers/index'; -import {getFlipperLib, Layout} from 'flipper-plugin'; -import {Button, Modal} from 'antd'; - -export const SHARE_FLIPPER_TRACE_EVENT = 'share-flipper-link'; - -const Copy = styled(Input)({ - marginRight: 0, - marginBottom: 15, -}); - -const InfoText = styled(Text)({ - lineHeight: 1.35, - marginBottom: 15, -}); - -const Title = styled(Text)({ - marginBottom: 6, -}); - -const ErrorMessage = styled(Text)({ - display: 'block', - marginTop: 6, - wordBreak: 'break-all', - whiteSpace: 'pre-line', - lineHeight: 1.35, -}); - -type Props = { - onHide: () => any; - logger: Logger; -}; - -type State = { - fetchMetaDataErrors: { - [plugin: string]: Error; - } | null; - result: DataExportError | DataExportResult | null; - statusUpdate: string | null; -}; - -export default class ShareSheetExportUrl extends Component { - static contextType: React.Context = ReactReduxContext; - - state: State = { - fetchMetaDataErrors: null, - result: null, - statusUpdate: null, - }; - - get store(): MiddlewareAPI { - return this.context.store; - } - - idler = new IdlerImpl(); - - async componentDidMount() { - const mark = 'shareSheetExportUrl'; - performance.mark(mark); - try { - const statusUpdate = (msg: string) => { - this.setState({statusUpdate: msg}); - }; - const {serializedString, fetchMetaDataErrors} = - await reportPlatformFailures( - exportStore(this.store, false, this.idler, statusUpdate), - `${EXPORT_FLIPPER_TRACE_EVENT}:UI_LINK`, - ); - const uploadMarker = `${EXPORT_FLIPPER_TRACE_EVENT}:upload`; - performance.mark(uploadMarker); - statusUpdate('Uploading Flipper Export...'); - const result = await reportPlatformFailures( - shareFlipperData(serializedString), - `${SHARE_FLIPPER_TRACE_EVENT}`, - ); - - if ((result as DataExportError).error != undefined) { - const res = result as DataExportError; - const err = new Error(res.error); - err.stack = res.stacktrace; - throw err; - } - getLogger().trackTimeSince(uploadMarker, uploadMarker, { - plugins: this.store.getState().plugins.selectedPlugins, - }); - const flipperUrl = (result as DataExportResult).flipperUrl; - if (flipperUrl) { - getFlipperLib().writeTextToClipboard(String(flipperUrl)); - new Notification('Shareable Flipper Export created', { - body: 'URL copied to clipboard', - requireInteraction: true, - }); - } - this.setState({fetchMetaDataErrors, result}); - this.props.logger.trackTimeSince(mark, 'export:url-success'); - } catch (e) { - const result: DataExportError = { - error_class: 'EXPORT_ERROR', - error: e, - stacktrace: '', - }; - if (e instanceof Error) { - result.error = e.message; - result.stacktrace = e.stack || ''; - } - // Show the error in UI. - this.setState({result}); - this.props.logger.trackTimeSince(mark, 'export:url-error', result); - console.error('Failed to export to flipper trace', e); - } - } - - componentDidUpdate() { - const {result} = this.state; - if (!result || !(result as DataExportResult).flipperUrl) { - return; - } - } - - cancelAndHide = () => { - this.props.onHide(); - this.idler.cancel(); - }; - - renderPending(statusUpdate: string | null) { - return ( - - - - ); - } - - render() { - const {result, statusUpdate, fetchMetaDataErrors} = this.state; - if (!result) { - return this.renderPending(statusUpdate); - } - - const {title, errorArray} = displayFetchMetadataErrors(fetchMetaDataErrors); - return ( - - - <> - - {(result as DataExportResult).flipperUrl ? ( - <> - Data Upload Successful - - Flipper's data was successfully uploaded. This URL can be - used to share with other Flipper users. Opening it will - import the data from your export. - - - - When sharing your Flipper link, consider that the captured - data might contain sensitve information like access tokens - used in network requests. - - - - ) : ( - <> - - {(result as DataExportError).error_class || 'Error'} - - - {(result as DataExportError).error || - 'The data could not be uploaded'} - - - )} - - - - - - - - - ); - } -} diff --git a/desktop/flipper-ui/src/fb-stubs/constants.tsx b/desktop/flipper-ui/src/fb-stubs/constants.tsx index 501d88ea1d5..da1e3b8571e 100644 --- a/desktop/flipper-ui/src/fb-stubs/constants.tsx +++ b/desktop/flipper-ui/src/fb-stubs/constants.tsx @@ -12,9 +12,6 @@ import {DeviceOS} from 'flipper-plugin'; export default Object.freeze({ IS_PUBLIC_BUILD: true, - // Enables the flipper data to be exported through shareabale link - ENABLE_SHAREABLE_LINK: false, - FEEDBACK_GROUP_LINK: 'https://github.com/facebook/flipper/issues', // Workplace Group ID's diff --git a/desktop/flipper-ui/src/sandy-chrome/Navbar.tsx b/desktop/flipper-ui/src/sandy-chrome/Navbar.tsx index 52326841af5..90125e0576b 100644 --- a/desktop/flipper-ui/src/sandy-chrome/Navbar.tsx +++ b/desktop/flipper-ui/src/sandy-chrome/Navbar.tsx @@ -53,11 +53,9 @@ import { ExportEverythingEverywhereAllAtOnceStatus, startFileImport, startFileExport, - startLinkExport, } from '../utils/exportData'; import UpdateIndicator from '../chrome/UpdateIndicator'; import {css} from '@emotion/css'; -import constants from '../fb-stubs/constants'; import {setStaticView} from '../reducers/connections'; import {StyleGuide} from './StyleGuide'; import {openDeeplinkDialog} from '../deeplink'; @@ -638,11 +636,6 @@ function ExtrasMenu() { () => startFileExport(store.dispatch), [store.dispatch], ); - const startLinkExportTracked = useTrackedCallback( - 'Link export', - () => startLinkExport(store.dispatch), - [store.dispatch], - ); const startFileImportTracked = useTrackedCallback( 'File import', () => startFileImport(store), @@ -679,15 +672,6 @@ function ExtrasMenu() { label: 'Export Flipper file', onClick: startFileExportTracked, }, - ...(constants.ENABLE_SHAREABLE_LINK - ? [ - { - key: 'exportShareableLink', - label: 'Export shareable link', - onClick: startLinkExportTracked, - }, - ] - : []), { type: 'divider', }, diff --git a/desktop/flipper-ui/src/utils/exportData.tsx b/desktop/flipper-ui/src/utils/exportData.tsx index 4f5d24c0816..4ae11306bc4 100644 --- a/desktop/flipper-ui/src/utils/exportData.tsx +++ b/desktop/flipper-ui/src/utils/exportData.tsx @@ -28,7 +28,6 @@ import {processMessageQueue} from './messageQueue'; import {getPluginTitle} from './pluginUtils'; import {Dialog, getFlipperLib, Idler} from 'flipper-plugin'; import {ClientQuery} from 'flipper-common'; -import ShareSheetExportUrl from '../chrome/ShareSheetExportUrl'; import ShareSheetExportFile from '../chrome/ShareSheetExportFile'; import ExportDataPluginSheet from '../chrome/ExportDataPluginSheet'; import {exportLogs} from '../chrome/ConsoleLogs'; @@ -456,7 +455,7 @@ async function getStoreExport( export async function exportStore( store: MiddlewareAPI, - includeSupportDetails?: boolean, + _includeSupportDetails?: boolean, idler: Idler = new TestIdler(true), statusUpdate: (msg: string) => void = () => {}, ): Promise<{ @@ -755,19 +754,6 @@ export async function startFileExport(dispatch: Store['dispatch']) { )); } -export async function startLinkExport(dispatch: Store['dispatch']) { - const plugins = await selectPlugins(); - if (plugins === false) { - return; // cancelled - } - // TODO: no need to put this in the store, - // need to be cleaned up later in combination with SupportForm - dispatch(selectedPlugins(plugins)); - Dialog.showModal((onHide) => ( - - )); -} - async function selectPlugins() { return await Dialog.select({ title: 'Select plugins to export',