From 888cf9f34e79860ac8ff7c783fdc82c3ea95988c Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 31 Jan 2023 01:02:40 +0100 Subject: [PATCH] added command to copy result stats to clipboard --- frontend/src/ts/commandline/commands.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/frontend/src/ts/commandline/commands.ts b/frontend/src/ts/commandline/commands.ts index 0fb4734b2..43bcf1595 100644 --- a/frontend/src/ts/commandline/commands.ts +++ b/frontend/src/ts/commandline/commands.ts @@ -96,6 +96,7 @@ import * as Settings from "../pages/settings"; import * as Notifications from "../elements/notifications"; import * as VideoAdPopup from "../popups/video-ad-popup"; import * as ShareTestSettingsPopup from "../popups/share-test-settings-popup"; +import * as TestStats from "../test/test-stats"; Misc.getLayoutsList() .then((layouts) => { @@ -399,6 +400,22 @@ export const commands: MonkeyTypes.CommandsSubgroup = { alert(await caches.keys()); }, }, + { + id: "copyResultStats", + display: "Copy result stats", + icon: "fa-cog", + visible: false, + exec: async (): Promise => { + navigator.clipboard + .writeText(JSON.stringify(TestStats.getStats())) + .then(() => { + Notifications.add("Copied to clipboard", 1); + }) + .catch((e) => { + Notifications.add("Failed to copy to clipboard: " + e, -1); + }); + }, + }, { id: "joinDiscord", display: "Join the Discord server",