Adds capability to select plugins for which the data would be exported
Summary: This diff adds `selectedPlugins` property in the redux store. With this diff now you can pass the list of plugins to headless so that it exports only the selected plugin's data Reviewed By: passy Differential Revision: D16280167 fbshipit-source-id: b03a1c49a7f51547470e0bcfa43083e52efabdd0
This commit is contained in:
committed by
Facebook Github Bot
parent
9d813dce80
commit
e8a8f87086
@@ -39,6 +39,7 @@ type UserArguments = {|
|
||||
listDevices: boolean,
|
||||
device: string,
|
||||
listPlugins: boolean,
|
||||
selectPlugins: Array<string>,
|
||||
|};
|
||||
|
||||
yargs
|
||||
@@ -89,6 +90,12 @@ yargs
|
||||
describe: 'Will print the list of supported plugins in the terminal',
|
||||
type: 'boolean',
|
||||
});
|
||||
yargs.option('select-plugins', {
|
||||
default: [],
|
||||
describe:
|
||||
'The data/metrics would be exported only for the selected plugins',
|
||||
type: 'array',
|
||||
});
|
||||
yargs.option('device', {
|
||||
default: undefined,
|
||||
describe:
|
||||
@@ -327,6 +334,21 @@ async function startFlipper(userArguments: UserArguments) {
|
||||
exit: false,
|
||||
});
|
||||
},
|
||||
(userArguments: UserArguments, store: Store) => {
|
||||
const {selectPlugins} = userArguments;
|
||||
const selectedPlugins = selectPlugins.filter(selectPlugin => {
|
||||
return selectPlugin != undefined;
|
||||
});
|
||||
if (selectedPlugins) {
|
||||
store.dispatch({
|
||||
type: 'SELECTED_PLUGINS',
|
||||
payload: selectedPlugins,
|
||||
});
|
||||
}
|
||||
return Promise.resolve({
|
||||
exit: false,
|
||||
});
|
||||
},
|
||||
];
|
||||
|
||||
const exitActionClosures: Array<
|
||||
@@ -352,6 +374,7 @@ async function startFlipper(userArguments: UserArguments) {
|
||||
return exportMetricsFromTrace(
|
||||
metrics,
|
||||
pluginsClassMap(store.getState().plugins),
|
||||
store.getState().plugins.selectedPlugins,
|
||||
)
|
||||
.then(payload => {
|
||||
return {exit: true, result: payload ? payload.toString() : ''};
|
||||
|
||||
Reference in New Issue
Block a user