Import and export Logs

Summary: This diff adds import and export support for the logs plugin

Reviewed By: danielbuechele

Differential Revision: D13958713

fbshipit-source-id: a072de025f0b959302175ef0ccaf763ca41377e9
This commit is contained in:
Pritesh Nandgaonkar
2019-02-12 02:33:29 -08:00
committed by Facebook Github Bot
parent e5151b9994
commit c28ef62f07
4 changed files with 69 additions and 9 deletions

View File

@@ -93,6 +93,7 @@ const addSaltToDeviceSerial = (
device.deviceType,
device.title,
device.os,
device.getLogs(),
);
const updatedClients = clients.map((client: ClientExport) => {
return {
@@ -215,11 +216,16 @@ export const importFileToStore = (file: string, store: Store) => {
}
const json = JSON.parse(data);
const {device, clients} = json;
const updatedLogs = device.logs.map(log => {
// During the export, Date is exported as string
return {...log, date: new Date(log.date)};
});
const archivedDevice = new ArchivedDevice(
device.serial,
device.deviceType,
device.title,
device.os,
updatedLogs,
);
store.dispatch({
type: 'REGISTER_DEVICE',