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

[Frontend Refactor I] Reorganize core folders #792

Merged
merged 15 commits into from
May 24, 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
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ coverage
# Ignore node_modules folder
node_modules
build/api
pyflask/ds
src/Users
src/pyflask/ds
semantic
semantic.json
.env
build/
yarn.lock

*.pyc
src/.DS_Store
.DS_Store
electron-builder.yml
website/.eslintcache
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="src/renderer/assets/img/logo-guide-draft-transparent-tight.png" width="250" alt="NeuroConv logo"/>
<img src="src/electron/renderer/assets/img/logo-guide-draft-transparent-tight.png" width="250" alt="NeuroConv logo"/>
<h3 align="center">NWB Graphical User Interface for Data Entry</h3>
<p align="center">
<a href="https://github.com/NeurodataWithoutBorders/nwb-guide/actions/workflows/testing.yml"><img src="https://github.com/NeurodataWithoutBorders/nwb-guide/actions/workflows/testing.yml/badge.svg" alt="Full Tests"></a>
Expand Down
2 changes: 1 addition & 1 deletion demos/sse/test_sse_display_of_tqdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from flask import Flask, Response, render_template
from tqdm import tqdm as base_tqdm

SCRIPT_DIR = os.path.dirname(os.path.abspath(os.path.join(__file__, "..", "..", "pyflask")))
SCRIPT_DIR = os.path.dirname(os.path.abspath(os.path.join(__file__, "..", "..", "src", "pyflask")))
sys.path.append(os.path.dirname(SCRIPT_DIR))
from pyflask.manageNeuroconv.info.sse import MessageAnnouncer

Expand Down
23 changes: 14 additions & 9 deletions docs/developer_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,20 @@ You can now run the following command to start the application using Electron.

Repo Structure
--------------
1. **src/renderer/src** - Contains all the source code for the frontend
- `index.js` - The entry point for the application
- `pages.js` - The main code that controls which pages are rendered and how they are linked together
- `stories` - Contains all the Web Components and related Storybook stories
- `electron` - Contains all the Electron-related code to enable conditional inclusion for development mode
2. **src/renderer/assets** - Contains all the frontend-facing assets (e.g. images, css, etc.)
3. **pyflask** - Contains all the source code for the backend


- `src`
- `electron`
- `main`
- `src` - Contains all the source code for the backend
- `assets` - Contains all the backend-facing assets (e.g. images, css, etc.)
- `renderer`
- `src` - Contains all the source code for the frontend
- `index.js` - The entry point for the application
- `pages.js` - The main code that controls which pages are rendered and how they are linked together
- `stories` - Contains all the Web Components and related Storybook stories
- `electron` - Contains all the Electron-related code to enable conditional inclusion for development mode
- `assets` - Contains all the frontend-facing assets (e.g. images, css, etc.)
- `pyflask` - Contains all the source code for the backend
- `schemas` - Contains all the JSON schemas used for validation


Starting a New Feature
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ NWB GUIDE documentation
=======================
|

.. image:: ../src/renderer/assets/img/logo-guide-draft-transparent-tight.png
.. image:: ../src/electron/renderer/assets/img/logo-guide-draft-transparent-tight.png
:scale: 50 %
:align: center
:alt: NWB GUIDE logo
Expand Down
36 changes: 33 additions & 3 deletions electron.vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,41 @@ import { defineConfig } from "electron-vite";

import ViteYaml from "@modyfi/vite-plugin-yaml";

// electron.vite.config.js
import { resolve } from "path";

const htmlRoot = "src/electron/renderer";

