From a2e256b4c90de1f23b6249e266d9a2a53af1b795 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Damir=20Jeli=C4=87?= <poljar@termina.org.uk>
Date: Fri, 17 Jan 2020 10:06:54 +0100
Subject: [PATCH] ElectronPlatform: Add the ability to load file events from
 the event index.

---
 electron_app/src/electron-main.js       | 12 ++++++++++++
 src/vector/platform/ElectronPlatform.js |  4 ++++
 2 files changed, 16 insertions(+)

diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js
index 6e477f9015..44cbe4f6b5 100644
--- a/electron_app/src/electron-main.js
+++ b/electron_app/src/electron-main.js
@@ -370,6 +370,18 @@ ipcMain.on('seshat', async function(ev, payload) {
             }
             break;
 
+        case 'loadFileEvents':
+            if (eventIndex === null) ret = [];
+            else {
+                try {
+                    ret = await eventIndex.loadFileEvents(args[0]);
+                } catch (e) {
+                    sendError(payload.id, e);
+                    return;
+                }
+            }
+            break;
+
         case 'loadCheckpoints':
             if (eventIndex === null) ret = [];
             else {
diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js
index 9968504a2f..6c1d45c2cf 100644
--- a/src/vector/platform/ElectronPlatform.js
+++ b/src/vector/platform/ElectronPlatform.js
@@ -144,6 +144,10 @@ class SeshatIndexManager extends BaseEventIndexManager {
         return this._ipcCall('removeCrawlerCheckpoint', checkpoint);
     }
 
+    async loadFileEvents(args): Promise<[EventAndProfile]> {
+        return this._ipcCall('loadFileEvents', args);
+    }
+
     async loadCheckpoints(): Promise<[CrawlerCheckpoint]> {
         return this._ipcCall('loadCheckpoints');
     }