Show offline devices in dropdown

Summary:
This diff aims to make the selected device a little clearer, the button now shows different icons depending on the selected devices: physical, emulators and archived devices.

The dropdown now is grouped in these sections, depending on their availability:
- Connected Devices
- Running Emulators
- Imported Devices
- Launch Android emulators
- Open File...

"Open File..." allows to import a file the same way as File -> Open File...

Reviewed By: jknoxville

Differential Revision: D14460789

fbshipit-source-id: 8d6edff0d90d5e02e4ef5976af5680ab8eaf77b4
This commit is contained in:
Daniel Büchele
2019-03-15 11:27:30 -07:00
committed by Facebook Github Bot
parent 51139500f4
commit f30ff068a7
4 changed files with 108 additions and 54 deletions

View File

@@ -8,8 +8,7 @@
import type {FlipperPlugin, FlipperDevicePlugin} from './plugin.js';
import {
exportStoreToFile,
importFileToStore,
IMPORT_FLIPPER_TRACE_EVENT,
showOpenDialog,
EXPORT_FLIPPER_TRACE_EVENT,
} from './utils/exportData.js';
import {setActiveSheet, ACTIVE_SHEET_SHARE_DATA} from './reducers/application';
@@ -20,10 +19,7 @@ import {remote} from 'electron';
const {dialog} = remote;
import os from 'os';
import path from 'path';
import {
reportPlatformFailures,
tryCatchReportPlatformFailures,
} from './utils/metrics';
import {reportPlatformFailures} from './utils/metrics';
export type DefaultKeyboardAction = 'clear' | 'goToBottom' | 'createPaste';
export type TopLevelMenu = 'Edit' | 'View' | 'Window' | 'Help';
@@ -329,18 +325,7 @@ function getTemplate(
label: 'Open File...',
accelerator: 'CommandOrControl+O',
click: function(item: Object, focusedWindow: Object) {
dialog.showOpenDialog(
{
properties: ['openFile'],
},
(files: Array<string>) => {
if (files !== undefined && files.length > 0) {
tryCatchReportPlatformFailures(() => {
importFileToStore(files[0], store);
}, `${IMPORT_FLIPPER_TRACE_EVENT}:UI`);
}
},
);
showOpenDialog(store);
},
},
{