From b3fc891827b2b0c1956bd57a148f934ed31e868f Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Tue, 21 Nov 2023 15:58:35 -0600 Subject: [PATCH 1/3] Update GuidedNewDatasetInfo.js --- .../guided-mode/setup/GuidedNewDatasetInfo.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/renderer/src/stories/pages/guided-mode/setup/GuidedNewDatasetInfo.js b/src/renderer/src/stories/pages/guided-mode/setup/GuidedNewDatasetInfo.js index 6939693bb..f8f070dc6 100644 --- a/src/renderer/src/stories/pages/guided-mode/setup/GuidedNewDatasetInfo.js +++ b/src/renderer/src/stories/pages/guided-mode/setup/GuidedNewDatasetInfo.js @@ -77,8 +77,6 @@ export class GuidedNewDatasetPage extends Page { }; updateForm = () => { - let projectGlobalState = this.info.globalState.project; - if (!projectGlobalState) projectGlobalState = this.info.globalState.project = {}; // Properly clone the schema to produce multiple pages from the project metadata schema const schema = { ...projectMetadataSchema }; @@ -86,18 +84,6 @@ export class GuidedNewDatasetPage extends Page { this.state = merge(global.data.output_locations, structuredClone(this.info.globalState.project)); - const pages = schemaToPages.call(this, globalSchema, ["project"], { validateEmptyValues: false }, (info) => { - info.title = `${info.label} Global Metadata`; - return info; - }); - - pages.forEach((page) => { - page.header = { - subtitle: `Enter any ${page.info.label}-level metadata that can serve as the common default across each experiment session`, - }; - this.addPage(page.info.label, page); - }); - this.form = new JSONSchemaForm({ schema, results: this.state, From 1468cf2e061b3a6a3254d091db040f1f9d98458e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 21 Nov 2023 21:59:42 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/renderer/src/stories/pages/Page.js | 2 +- .../src/stories/pages/guided-mode/options/utils.js | 12 +++++------- .../pages/guided-mode/setup/GuidedNewDatasetInfo.js | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/renderer/src/stories/pages/Page.js b/src/renderer/src/stories/pages/Page.js index a0aee18bc..8207918c2 100644 --- a/src/renderer/src/stories/pages/Page.js +++ b/src/renderer/src/stories/pages/Page.js @@ -170,7 +170,7 @@ export class Page extends LitElement { Object.assign(element.style, { textAlign: "left", display: "block", - }) + }); const progressBar = new ProgressBar(); elements.progress = progressBar; diff --git a/src/renderer/src/stories/pages/guided-mode/options/utils.js b/src/renderer/src/stories/pages/guided-mode/options/utils.js index 238681e36..83bef4acc 100644 --- a/src/renderer/src/stories/pages/guided-mode/options/utils.js +++ b/src/renderer/src/stories/pages/guided-mode/options/utils.js @@ -23,12 +23,10 @@ export const openProgressSwal = (options, callback) => { }; export const run = async (url, payload, options = {}) => { + let internalSwal; - let internalSwal - - if (options.swal === false) {} - else if (!options.swal || options.swal === true) { - + if (options.swal === false) { + } else if (!options.swal || options.swal === true) { if (!("showCancelButton" in options)) { options.showCancelButton = true; options.customClass = { actions: "swal-conversion-actions" }; @@ -40,12 +38,12 @@ export const run = async (url, payload, options = {}) => { signal: cancelController.signal, }; - const popup = internalSwal = await openProgressSwal(options, (result) => { + const popup = (internalSwal = await openProgressSwal(options, (result) => { if (!result.isConfirmed) cancelController.abort(); }).then(async (swal) => { if (options.onOpen) await options.onOpen(swal); return swal; - }); + })); const element = popup.getHtmlContainer(); const actions = popup.getActions(); diff --git a/src/renderer/src/stories/pages/guided-mode/setup/GuidedNewDatasetInfo.js b/src/renderer/src/stories/pages/guided-mode/setup/GuidedNewDatasetInfo.js index f8f070dc6..5072e3799 100644 --- a/src/renderer/src/stories/pages/guided-mode/setup/GuidedNewDatasetInfo.js +++ b/src/renderer/src/stories/pages/guided-mode/setup/GuidedNewDatasetInfo.js @@ -77,7 +77,6 @@ export class GuidedNewDatasetPage extends Page { }; updateForm = () => { - // Properly clone the schema to produce multiple pages from the project metadata schema const schema = { ...projectMetadataSchema }; schema.properties = { ...schema.properties }; From 244053b2dcb82b9cd77644fc9470fee2c91ec944 Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Tue, 21 Nov 2023 18:45:14 -0600 Subject: [PATCH 3/3] Ensure subject overrides are carried over --- src/renderer/src/stories/pages/guided-mode/data/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/stories/pages/guided-mode/data/utils.js b/src/renderer/src/stories/pages/guided-mode/data/utils.js index 4618e17ba..c1917de2d 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/utils.js +++ b/src/renderer/src/stories/pages/guided-mode/data/utils.js @@ -20,7 +20,8 @@ export function resolveGlobalOverrides(subject, globalState) { delete subjectMetadataCopy.sessions; // Remove extra key from metadata const overrides = structuredClone(globalState.project ?? {}); // Copy project-wide metadata - merge(subjectMetadataCopy, overrides.Subject); + + merge(subjectMetadataCopy, overrides.Subject ?? (overrides.Subject = {})); // Ensure Subject exists return overrides; }