From 2a82eee02a177adb51a162332d49f3eeb681f99d Mon Sep 17 00:00:00 2001 From: Steven Githens Date: Thu, 21 May 2020 10:08:22 -0700 Subject: [PATCH 1/5] GPII-4488 Reverting back to saving all application settings, which likely makes sense for capture anyways. --- src/main/dialogs/captureToolDialog.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/dialogs/captureToolDialog.js b/src/main/dialogs/captureToolDialog.js index 68230c262..994bbc07c 100644 --- a/src/main/dialogs/captureToolDialog.js +++ b/src/main/dialogs/captureToolDialog.js @@ -465,9 +465,13 @@ gpii.app.captureTool.savePreferences = function (flatSolutionsRegistry, keyedInU payload.contexts[options.prefSetId] = options.prefSetPayload; - var prefsTogo = gpii.lifecycleManager.transformSettingsToPrefs(options.prefSetPayload.preferences, flatSolutionsRegistry); + // Note: During the development of the capture tool there has been occasional back and forth discussion as to + // whether we should be saving the raw application settings, or the transform with some of them going to generic + // preferences. For the time being we are using application settings as the work better with the validation. GPII-4488. + // If there was a desire to make the transform before saving, the line below can be used to generate the preferences. + // var prefsTogo = gpii.lifecycleManager.transformSettingsToPrefs(options.prefSetPayload.preferences, flatSolutionsRegistry); - payload.contexts[options.prefSetId].preferences = prefsTogo; + payload.contexts[options.prefSetId].preferences = options.prefSetPayload.preferences; flowManager.savePreferences(keyedInUserToken, payload); }; From 3b9b67aac5c3e0128d42fbfe59dc1b34d78354ef Mon Sep 17 00:00:00 2001 From: Steven Githens Date: Tue, 26 May 2020 05:14:08 -0700 Subject: [PATCH 2/5] GPII-4488 Upping gpii-windows version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a2282ca6a..48cb00a28 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "shelljs": "0.8.2" }, "optionalDependencies": { - "gpii-windows": "0.3.0-dev.20200514T214925Z.26f1e42" + "gpii-windows": "0.3.0-dev.20200525T101402Z.6e113cb" }, "scripts": { "start": "set GPII_TEST_COUCH_USE_EXTERNAL=TRUE && electron .", From babbaf6135990749baf92e2d34a58c37a73e7546 Mon Sep 17 00:00:00 2001 From: Steven Githens Date: Fri, 5 Jun 2020 16:55:07 -0700 Subject: [PATCH 3/5] GPII-4488 Adding some more work to convert to application specific settings. --- src/main/dialogs/captureToolDialog.js | 31 ++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/main/dialogs/captureToolDialog.js b/src/main/dialogs/captureToolDialog.js index 994bbc07c..3958719c8 100644 --- a/src/main/dialogs/captureToolDialog.js +++ b/src/main/dialogs/captureToolDialog.js @@ -470,8 +470,37 @@ gpii.app.captureTool.savePreferences = function (flatSolutionsRegistry, keyedInU // preferences. For the time being we are using application settings as the work better with the validation. GPII-4488. // If there was a desire to make the transform before saving, the line below can be used to generate the preferences. // var prefsTogo = gpii.lifecycleManager.transformSettingsToPrefs(options.prefSetPayload.preferences, flatSolutionsRegistry); + // + // Based on further comments, and notes in https://issues.gpii.net/browse/GPII-4497 this is where we must make + // the decision point (and in the future this should be configurable here, via IoC, and probably much earlier in the + // UI workflow based on UX feedback) as to which combination of application specific and generic prefs we are saving. + // As of this moment, we will be saving all application specific preferences. This allows for zero lossy data, generic + // prefs can still be calculated from them at any point in the future from the prefs safe. + var finalPreferences = gpii.app.captureTool.settingsToAllApplicationSpecific(options.prefSetPayload.preferences); - payload.contexts[options.prefSetId].preferences = options.prefSetPayload.preferences; + payload.contexts[options.prefSetId].preferences = finalPreferences; flowManager.savePreferences(keyedInUserToken, payload); }; + +/** + * This takes the settings capture and translates it to application specific preferences ready to be saved to the users + * preferences safe. In practice, this just means prefixing each of the application ID keys with + * "http://registry.gpii.net/applications/". + * + * @param {Object} settings - The captured settings, keyed by application ID. + * @return {Object} Returns the application specific preferences ready to save. + */ +gpii.app.captureTool.settingsToAllApplicationSpecific = function (settings) { + var togo = {}; + fluid.each(settings, function (appSettings, appId) { + var nextBlock = fluid.copy(appSettings); + // fluid.each(nextBlock, function (settingBlock) { + // if (settingBlock.path) { + // delete settingBlock.path; + // } + // }) + togo["http://registry.gpii.net/applications/" + appId] = fluid.copy(nextBlock); + }); + return togo; +}; From 03e6794e47ccb459e836778673a71f8b5f1f101a Mon Sep 17 00:00:00 2001 From: Steven Githens Date: Tue, 16 Jun 2020 12:58:24 -0700 Subject: [PATCH 4/5] GPII-4488 Renabling SPI Settings remove which will go along with relaxing the path required validation --- src/main/dialogs/captureToolDialog.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/dialogs/captureToolDialog.js b/src/main/dialogs/captureToolDialog.js index 3958719c8..c32c8e72a 100644 --- a/src/main/dialogs/captureToolDialog.js +++ b/src/main/dialogs/captureToolDialog.js @@ -495,11 +495,14 @@ gpii.app.captureTool.settingsToAllApplicationSpecific = function (settings) { var togo = {}; fluid.each(settings, function (appSettings, appId) { var nextBlock = fluid.copy(appSettings); - // fluid.each(nextBlock, function (settingBlock) { - // if (settingBlock.path) { - // delete settingBlock.path; - // } - // }) + fluid.each(nextBlock, function (settingBlock) { + // SPI Settings Hack to remove the values which will eventually be fixed in GPII-3119 + if (settingBlock.path) { + fluid.remove_if(settingBlock, function (val, idx) { + return idx === "path"; + }) + } + }) togo["http://registry.gpii.net/applications/" + appId] = fluid.copy(nextBlock); }); return togo; From 6aa945319415207f62dbb6b403841de7c3caaba0 Mon Sep 17 00:00:00 2001 From: Steven Githens Date: Wed, 17 Jun 2020 12:04:28 -0700 Subject: [PATCH 5/5] GPII-4488 Amatuer hour linting error --- src/main/dialogs/captureToolDialog.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/dialogs/captureToolDialog.js b/src/main/dialogs/captureToolDialog.js index c32c8e72a..1a0997b56 100644 --- a/src/main/dialogs/captureToolDialog.js +++ b/src/main/dialogs/captureToolDialog.js @@ -500,9 +500,9 @@ gpii.app.captureTool.settingsToAllApplicationSpecific = function (settings) { if (settingBlock.path) { fluid.remove_if(settingBlock, function (val, idx) { return idx === "path"; - }) + }); } - }) + }); togo["http://registry.gpii.net/applications/" + appId] = fluid.copy(nextBlock); }); return togo;