Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous Small Fixes #622

Merged
merged 6 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/renderer/src/stories/InfoBox.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down Expand Up @@ -120,7 +121,9 @@ export class InfoBox extends LitElement {
${new Chevron({ direction: "right" })}
</div>
<div class="guided--info-container">
<span class="guided--help-text">${this.content}</span>
<span class="guided--help-text"
>${typeof this.content === "string" ? unsafeHTML(this.content) : this.content}</span
>
</div>
`;
}
Expand Down
1 change: 0 additions & 1 deletion src/renderer/src/stories/JSONSchemaForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions src/renderer/src/stories/pages/guided-mode/GuidedStart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
<a href="https://neuroconv.readthedocs.io/en/main" target="_blank"
>neuroconv documentation page</a
>
>neuroconv documentation page</a>.
`,
})}
</div>
Expand Down
22 changes: 10 additions & 12 deletions src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down Expand Up @@ -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
) {
schema.minItems = schema.maxItems = target[name].length;
if (name !== "Device" && target) {
if (name in target)
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);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/stories/pages/guided-mode/data/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export class GuidedSubjectsPage extends Page {
this.notify(`<b>${header(name)}</b> has been overridden with a global value.`, "warning", 3000);
},
onUpdate: () => {
console.log("UPDATED!");
this.unsavedUpdates = "conversions";
},
validateOnChange: (localPath, parent, v) => {
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/src/stories/table/Cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading