Export Flipper state as a part of the universal export
Summary: Design doc: https://docs.google.com/document/d/1HLCFl46RfqG0o1mSt8SWrwf_HMfOCRg_oENioc1rkvQ/edit# Create Flipper export as a part on the universal export Reviewed By: passy Differential Revision: D40468242 fbshipit-source-id: b1b8e4df3b630c6163bb383482123c12dfc6e118
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0e5af8095f
commit
ef0d9fb77e
@@ -59,6 +59,7 @@ import constants from '../fb-stubs/constants';
|
||||
import {
|
||||
canFileExport,
|
||||
canOpenDialog,
|
||||
exportEverythingEverywhereAllAtOnce,
|
||||
showOpenDialog,
|
||||
startFileExport,
|
||||
startLinkExport,
|
||||
@@ -433,10 +434,12 @@ function DebugLogsButton({
|
||||
}
|
||||
|
||||
function ExportEverythingEverywhereAllAtOnceButton() {
|
||||
const startLogsExportTracked = useTrackedCallback(
|
||||
const store = useStore();
|
||||
|
||||
const exportEverythingEverywhereAllAtOnceTracked = useTrackedCallback(
|
||||
'Debug data export',
|
||||
startLogsExport,
|
||||
[],
|
||||
() => exportEverythingEverywhereAllAtOnce(store),
|
||||
[store],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -444,7 +447,7 @@ function ExportEverythingEverywhereAllAtOnceButton() {
|
||||
icon={<BugOutlined />}
|
||||
title="Export Flipper debug data"
|
||||
onClick={() => {
|
||||
startLogsExportTracked();
|
||||
exportEverythingEverywhereAllAtOnceTracked();
|
||||
}}
|
||||
small
|
||||
/>
|
||||
|
||||
@@ -612,6 +612,31 @@ export async function startLogsExport() {
|
||||
await getRenderHostInstance().exportFile?.(serializedLogs);
|
||||
}
|
||||
|
||||
export async function exportEverythingEverywhereAllAtOnce(
|
||||
store: MiddlewareAPI,
|
||||
) {
|
||||
// TODO: Show a progress dialog
|
||||
// TODO: Pack all files in a single archive
|
||||
|
||||
// Step 1: Export Flipper logs
|
||||
await startLogsExport();
|
||||
|
||||
// Step 2: Export device logs
|
||||
// TODO: Implement me
|
||||
|
||||
// Step 3: Export Flipper State
|
||||
// TODO: Export all plugins automatically
|
||||
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
|
||||
store.dispatch(selectedPlugins(plugins));
|
||||
const {serializedString} = await exportStore(store);
|
||||
await getRenderHostInstance().exportFile?.(serializedString);
|
||||
}
|
||||
|
||||
export async function startFileExport(dispatch: Store['dispatch']) {
|
||||
const file = await getRenderHostInstance().showSaveDialog?.({
|
||||
title: 'FlipperExport',
|
||||
|
||||
Reference in New Issue
Block a user