From fd107f0110939f1256ff5ae6db8f8868f3fb9c6b Mon Sep 17 00:00:00 2001 From: Steven Githens Date: Fri, 19 Jun 2020 15:12:31 -0700 Subject: [PATCH] GPII-4511 Adding solution id list and filter to avoid having them captured. Good for filtering out things like net.gpii.explode --- src/main/dialogs/captureToolDialog.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/dialogs/captureToolDialog.js b/src/main/dialogs/captureToolDialog.js index 68230c262..2027489a1 100644 --- a/src/main/dialogs/captureToolDialog.js +++ b/src/main/dialogs/captureToolDialog.js @@ -86,7 +86,14 @@ fluid.defaults("gpii.app.captureTool", { isKeyedIn: false, keyedInUserToken: null, preferences: {}, - flatSolutionsRegistry: {} + flatSolutionsRegistry: {}, + + // Solutions to ignore. This is a runtime configurable variable with ID's of + // solutions to exclude from the capture process. + solutionsToExclude: [ + "net.gpii.test.speechControl", + "net.gpii.explode" + ] }, /* * Raw options to be passed to the Electron `BrowserWindow` that is created. @@ -216,7 +223,7 @@ fluid.defaults("gpii.app.captureTool", { }, getAllSolutionsCapture: { funcName: "gpii.app.captureTool.channelGetAllSolutionsCapture", - args: ["{captureTool}.channelNotifier", "{flowManager}", "{arguments}.0"] + args: ["{captureTool}.model.solutionsToExclude", "{captureTool}.channelNotifier", "{flowManager}", "{arguments}.0"] }, captureDoneButton: { func: "{captureTool}.close" @@ -410,11 +417,12 @@ gpii.app.captureTool.safelyGetSolutionsCapture = function (flowManager, solution /** * Fetches the entire system capture and sends it to the renderer over the `channelNotifier`. * + * @param {Array} solutionsToExclude - Array of Solution IDs to exclude from capture. * @param {gpii.app.channelNotifier} channelNotifier - The channel notifier to the renderer process. * @param {gpii.flowManager.local} flowManager - The local flow manager. * @param {Object} args - Optional object contains an array `solutionsList` of solution ID's to capture. */ -gpii.app.captureTool.channelGetAllSolutionsCapture = function (channelNotifier, flowManager, args) { +gpii.app.captureTool.channelGetAllSolutionsCapture = function (solutionsToExclude, channelNotifier, flowManager, args) { var options = { solutionsList: [] }; @@ -422,6 +430,11 @@ gpii.app.captureTool.channelGetAllSolutionsCapture = function (channelNotifier, options.solutionsList = args.solutionsList; } + // Filter out excluded solutions (usually ridiculous ones like net.gpii.explode) + fluid.remove_if(options.solutionsList, function (val) { + return solutionsToExclude.indexOf(val) >= 0; + }); + var result = gpii.app.captureTool.safelyGetSolutionsCapture(flowManager, options.solutionsList); result.then(function (data) { channelNotifier.events.sendingAllSolutionsCapture.fire(data);