Open source Import/Export feature to open source
Summary: Exposes Import/Export feature to open source. This diff also makes sure that, "Shareable Link" option doesn't show up, as it is specific to fb's infrastructure. Reviewed By: passy Differential Revision: D14526634 fbshipit-source-id: 3aeb97c91bc00a9c5f01c74c34a5690ec3b5739d
This commit is contained in:
committed by
Facebook Github Bot
parent
fd9b581162
commit
5964f1621e
@@ -14,7 +14,7 @@ import {
|
|||||||
import {setActiveSheet, ACTIVE_SHEET_SHARE_DATA} from './reducers/application';
|
import {setActiveSheet, ACTIVE_SHEET_SHARE_DATA} from './reducers/application';
|
||||||
import type {Store} from './reducers/';
|
import type {Store} from './reducers/';
|
||||||
import electron from 'electron';
|
import electron from 'electron';
|
||||||
import {GK} from 'flipper';
|
import {ENABLE_SHAREABLE_LINK} from 'flipper';
|
||||||
import {remote} from 'electron';
|
import {remote} from 'electron';
|
||||||
const {dialog} = remote;
|
const {dialog} = remote;
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
@@ -188,7 +188,54 @@ function getTemplate(
|
|||||||
shell: Object,
|
shell: Object,
|
||||||
store: Store,
|
store: Store,
|
||||||
): Array<MenuItem> {
|
): Array<MenuItem> {
|
||||||
|
const exportSubmenu = [
|
||||||
|
{
|
||||||
|
label: 'File...',
|
||||||
|
accelerator: 'CommandOrControl+E',
|
||||||
|
click: function(item: Object, focusedWindow: Object) {
|
||||||
|
dialog.showSaveDialog(
|
||||||
|
null,
|
||||||
|
{
|
||||||
|
title: 'FlipperExport',
|
||||||
|
defaultPath: path.join(os.homedir(), 'FlipperExport.flipper'),
|
||||||
|
},
|
||||||
|
file => {
|
||||||
|
reportPlatformFailures(
|
||||||
|
exportStoreToFile(file, store),
|
||||||
|
`${EXPORT_FLIPPER_TRACE_EVENT}:UI`,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
if (ENABLE_SHAREABLE_LINK) {
|
||||||
|
exportSubmenu.push({
|
||||||
|
label: 'Sharable Link',
|
||||||
|
accelerator: 'CommandOrControl+Shift+E',
|
||||||
|
click: async function(item: Object, focusedWindow: Object) {
|
||||||
|
store.dispatch(setActiveSheet(ACTIVE_SHEET_SHARE_DATA));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const template = [
|
const template = [
|
||||||
|
{
|
||||||
|
label: 'File',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Open File...',
|
||||||
|
accelerator: 'CommandOrControl+O',
|
||||||
|
click: function(item: Object, focusedWindow: Object) {
|
||||||
|
showOpenDialog(store);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Export',
|
||||||
|
submenu: exportSubmenu,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Edit',
|
label: 'Edit',
|
||||||
submenu: [
|
submenu: [
|
||||||
@@ -317,54 +364,7 @@ function getTemplate(
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
if (GK.get('flipper_import_export')) {
|
|
||||||
template.unshift({
|
|
||||||
label: 'File',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: 'Open File...',
|
|
||||||
accelerator: 'CommandOrControl+O',
|
|
||||||
click: function(item: Object, focusedWindow: Object) {
|
|
||||||
showOpenDialog(store);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Export',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: 'File...',
|
|
||||||
accelerator: 'CommandOrControl+E',
|
|
||||||
click: function(item: Object, focusedWindow: Object) {
|
|
||||||
dialog.showSaveDialog(
|
|
||||||
null,
|
|
||||||
{
|
|
||||||
title: 'FlipperExport',
|
|
||||||
defaultPath: path.join(
|
|
||||||
os.homedir(),
|
|
||||||
'FlipperExport.flipper',
|
|
||||||
),
|
|
||||||
},
|
|
||||||
file => {
|
|
||||||
reportPlatformFailures(
|
|
||||||
exportStoreToFile(file, store),
|
|
||||||
`${EXPORT_FLIPPER_TRACE_EVENT}:UI`,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Sharable Link',
|
|
||||||
accelerator: 'CommandOrControl+Shift+E',
|
|
||||||
click: async function(item: Object, focusedWindow: Object) {
|
|
||||||
store.dispatch(setActiveSheet(ACTIVE_SHEET_SHARE_DATA));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
const name = app.getName();
|
const name = app.getName();
|
||||||
template.unshift({
|
template.unshift({
|
||||||
|
|||||||
@@ -17,3 +17,6 @@ export const GRAPH_SECRET_ACCESS_TOKEN = '';
|
|||||||
// Provides access to Insights Validation ednpoint on interngraph
|
// Provides access to Insights Validation ednpoint on interngraph
|
||||||
export const INSIGHT_INTERN_APP_ID = '';
|
export const INSIGHT_INTERN_APP_ID = '';
|
||||||
export const INSIGHT_INTERN_APP_TOKEN = '';
|
export const INSIGHT_INTERN_APP_TOKEN = '';
|
||||||
|
|
||||||
|
// Enables the flipper data to be exported through shareabale link
|
||||||
|
export const ENABLE_SHAREABLE_LINK = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user