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

[Refactor Flask II] Break up top-level #799

Merged
merged 15 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
28 changes: 14 additions & 14 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module.exports = {
arrowParens: "always",
bracketSameLine: false,
bracketSpacing: true,
embeddedLanguageFormatting: "auto",
endOfLine: "auto",
htmlWhitespaceSensitivity: "css",
printWidth: 120, // to match black
quoteProps: "as-needed",
semi: true,
singleQuote: false,
tabWidth: 4, // to match Python
trailingComma: "es5",
useTabs: false,
vueIndentScriptAndStyle: false,
arrowParens: "always",
bracketSameLine: false,
bracketSpacing: true,
embeddedLanguageFormatting: "auto",
endOfLine: "crlf",
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
htmlWhitespaceSensitivity: "css",
printWidth: 120, // to match black
quoteProps: "as-needed",
semi: true,
singleQuote: false,
tabWidth: 4, // to match Python
trailingComma: "es5",
useTabs: false,
vueIndentScriptAndStyle: false,
};
4 changes: 2 additions & 2 deletions src/electron/renderer/src/server/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const activateServer = () => {
export const serverGlobals = {
species: new Promise((res, rej) => {
onServerOpen(() => {
fetch(new URL("get-recommended-species", baseUrl))
fetch(new URL("dandi/get-recommended-species", baseUrl))
.then((res) => res.json())
.then((species) => {
res(species)
Expand All @@ -67,7 +67,7 @@ export const serverGlobals = {
}),
cpus: new Promise((res, rej) => {
onServerOpen(() => {
fetch(new URL("cpus", baseUrl))
fetch(new URL("system/cpus", baseUrl))
.then((res) => res.json())
.then((cpus) => {
res(cpus)
Expand Down
93 changes: 49 additions & 44 deletions src/electron/renderer/src/stories/pages/preview/PreviewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,56 @@ import { Neurosift } from "../../preview/Neurosift.js";
import { baseUrl } from "../../../server/globals";

export class PreviewPage extends Page {
header = {
title: "NWB File Exploration",
subtitle: "Visualize your NWB file using Neurosift.",
};

constructor(...args) {
super(...args);
this.style.height = "100%"; // Fix main section
header = {
title: "NWB File Exploration",
subtitle: "Visualize your NWB file using Neurosift.",
};

constructor(...args) {
super(...args);
this.style.height = "100%"; // Fix main section
}

updatePath = async (path) => {
if (path) {
const result = await fetch(`${baseUrl}/neurosift/files/${path}`, {
method: "POST",
}).then((res) => res.text());
if (result) this.neurosift.url = result;
} else this.neurosift.url = undefined;
};

neurosift = new Neurosift();

input = new JSONSchemaInput({
path: ["file_path"],
schema: {
type: "string",
format: "file",
description:
"Please provide a file path that you'd like to visualize using Neurosift. The GUIDE will serve this file and access the appropriate URL automatically.",
},
onUpdate: this.updatePath,
onThrow,
});

render() {
const urlFilePath = new URL(document.location).searchParams.get("file");

if (urlFilePath) {
this.updatePath(urlFilePath);
this.input.value = urlFilePath;
}

updatePath = async (path) => {
if (path) {
const result = await fetch(`${baseUrl}/files/${path}`, { method: "POST" }).then((res) => res.text());
if (result) this.neurosift.url = result;
} else this.neurosift.url = undefined;
};

neurosift = new Neurosift();

input = new JSONSchemaInput({
path: ["file_path"],
schema: {
type: "string",
format: "file",
description:
"Please provide a file path that you'd like to visualize using Neurosift. The GUIDE will serve this file and access the appropriate URL automatically.",
},
onUpdate: this.updatePath,
onThrow,
});

render() {
const urlFilePath = new URL(document.location).searchParams.get("file");

if (urlFilePath) {
this.updatePath(urlFilePath);
this.input.value = urlFilePath;
}

return html`
<div style="display: grid; width: 100%; height: 100%; grid-template-rows: min-content 1fr; gap: 10px;">
${this.input} ${this.neurosift}
</div>
`;
}
return html`
<div
style="display: grid; width: 100%; height: 100%; grid-template-rows: min-content 1fr; gap: 10px;"
>
${this.input} ${this.neurosift}
</div>
`;
}
}

customElements.get("nwbguide-preview-page") || customElements.define("nwbguide-preview-page", PreviewPage);
customElements.get("nwbguide-preview-page") ||
customElements.define("nwbguide-preview-page", PreviewPage);
Loading
Loading