Skip to content

Commit

Permalink
Fix interface and scope the developer settings
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmflynn committed Jan 23, 2024
1 parent 5db8e9a commit ac2596f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 26 deletions.
4 changes: 2 additions & 2 deletions guide_testing_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ pipelines:
folder_path: ephy_testing_data/phy/phy_example_0

SpikeGLX-v1-SingleProbe-AP:
SpikeGLXDataInterface:
file_path: ephy_testing_data/spikeglx/Noise4Sam_g0/Noise4Sam_g0_imec0/Noise4Sam_g0_t0.imec0.ap.bin
SpikeGLXRecordingInterface:
file_path: ephy_testing_data/spikeglx/Noise4Sam_g0/Noise4Sam_g0_imec0/Noise4Sam_g0_t0.imec0.ap.bin
File renamed without changes.
64 changes: 40 additions & 24 deletions src/renderer/src/stories/pages/settings/SettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Page } from "../Page.js";
import { onThrow } from "../../../errors";
import dandiGlobalSchema from "../../../../../../schemas/json/dandi/global.json";
import projectGlobalSchema from "../../../../../../schemas/json/project/globals.json" assert { type: "json" };
import guideGlobalSchema from "../../../../../../schemas/json/globals.json" assert { type: "json" };
import developerGlobalSchema from "../../../../../../schemas/json/developer/globals.json" assert { type: "json" };

import { validateDANDIApiKey } from "../../../validation/dandi";

Expand Down Expand Up @@ -84,10 +84,17 @@ function saveNewPipelineFromYaml(name, sourceData, rootFolder) {
}

const schema = merge(
merge(projectGlobalSchema, guideGlobalSchema),
projectGlobalSchema,
{
properties: {
DANDI: dandiGlobalSchema,
DANDI: {
title: "DANDI Settings",
...dandiGlobalSchema
},
developer: {
title: "Developer Settings",
...developerGlobalSchema
},
},
required: ["DANDI"],
},
Expand Down Expand Up @@ -133,6 +140,7 @@ export class SettingsPage extends Page {
this.#openNotyf(`Global settings changes saved.`, "success");
};


render() {
this.localState = structuredClone(global.data);

Expand All @@ -149,31 +157,39 @@ export class SettingsPage extends Page {
onThrow,
});

return html`
<p><b>Server Port:</b> ${port}</p>
<p><b>Server File Location:</b> ${SERVER_FILE_PATH}</p>
${new Button({
label: "Generate Test Pipelines",
onClick: async () => {
const { testing_data_folder } = this.form.results;

if (!testing_data_folder)
return this.#openNotyf(
`Please specify a testing data folder before attempting to generate pipelines.`,
"error"
);
const generatePipelineButton = new Button({
label: "Generate Test Pipelines",
onClick: async () => {
const { testing_data_folder } = this.form.results.developer ?? {};

const { pipelines = {} } = testingSuiteYaml;
if (!testing_data_folder)
return this.#openNotyf(
`Please specify a testing data folder in the Developer section before attempting to generate pipelines.`,
"error"
);

const pipelineNames = Object.keys(pipelines);
const nPipelines = pipelineNames.length;
pipelineNames
.reverse()
.forEach((name) => saveNewPipelineFromYaml(name, pipelines[name], testing_data_folder));
const { pipelines = {} } = testingSuiteYaml;

this.#openNotyf(`Generated ${nPipelines} test pipelines`, "success");
},
})}
const pipelineNames = Object.keys(pipelines);
const nPipelines = pipelineNames.length;
pipelineNames
.reverse()
.forEach((name) => saveNewPipelineFromYaml(name, pipelines[name], testing_data_folder));

this.#openNotyf(`Generated ${nPipelines} test pipelines`, "success");
},
})

setTimeout(() => {
const testFolderInput = this.form.getInput(["developer", "testing_data_folder"]);
console.log(testFolderInput)
testFolderInput.after(generatePipelineButton);
}, 100)

return html`
<p><b>Server Port:</b> ${port}</p>
<p><b>Server File Location:</b> ${SERVER_FILE_PATH}</p>
<hr />
<br />
${this.form}
Expand Down

0 comments on commit ac2596f

Please sign in to comment.