Handle the case of Logs not being present
Summary: - handles the case when log is not present - solved the cpu plugin error - now `fileversion` is the flipper version Reviewed By: jknoxville, danielbuechele Differential Revision: D14065882 fbshipit-source-id: f88414bbb3d766f8ab6e0ec00943b59738918a0e
This commit is contained in:
committed by
Facebook Github Bot
parent
a41d8eb4f8
commit
9a8e30681b
@@ -18,9 +18,10 @@ import {default as Client} from '../Client';
|
|||||||
import {getInstance} from '../fb-stubs/Logger.js';
|
import {getInstance} from '../fb-stubs/Logger.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import uuid from 'uuid';
|
import uuid from 'uuid';
|
||||||
|
import {remote} from 'electron';
|
||||||
|
|
||||||
export type ExportType = {|
|
export type ExportType = {|
|
||||||
fileVersion: '1.0.0',
|
fileVersion: string,
|
||||||
clients: Array<ClientExport>,
|
clients: Array<ClientExport>,
|
||||||
device: ?DeviceExport,
|
device: ?DeviceExport,
|
||||||
store: {
|
store: {
|
||||||
@@ -126,7 +127,7 @@ const addSaltToDeviceSerial = (
|
|||||||
return {...notif, client: notif.client.replace(serial, newSerial)};
|
return {...notif, client: notif.client.replace(serial, newSerial)};
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
fileVersion: '1.0.0',
|
fileVersion: remote.app.getVersion(),
|
||||||
clients: updatedClients,
|
clients: updatedClients,
|
||||||
device: newDevice.toJSON(),
|
device: newDevice.toJSON(),
|
||||||
store: {
|
store: {
|
||||||
@@ -216,11 +217,13 @@ export const importFileToStore = (file: string, store: Store) => {
|
|||||||
}
|
}
|
||||||
const json = JSON.parse(data);
|
const json = JSON.parse(data);
|
||||||
const {device, clients} = json;
|
const {device, clients} = json;
|
||||||
const updatedLogs = device.logs.map(log => {
|
const {serial, deviceType, title, os, logs} = device;
|
||||||
// During the export, Date is exported as string
|
const updatedLogs = logs
|
||||||
return {...log, date: new Date(log.date)};
|
? logs.map(log => {
|
||||||
});
|
// During the export, Date is exported as string
|
||||||
const {serial, deviceType, title, os} = device;
|
return {...log, date: new Date(log.date)};
|
||||||
|
})
|
||||||
|
: [];
|
||||||
const archivedDevice = new ArchivedDevice(
|
const archivedDevice = new ArchivedDevice(
|
||||||
serial,
|
serial,
|
||||||
deviceType,
|
deviceType,
|
||||||
|
|||||||
Reference in New Issue
Block a user