diff --git a/guideGlobalMetadata.json b/guideGlobalMetadata.json index 7c2fef953..640a8c9c5 100644 --- a/guideGlobalMetadata.json +++ b/guideGlobalMetadata.json @@ -26,6 +26,7 @@ "MEArecRecordingInterface", "PlexonRecordingInterface", "PlexonSortingInterface", - "AxonaRecordingInterface" + "AxonaRecordingInterface", + "NeuralynxRecordingInterface" ] } diff --git a/schemas/json/generated/NeuralynxRecordingInterface.json b/schemas/json/generated/NeuralynxRecordingInterface.json new file mode 100644 index 000000000..dfd28cada --- /dev/null +++ b/schemas/json/generated/NeuralynxRecordingInterface.json @@ -0,0 +1,36 @@ +{ + "required": [], + "properties": { + "NeuralynxRecordingInterface": { + "required": [ + "folder_path" + ], + "properties": { + "folder_path": { + "format": "directory", + "type": "string" + }, + "stream_name": { + "type": "string" + }, + "verbose": { + "type": "boolean", + "default": false + }, + "es_key": { + "type": "string", + "default": "ElectricalSeries" + } + }, + "type": "object", + "additionalProperties": false + } + }, + "type": "object", + "additionalProperties": false, + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "source.schema.json", + "title": "Source data schema", + "description": "Schema for the source data, files and directories", + "version": "0.1.0" +} diff --git a/src/renderer/src/stories/FileSystemSelector.js b/src/renderer/src/stories/FileSystemSelector.js index 5bdc10c9d..fc94871fe 100644 --- a/src/renderer/src/stories/FileSystemSelector.js +++ b/src/renderer/src/stories/FileSystemSelector.js @@ -1,6 +1,6 @@ import { LitElement, css, html } from "lit"; -import { remote } from "../electron/index"; +import { fs, remote } from "../electron/index"; const { dialog } = remote; function getObjectTypeReferenceString(type, multiple, { nested, native } = {}) { @@ -126,7 +126,7 @@ export class FilesystemSelector extends LitElement { }; #checkType = (value) => { - const isLikelyFile = value.split(".").length !== 1; + const isLikelyFile = fs ? fs.lstatSync(value).isFile() : value.split(".").length; if ((this.type === "directory" && isLikelyFile) || (this.type === "file" && !isLikelyFile)) this.#onThrow("Incorrect filesystem object", `Please provide a ${this.type} instead.`); }; @@ -150,8 +150,6 @@ export class FilesystemSelector extends LitElement { if (this.multiple && !Array.isArray(resolvedValue)) resolvedValue = []; - console.log(resolvedValue); - this.value = resolvedValue; this.onSelect(this.value); const event = new Event("change"); // Create a new change event diff --git a/src/renderer/src/stories/pages/guided-mode/SourceData.stories.js b/src/renderer/src/stories/pages/guided-mode/SourceData.stories.js index c2cd8d6cb..002750aa9 100644 --- a/src/renderer/src/stories/pages/guided-mode/SourceData.stories.js +++ b/src/renderer/src/stories/pages/guided-mode/SourceData.stories.js @@ -26,6 +26,7 @@ import MEArecRecordingInterfaceSchema from "../../../../../../schemas/json/gener import PlexonRecordingInterfaceSchema from "../../../../../../schemas/json/generated/PlexonRecordingInterface.json"; import PlexonSortingInterfaceSchema from "../../../../../../schemas/json/generated/PlexonSortingInterface.json"; import AxonaRecordingInterfaceSchema from "../../../../../../schemas/json/generated/AxonaRecordingInterface.json"; +import NeuralynxRecordingInterfaceSchema from "../../../../../../schemas/json/generated/NeuralynxRecordingInterface.json"; export default { title: "Pages/Guided Mode/Source Data", @@ -91,6 +92,8 @@ globalStateCopy.schema.source_data.properties.PlexonSortingInterface = PlexonSortingInterfaceSchema.properties.PlexonSortingInterface; globalStateCopy.schema.source_data.properties.AxonaRecordingInterface = AxonaRecordingInterfaceSchema.properties.AxonaRecordingInterface; +globalStateCopy.schema.source_data.properties.NeuralynxRecordingInterface = + NeuralynxRecordingInterfaceSchema.properties.NeuralynxRecordingInterface; const results = globalStateCopy.results; for (let sub in results) { @@ -265,3 +268,9 @@ const AxonaRecordingInterfaceGlobalCopy = JSON.parse(JSON.stringify(globalState) AxonaRecordingInterfaceGlobalCopy.interfaces.interface = AxonaRecordingInterface; AxonaRecordingInterfaceGlobalCopy.schema.source_data = AxonaRecordingInterfaceSchema; AxonaRecordingInterface.args = { activePage, globalState: AxonaRecordingInterfaceGlobalCopy }; + +export const NeuralynxRecordingInterface = PageTemplate.bind({}); +const NeuralynxRecordingInterfaceGlobalCopy = JSON.parse(JSON.stringify(globalState)); +NeuralynxRecordingInterfaceGlobalCopy.interfaces.interface = NeuralynxRecordingInterface; +NeuralynxRecordingInterfaceGlobalCopy.schema.source_data = NeuralynxRecordingInterfaceSchema; +NeuralynxRecordingInterface.args = { activePage, globalState: NeuralynxRecordingInterfaceGlobalCopy }; diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedSourceData.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedSourceData.js index 615ade642..40454e18d 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedSourceData.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedSourceData.js @@ -109,12 +109,8 @@ export class GuidedSourceDataPage extends ManagedPage { const schema = this.info.globalState.schema.source_data; delete schema.description; - console.log("Schema", schema); - const schemaResolved = getSourceDataSchema(schema); - console.log("Schema", schemaResolved); - const form = new JSONSchemaForm({ identifier: instanceId, mode: "accordion",