Show save as dialog for export data

Summary: This diff adds support to specify custom location to save the flipper data to be exported

Reviewed By: passy

Differential Revision: D13916944

fbshipit-source-id: cfe816d07eb505d99c00f7798f3a97a2093ab265
This commit is contained in:
Pritesh Nandgaonkar
2019-02-05 09:26:43 -08:00
committed by Facebook Github Bot
parent 9bc54597cf
commit d70e512889
2 changed files with 17 additions and 12 deletions

View File

@@ -12,6 +12,8 @@ import electron from 'electron';
import {GK} from 'flipper';
import {remote} from 'electron';
const {dialog} = remote;
import os from 'os';
import path from 'path';
export type DefaultKeyboardAction = 'clear' | 'goToBottom' | 'createPaste';
export type TopLevelMenu = 'Edit' | 'View' | 'Window' | 'Help';
@@ -320,7 +322,16 @@ function getTemplate(
label: 'Export Data...',
role: 'export',
click: function(item: Object, focusedWindow: Object) {
exportStoreToFile(store);
dialog.showSaveDialog(
null,
{
title: 'FlipperExport',
defaultPath: path.join(os.homedir(), 'FlipperExport.json'),
},
file => {
exportStoreToFile(file, store);
},
);
},
},
{