export default defineConfig({
main: {},
preload: {},
main: {
build: {
rollupOptions: {
input: {
index: resolve(__dirname, "src/electron/main/main.ts"),
},
},
},
},
preload: {
build: {
rollupOptions: {
input: {
index: resolve(__dirname, "src/electron/preload/preload.js"),
},
},
},
},
renderer: {
root: `./${htmlRoot}`,
plugins: [ViteYaml()],
build: {
rollupOptions: {
input: {
index: resolve(__dirname, htmlRoot, "index.html"),
},
output: {
dir: resolve(__dirname, "build", "renderer"),
},
},
},
},
});
2 changes: 0 additions & 2 deletions environments/environment-Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ channels:
- defaults
dependencies:
- python = 3.9.18
- PyInstaller = 6.3.0
- nodejs = 18.16.1
- numcodecs = 0.11.0
# install these from conda-forge so that dependent packages get included in the distributable
- jsonschema = 4.18.0 # installs jsonschema-specifications
- pip
- pip:
- pyinstaller-hooks-contrib == 2024.2 # Fix needed for pydantic v2; otherwise imports pydantic.compiled
- chardet == 5.1.0
- configparser == 6.0.0
- flask == 2.3.2
Expand Down
3 changes: 2 additions & 1 deletion environments/environment-MAC-apple-silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ channels:
- defaults
dependencies:
- python = 3.9.18
- PyInstaller = 6.3.0
- nodejs = 18.16.1
- numcodecs = 0.11.0
- lxml = 4.9.3 # pypi build fails due to x64/arm64 mismatch so install from conda-forge
Expand All @@ -15,6 +14,8 @@ dependencies:
- jsonschema = 4.18.0 # installs jsonschema-specifications
- pip
- pip:
- setuptools==70.0.0
- PyInstaller==6.7.0
- chardet == 5.1.0
- configparser == 6.0.0
- flask == 2.3.2
Expand Down
3 changes: 2 additions & 1 deletion environments/environment-MAC-intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ channels:
- defaults
dependencies:
- python = 3.9.18
- PyInstaller = 6.3.0
- nodejs = 18.16.1
- numcodecs = 0.11.0
# install these from conda-forge so that dependent packages get included in the distributable
- jsonschema = 4.18.0 # installs jsonschema-specifications
- pip
- pip:
- setuptools==70.0.0
- PyInstaller==6.7.0
- scipy<1.12.0 # Fix needed for scipy._lib._testutils
- chardet == 5.1.0
- configparser == 6.0.0
Expand Down
5 changes: 3 additions & 2 deletions environments/environment-Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ channels:
dependencies:
- python = 3.9.17
- nodejs = 18.16.1
- PyInstaller = 6.3.0
- pywin32 = 303
- git = 2.20.1
- setuptools = 58.0.4
- pip
- pip:
- pyinstaller-hooks-contrib == 2024.2 # Fix needed for pydantic v2; otherwise imports pydantic.compiled
- setuptools==70.0.0
- PyInstaller==6.7.0
- pyinstaller-hooks-contrib == 2024.6 # Fix needed for pydantic v2; otherwise imports pydantic.compiled
- chardet == 5.1.0
- configparser == 6.0.0
- flask == 2.3.2
Expand Down
8 changes: 4 additions & 4 deletions generateInterfaceSchema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

from neuroconv import NWBConverter, converters, datainterfaces

filepath = Path("guideGlobalMetadata.json")
filepath = Path("src") / "supported_interfaces.json"
generatedJSONSchemaPath = Path("schemas", "json", "generated")
generatedJSONSchemaPath.mkdir(exist_ok=True, parents=True)

f = filepath.open()
data = json.load(f)
supported_interfaces = json.load(f)

# Create JSON for the Schema
paths = {}
for interface in data["supported_interfaces"]:
for interface in supported_interfaces:
interface_class_dict = {interface: interface}

class CustomNWBConverter(NWBConverter):
Expand All @@ -29,7 +29,7 @@ class CustomNWBConverter(NWBConverter):
outfile.write(json.dumps(schema, indent=4))


sourceDataStoryPath = Path("src/renderer/src/stories/pages/guided-mode/SourceData.stories.js")
sourceDataStoryPath = Path("src/electron/renderer/src/stories/pages/guided-mode/SourceData.stories.js")

importCode = "\n".join(map(lambda arr: f"import {arr[0]}Schema from '../../../../../../{arr[1]}'", paths.items()))
storyCode = "\n".join(
Expand Down
50 changes: 0 additions & 50 deletions guideGlobalMetadata.json

This file was deleted.

Loading
Loading