From 9044689615ab564d4be1520be23f2e6596ce4b05 Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Wed, 21 Feb 2024 12:02:33 -0600 Subject: [PATCH 1/5] Small rendering and error fixes --- src/renderer/src/stories/InfoBox.js | 3 ++- src/renderer/src/stories/JSONSchemaForm.js | 1 - src/renderer/src/stories/pages/guided-mode/GuidedStart.js | 3 +-- .../src/stories/pages/guided-mode/setup/GuidedSubjects.js | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/stories/InfoBox.js b/src/renderer/src/stories/InfoBox.js index c11b4c54b..e90165716 100644 --- a/src/renderer/src/stories/InfoBox.js +++ b/src/renderer/src/stories/InfoBox.js @@ -1,5 +1,6 @@ import { LitElement, css, html } from "lit"; import { Chevron } from "./Chevron"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; export class InfoBox extends LitElement { static get styles() { @@ -120,7 +121,7 @@ export class InfoBox extends LitElement { ${new Chevron({ direction: "right" })}
- ${this.content} + ${typeof this.content === 'string' ? unsafeHTML(this.content) : this.content}
`; } diff --git a/src/renderer/src/stories/JSONSchemaForm.js b/src/renderer/src/stories/JSONSchemaForm.js index c08b8c1ff..ed318d187 100644 --- a/src/renderer/src/stories/JSONSchemaForm.js +++ b/src/renderer/src/stories/JSONSchemaForm.js @@ -464,7 +464,6 @@ export class JSONSchemaForm extends LitElement { // if (!isValid && allErrors.length && nMissingRequired === allErrors.length) message = `${nMissingRequired} required inputs are not defined.`; - console.log(allErrors); // Check if all inputs are valid if (flaggedInputs.length) { flaggedInputs[0].focus(); diff --git a/src/renderer/src/stories/pages/guided-mode/GuidedStart.js b/src/renderer/src/stories/pages/guided-mode/GuidedStart.js index 666742215..43cb4f2cc 100644 --- a/src/renderer/src/stories/pages/guided-mode/GuidedStart.js +++ b/src/renderer/src/stories/pages/guided-mode/GuidedStart.js @@ -104,8 +104,7 @@ export class GuidedStartPage extends Page { Although not required to use the GUIDE, you can learn more about the NWB conversion process in the neuroconv documentation page + >neuroconv documentation page. `, })} diff --git a/src/renderer/src/stories/pages/guided-mode/setup/GuidedSubjects.js b/src/renderer/src/stories/pages/guided-mode/setup/GuidedSubjects.js index 82e4f8c7b..44a0dfbb0 100644 --- a/src/renderer/src/stories/pages/guided-mode/setup/GuidedSubjects.js +++ b/src/renderer/src/stories/pages/guided-mode/setup/GuidedSubjects.js @@ -134,7 +134,6 @@ export class GuidedSubjectsPage extends Page { this.notify(`${header(name)} has been overridden with a global value.`, "warning", 3000); }, onUpdate: () => { - console.log("UPDATED!"); this.unsavedUpdates = "conversions"; }, validateOnChange: (localPath, parent, v) => { From 34f8a0b979b7ce05b5cd33af2fd8e034157e5252 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 18:03:55 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/renderer/src/stories/InfoBox.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/stories/InfoBox.js b/src/renderer/src/stories/InfoBox.js index e90165716..3177dd2c5 100644 --- a/src/renderer/src/stories/InfoBox.js +++ b/src/renderer/src/stories/InfoBox.js @@ -121,7 +121,9 @@ export class InfoBox extends LitElement { ${new Chevron({ direction: "right" })}
- ${typeof this.content === 'string' ? unsafeHTML(this.content) : this.content} + ${typeof this.content === "string" ? unsafeHTML(this.content) : this.content}
`; } From 83069cb15b1394d3823c285216ffe1ea6aa8e3ce Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Mon, 26 Feb 2024 12:52:11 -0800 Subject: [PATCH 3/5] Fix missing TwoPhotonSeries handling --- .../pages/guided-mode/data/GuidedMetadata.js | 16 +++++++--------- .../src/stories/pages/guided-mode/data/utils.js | 4 ++-- src/renderer/src/stories/table/Cell.ts | 2 -- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js index 636b4faa9..8c375c230 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js @@ -84,7 +84,6 @@ export class GuidedMetadataPage extends ManagedPage { } beforeSave = () => { - console.log(this.localState.results, this.info.globalState.results); merge(this.localState.results, this.info.globalState.results); }; @@ -195,22 +194,21 @@ export class GuidedMetadataPage extends ManagedPage { // Set most Ophys tables to have minItems / maxItems equal (i.e. no editing possible) drillSchemaProperties( resolvedSchema, - (path, schema, target, isPatternProperties) => { + (path, schema, target, isPatternProperties, parentSchema) => { if (path[0] === "Ophys") { const name = path.slice(-1)[0]; - if (isPatternProperties) { - schema.minItems = schema.maxItems = Object.values(resolveFromPath(path, results)).length; - return; - } + if (isPatternProperties) return schema.minItems = schema.maxItems = Object.values(resolveFromPath(path, results)).length if (schema.type === "array") { if ( name !== "Device" && - target && - name in target // Skip unresolved deep in pattern properties + target ) { - schema.minItems = schema.maxItems = target[name].length; + if (name in target) schema.minItems = schema.maxItems = target[name].length // Skip unresolved deep in pattern propertie) + + // Remove Ophys requirements if left initially undefined + else if (parentSchema.required.includes(name)) parentSchema.required = parentSchema.required.filter((n) => n !== name); } } } 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 dafaa89ca..6593aba50 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/utils.js +++ b/src/renderer/src/stories/pages/guided-mode/data/utils.js @@ -60,7 +60,7 @@ export function drillSchemaProperties(schema = {}, callback, target, path = [], const info = patternProperties[regexp]; const updatedPath = [...path, regexp]; callback(updatedPath, info, undefined, true); - drillSchemaProperties(info, callback, undefined, updatedPath, true); + drillSchemaProperties(info, callback, undefined, updatedPath, true, schema); } for (let name in properties) { @@ -70,7 +70,7 @@ export function drillSchemaProperties(schema = {}, callback, target, path = [], const updatedPath = [...path, name]; - callback(updatedPath, info, target); + callback(updatedPath, info, target, undefined, schema); drillSchemaProperties(info, callback, target?.[name], updatedPath, inPatternProperties); } diff --git a/src/renderer/src/stories/table/Cell.ts b/src/renderer/src/stories/table/Cell.ts index 86fe647a1..1cda87fa5 100644 --- a/src/renderer/src/stories/table/Cell.ts +++ b/src/renderer/src/stories/table/Cell.ts @@ -110,8 +110,6 @@ export class TableCell extends LitElement { } set value(value) { - if (!value) value = [] - if (this.input) this.input.set(renderValue(value, this.schema)) // Allow null to be set directly this.#value = this.input ? this.input.getValue() // Ensure all operations are undoable / value is coerced From 52059a36a64cdaf56eb2e8afd4a2b9a23e065abf Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 20:52:27 +0000 Subject: [PATCH 4/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../pages/guided-mode/data/GuidedMetadata.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js index 8c375c230..fc7c9b45c 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js @@ -198,17 +198,17 @@ export class GuidedMetadataPage extends ManagedPage { if (path[0] === "Ophys") { const name = path.slice(-1)[0]; - if (isPatternProperties) return schema.minItems = schema.maxItems = Object.values(resolveFromPath(path, results)).length + if (isPatternProperties) + return (schema.minItems = schema.maxItems = + Object.values(resolveFromPath(path, results)).length); if (schema.type === "array") { - if ( - name !== "Device" && - target - ) { - if (name in target) schema.minItems = schema.maxItems = target[name].length // Skip unresolved deep in pattern propertie) - + if (name !== "Device" && target) { + if (name in target) + schema.minItems = schema.maxItems = target[name].length; // Skip unresolved deep in pattern propertie) // Remove Ophys requirements if left initially undefined - else if (parentSchema.required.includes(name)) parentSchema.required = parentSchema.required.filter((n) => n !== name); + else if (parentSchema.required.includes(name)) + parentSchema.required = parentSchema.required.filter((n) => n !== name); } } } From 2790fb5962aea4fbe67ac5ccb71109060e734690 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Tue, 27 Feb 2024 13:14:48 -0500 Subject: [PATCH 5/5] Update src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js --- .../src/stories/pages/guided-mode/data/GuidedMetadata.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js index fc7c9b45c..53ddb4065 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js @@ -205,7 +205,7 @@ export class GuidedMetadataPage extends ManagedPage { if (schema.type === "array") { if (name !== "Device" && target) { if (name in target) - schema.minItems = schema.maxItems = target[name].length; // Skip unresolved deep in pattern propertie) + schema.minItems = schema.maxItems = target[name].length; // Skip unresolved deep in pattern properties) // Remove Ophys requirements if left initially undefined else if (parentSchema.required.includes(name)) parentSchema.required = parentSchema.required.filter((n) => n !== name);