Stop storing device logs on the device object and in the plugin

Summary:
Logs were stored hardcoded on the Device object first, this diff makes it normal plugin state.

This makes sure that we can use the same abstractions as in all plugins that store large data sets, and that we can leverage the upcoming DataSource abstraction.

Reviewed By: nikoant

Differential Revision: D26127243

fbshipit-source-id: 7c386a615fa7989f35ba0df5b7c1d218d37b57a2
This commit is contained in:
Michel Weststrate
2021-02-01 11:40:20 -08:00
committed by Facebook GitHub Bot
parent f2ade40239
commit 7cc55daf34
11 changed files with 112 additions and 94 deletions

View File

@@ -326,7 +326,6 @@ async function addSaltToDeviceSerial({
pluginStates,
pluginNotification,
statusUpdate,
selectedPlugins,
pluginStates2,
devicePluginStates,
}: AddSaltToDeviceSerialOptions): Promise<ExportType> {
@@ -337,11 +336,6 @@ async function addSaltToDeviceSerial({
deviceType: device.deviceType,
title: device.title,
os: device.os,
logEntries: selectedPlugins.includes('DeviceLogs')
? device.getLogs(
new Date(new Date().getTime() - 1000 * 60 * 10), // Last 10 mins of logs
)
: [],
screenshotHandle: deviceScreenshot,
});
statusUpdate &&
@@ -776,18 +770,13 @@ export function importDataToStore(source: string, data: string, store: Store) {
if (device == null) {
return;
}
const {serial, deviceType, title, os, logs} = device;
const {serial, deviceType, title, os} = device;
const archivedDevice = new ArchivedDevice({
serial,
deviceType,
title,
os,
logEntries: logs
? logs.map((l) => {
return {...l, date: new Date(l.date)};
})
: [],
screenshotHandle: deviceScreenshot,
source,
supportRequestDetails,