diff --git a/.github/workflows/pyflask-build-and-dist-tests.yml b/.github/workflows/pyflask-build-and-dist-tests.yml index 105385994..cee21a443 100644 --- a/.github/workflows/pyflask-build-and-dist-tests.yml +++ b/.github/workflows/pyflask-build-and-dist-tests.yml @@ -1,4 +1,4 @@ -name: Build Tests — Flask +name: Build Tests on: schedule: - cron: "0 16 * * *" # Daily at noon EST @@ -15,7 +15,7 @@ env: jobs: testing: - name: PyFlask build and distributable tests on ${{ matrix.os }} + name: PyInstaller on ${{ matrix.os }} # Will read on the dashboard as 'Build Tests / PyInstaller on {os}' runs-on: ${{ matrix.os }} defaults: run: diff --git a/.github/workflows/testing-live-services.yml b/.github/workflows/testing-live-services.yml index da1925365..1169c03d8 100644 --- a/.github/workflows/testing-live-services.yml +++ b/.github/workflows/testing-live-services.yml @@ -1,4 +1,4 @@ -name: Dev Tests (Live Services) +name: Dev Tests (Live) on: schedule: - cron: "0 16 * * *" # Daily at noon EST @@ -13,7 +13,7 @@ env: jobs: testing: - name: Dev tests with live services on ${{ matrix.os }} + name: Services on ${{ matrix.os }} # Will read on the dashboard as 'Dev Tests (Live) / Services on {os}' runs-on: ${{ matrix.os }} defaults: run: diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 7eae1a44c..2ffe28df8 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -13,7 +13,7 @@ env: jobs: testing: - name: Dev tests on ${{ matrix.os }} + name: ${{ matrix.os }} # Will read on the dashboard as 'Dev Tests / {os}' runs-on: ${{ matrix.os }} defaults: run: diff --git a/schemas/base-metadata.schema.ts b/schemas/base-metadata.schema.ts index 699a5f44b..5ff238c25 100644 --- a/schemas/base-metadata.schema.ts +++ b/schemas/base-metadata.schema.ts @@ -5,6 +5,7 @@ import { header, replaceRefsWithValue } from '../src/renderer/src/stories/forms/ import baseMetadataSchema from './json/base_metadata_schema.json' assert { type: "json" } import { merge } from '../src/renderer/src/stories/pages/utils' +import { drillSchemaProperties } from '../src/renderer/src/stories/pages/guided-mode/data/utils' const UV_MATH_FORMAT = `µV`; //`µV` const UV_PROPERTIES = ["gain_to_uV", "offset_to_uV"] @@ -71,8 +72,20 @@ export const preprocessMetadataSchema = (schema: any = baseMetadataSchema, globa const copy = replaceRefsWithValue(structuredClone(schema)) - copy.additionalProperties = false + // NEUROCONV PATCH: Correct for incorrect array schema + drillSchemaProperties( + copy, + (_, schema) => { + if (schema.properties && schema.type === "array") { + schema.items = { type: "object", properties: schema.properties, required: schema.required }; + delete schema.properties; + delete schema.required; + } + }, + {} + ); + copy.additionalProperties = false copy.required = Object.keys(copy.properties) // Require all properties at the top level diff --git a/src/renderer/src/stories/InstanceManager.js b/src/renderer/src/stories/InstanceManager.js index 20c1a5ba8..af027d954 100644 --- a/src/renderer/src/stories/InstanceManager.js +++ b/src/renderer/src/stories/InstanceManager.js @@ -223,7 +223,6 @@ export class InstanceManager extends LitElement { // Correct bug where multiple instances are selected updated = () => { - console.log(this); const selected = Array.from(this.shadowRoot.querySelectorAll("[selected]")); if (selected.length > 0) selected.slice(1).forEach((element) => { @@ -376,7 +375,6 @@ export class InstanceManager extends LitElement { this.#items = []; const instances = this.#render(); - console.log(this.#items); const hasMultiple = this.#hasMultiple(); diff --git a/src/renderer/src/stories/JSONSchemaForm.js b/src/renderer/src/stories/JSONSchemaForm.js index 9d4695b80..1af50a2d0 100644 --- a/src/renderer/src/stories/JSONSchemaForm.js +++ b/src/renderer/src/stories/JSONSchemaForm.js @@ -517,8 +517,9 @@ export class JSONSchemaForm extends LitElement { if (e.message.includes("is not of a type(s)")) { if (resolvedSchema.type === "number") { if (resolvedValue === "NaN") return; - else if (resolvedValue === null) return; - else if (isRow) e.message = `${e.message}. ${templateNaNMessage}`; + else if (resolvedValue === null) { + if (schema.type !== "array") return; // Allow null in non-tables + } else if (isRow) e.message = `${e.message}. ${templateNaNMessage}`; } else if (resolvedSchema.type === "string") { if ("properties" in resolvedSchema) return; // Allow for constructing types from object types } diff --git a/src/renderer/src/stories/JSONSchemaInput.js b/src/renderer/src/stories/JSONSchemaInput.js index 76f73bbf9..4241e833d 100644 --- a/src/renderer/src/stories/JSONSchemaInput.js +++ b/src/renderer/src/stories/JSONSchemaInput.js @@ -174,8 +174,6 @@ export function createTable(fullPath, { onUpdate, onThrow, overrides = {} }) { merge(overrides.schema, schemaCopy, { arrays: true }); - console.log(schemaPath, nestedIgnore); - const tableMetadata = { keyColumn: tempPropertyKey, schema: schemaCopy, @@ -928,7 +926,6 @@ export class JSONSchemaInput extends LitElement { const allowPatternProperties = isPatternProperties(this.pattern); const allowAdditionalProperties = isAdditionalProperties(this.pattern); - // Provide default item types // Provide default item types if (isArray) { const hasItemsRef = "items" in schema && "$ref" in schema.items; @@ -1016,7 +1013,7 @@ export class JSONSchemaInput extends LitElement { }); } - const externalPath = this.form ? [...this.form.base, ...resolvedFullPath] : resolvedFullPath; + const externalPath = this.form?.base ? [...this.form.base, ...resolvedFullPath] : resolvedFullPath; const table = createTable.call(this, externalPath, { onUpdate: updateFunction, 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 1e35cf2b0..05b006b59 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js @@ -245,7 +245,6 @@ export class GuidedMetadataPage extends ManagedPage { const ophys = schema.properties.Ophys; if (ophys) { - // Set most Ophys tables to have minItems / maxItems equal (i.e. no editing possible) drillSchemaProperties( schema, (path, schema, target, isPatternProperties, parentSchema) => { @@ -258,11 +257,14 @@ 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 properties) - // Remove Ophys requirements if left initially undefined - else if (parentSchema.required.includes(name)) - parentSchema.required = parentSchema.required.filter((n) => n !== name); + // Set most Ophys tables to have minItems / maxItems equal (i.e. no editing possible) + if (name in target) schema.minItems = schema.maxItems = target[name].length; + // Remove Ophys property requirement if left initially undefined + else { + target[name] = []; // Initialize empty array + if (parentSchema.required.includes(name)) + parentSchema.required = parentSchema.required.filter((n) => n !== name); + } } } } @@ -272,6 +274,7 @@ export class GuidedMetadataPage extends ManagedPage { } console.log("schema", structuredClone(schema), structuredClone(results)); + // Create the form const form = new JSONSchemaForm({ identifier: instanceId, 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 bbc3e0dbe..a2c00b03c 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/utils.js +++ b/src/renderer/src/stories/pages/guided-mode/data/utils.js @@ -88,12 +88,6 @@ export function resolveProperties(properties = {}, target, globals = {}) { for (let name in properties) { const info = properties[name]; - // NEUROCONV PATCH: Correct for incorrect array schema - if (info.properties && info.type === "array") { - info.items = { type: "object", properties: info.properties, required: info.required }; - delete info.properties; - } - const props = info.properties; if (!(name in target)) { diff --git a/src/renderer/src/stories/table/cells/base.ts b/src/renderer/src/stories/table/cells/base.ts index d4f3424be..dfb75862f 100644 --- a/src/renderer/src/stories/table/cells/base.ts +++ b/src/renderer/src/stories/table/cells/base.ts @@ -126,7 +126,6 @@ export class TableCellBase extends LitElement { this.setAttribute('editing', '') const listenForEnter = (ev: KeyboardEvent) => { - console.log(ev) if (ev.key === 'Enter') { ev.preventDefault() diff --git a/src/renderer/src/stories/table/cells/input.ts b/src/renderer/src/stories/table/cells/input.ts index a67486c52..51472ce58 100644 --- a/src/renderer/src/stories/table/cells/input.ts +++ b/src/renderer/src/stories/table/cells/input.ts @@ -44,6 +44,8 @@ export class NestedEditor extends LitElement { const schema = this.schema + console.log('schema', schema, 'data', data) + const container = document.createElement('div') const input = this.#input = new JSONSchemaInput({ schema, value: data, @@ -59,9 +61,10 @@ export class NestedEditor extends LitElement { renderTable: (name, metadata, path) => new SimpleTable(metadata) // NOTE: Would be most ideal to have a reference to the containing input... }) - input.style.padding = '25px 50px' + container.style.padding = '25px' + container.append(input) - modal.append(input) + modal.append(container) modal.open = true }