Make it possible to export support form V2 with meta data

Summary:
This diff enables a full roundtrip of exporting a bug report to file / link, and importing it again.

Styling is not part of this story.

Reviewed By: jknoxville

Differential Revision: D18636418

fbshipit-source-id: ef9a8e3622bdac9361f612d51415a593f4268b80
This commit is contained in:
Michel Weststrate
2019-11-21 08:00:25 -08:00
committed by Facebook Github Bot
parent f33666a4b9
commit dd65ec6ed0
7 changed files with 77 additions and 55 deletions

View File

@@ -8,9 +8,12 @@
*/
import {FlipperPlugin, FlipperDevicePlugin} from './plugin';
import {showOpenDialog} from './utils/exportData';
import {
setSelectPluginsToExportActiveSheet,
showOpenDialog,
startFileExport,
startLinkExport,
} from './utils/exportData';
import {
setActiveSheet,
ACTIVE_SHEET_PLUGINS,
ACTIVE_SHEET_SETTINGS,
@@ -21,8 +24,6 @@ import {Store} from './reducers/';
import electron, {MenuItemConstructorOptions} from 'electron';
import {notNull} from './utils/typeUtils';
import constants from './fb-stubs/constants';
import os from 'os';
import path from 'path';
import GK from './fb-stubs/GK';
export type DefaultKeyboardAction = 'clear' | 'goToBottom' | 'createPaste';
@@ -186,44 +187,14 @@ function getTemplate(
{
label: 'File...',
accelerator: 'CommandOrControl+E',
click: function() {
electron.remote.dialog
.showSaveDialog(
// @ts-ignore This appears to work but isn't allowed by the types
null,
{
title: 'FlipperExport',
defaultPath: path.join(os.homedir(), 'FlipperExport.flipper'),
},
)
.then(async (result: electron.SaveDialogReturnValue) => {
const file = result.filePath;
if (!file) {
return;
}
store.dispatch(
setSelectPluginsToExportActiveSheet({
type: 'file',
file: file,
closeOnFinish: false,
}),
);
});
},
click: () => startFileExport(store.dispatch),
},
];
if (constants.ENABLE_SHAREABLE_LINK) {
exportSubmenu.push({
label: 'Shareable Link',
accelerator: 'CommandOrControl+Shift+E',
click: function() {
store.dispatch(
setSelectPluginsToExportActiveSheet({
type: 'link',
closeOnFinish: false,
}),
);
},
click: () => startLinkExport(store.dispatch),
});
}
const fileSubmenu: MenuItemConstructorOptions[] = [