From 2f0b783e56cd4704cc348191b5560ce68ad3c4d1 Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Tue, 21 Nov 2023 16:05:58 -0600 Subject: [PATCH 1/2] Remove preview output location option --- schemas/json/project/globals.json | 6 ------ src/renderer/src/stories/pages/Page.js | 4 ++-- .../pages/guided-mode/setup/GuidedNewDatasetInfo.js | 5 +---- .../src/stories/pages/settings/SettingsPage.js | 11 +++++++---- src/renderer/src/validation/validation.json | 1 - 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/schemas/json/project/globals.json b/schemas/json/project/globals.json index 66280e879..921131734 100644 --- a/schemas/json/project/globals.json +++ b/schemas/json/project/globals.json @@ -4,12 +4,6 @@ "type": "string", "format": "directory", "description": "Provide a custom output location for your NWB files. Will default to ~/NWB_GUIDE/conversions" - }, - - "preview_output_folder": { - "type": "string", - "format": "directory", - "description": "Provide a custom output location for your NWB stub files. Will default to ~/NWB_GUIDE/preview. These files are expected to much smaller than the conversion files (only ~MB in scale)." } } } diff --git a/src/renderer/src/stories/pages/Page.js b/src/renderer/src/stories/pages/Page.js index a0aee18bc..013e8fec5 100644 --- a/src/renderer/src/stories/pages/Page.js +++ b/src/renderer/src/stories/pages/Page.js @@ -187,7 +187,7 @@ export class Page extends LitElement { const { subject, session, globalState = this.info.globalState } = info; const file = `sub-${subject}/sub-${subject}_ses-${session}.nwb`; - const { conversion_output_folder, preview_output_folder, name } = globalState.project; + const { conversion_output_folder, name } = globalState.project; // Resolve the correct session info from all of the metadata for this conversion const sessionInfo = { @@ -197,7 +197,7 @@ export class Page extends LitElement { const result = await runConversion( { - output_folder: conversionOptions.stub_test ? preview_output_folder : conversion_output_folder, + output_folder: conversionOptions.stub_test ? undefined : conversion_output_folder, project_name: name, nwbfile_path: file, overwrite: true, // We assume override is true because the native NWB file dialog will not allow the user to select an existing file (unless they approve the overwrite) 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..8824e9c21 100644 --- a/src/renderer/src/stories/pages/guided-mode/setup/GuidedNewDatasetInfo.js +++ b/src/renderer/src/stories/pages/guided-mode/setup/GuidedNewDatasetInfo.js @@ -7,10 +7,7 @@ import { validateOnChange } from "../../../../validation/index.js"; import projectGeneralSchema from "../../../../../../../schemas/json/project/general.json" assert { type: "json" }; import projectGlobalSchema from "../../../../../../../schemas/json/project/globals.json" assert { type: "json" }; import { merge } from "../../utils.js"; -import { schemaToPages } from "../../FormPage.js"; import { onThrow } from "../../../../errors"; - -import { globalSchema } from "../../../../../../../schemas/base-metadata.schema"; import { header } from "../../../forms/utils"; const projectMetadataSchema = merge(projectGlobalSchema, projectGeneralSchema); @@ -82,7 +79,7 @@ export class GuidedNewDatasetPage extends Page { const schema = { ...projectMetadataSchema }; schema.properties = { ...schema.properties }; - this.state = merge(global.data.output_locations, structuredClone(this.info.globalState.project)); + this.state = merge(global.data, structuredClone(this.info.globalState.project)); this.form = new JSONSchemaForm({ schema, diff --git a/src/renderer/src/stories/pages/settings/SettingsPage.js b/src/renderer/src/stories/pages/settings/SettingsPage.js index 749f6368a..e494c2902 100644 --- a/src/renderer/src/stories/pages/settings/SettingsPage.js +++ b/src/renderer/src/stories/pages/settings/SettingsPage.js @@ -7,13 +7,16 @@ import projectGlobalSchema from "../../../../../../schemas/json/project/globals. import { validateDANDIApiKey } from "../../../validation/dandi"; -const schema = { +const schema = merge(projectGlobalSchema, { properties: { - output_locations: projectGlobalSchema, DANDI: dandiGlobalSchema, }, - required: ["output_locations", "DANDI"], -}; + required: ["DANDI"] + }, { + arrays: true + }); + +console.log(schema) import { Button } from "../../Button.js"; import { global } from "../../../progress/index.js"; diff --git a/src/renderer/src/validation/validation.json b/src/renderer/src/validation/validation.json index dcf15ec17..af88a8690 100644 --- a/src/renderer/src/validation/validation.json +++ b/src/renderer/src/validation/validation.json @@ -3,7 +3,6 @@ "name": false, "conversion_output_folder": false, - "preview_output_folder": false, "NWBFile": { "identifier": false, From 20d779bc087f7fb6b267a84247dcc8b8e094333c 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 22:08:09 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../stories/pages/settings/SettingsPage.js | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/stories/pages/settings/SettingsPage.js b/src/renderer/src/stories/pages/settings/SettingsPage.js index e494c2902..3266bc508 100644 --- a/src/renderer/src/stories/pages/settings/SettingsPage.js +++ b/src/renderer/src/stories/pages/settings/SettingsPage.js @@ -7,16 +7,20 @@ import projectGlobalSchema from "../../../../../../schemas/json/project/globals. import { validateDANDIApiKey } from "../../../validation/dandi"; -const schema = merge(projectGlobalSchema, { - properties: { - DANDI: dandiGlobalSchema, +const schema = merge( + projectGlobalSchema, + { + properties: { + DANDI: dandiGlobalSchema, + }, + required: ["DANDI"], }, - required: ["DANDI"] - }, { - arrays: true - }); + { + arrays: true, + } +); -console.log(schema) +console.log(schema); import { Button } from "../../Button.js"; import { global } from "../../../progress/index.js";