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

Support new React Interface #44

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9b5ef2e
Add basic react / mantine setup
SchrodingersGat Sep 30, 2024
83b14f3
Provide render context to panel
SchrodingersGat Sep 30, 2024
4579e84
Improve rendering of frontend-panel
SchrodingersGat Sep 30, 2024
002bc17
Remove backend rendering
SchrodingersGat Sep 30, 2024
9521223
Add TODO
SchrodingersGat Sep 30, 2024
f628f94
Update README.md
SchrodingersGat Sep 30, 2024
10e23aa
Add context to main.tsx
SchrodingersGat Sep 30, 2024
09df809
Tweak index.html
SchrodingersGat Sep 30, 2024
5c44828
Remove untracked files
SchrodingersGat Sep 30, 2024
aea09fd
Fix static file path
SchrodingersGat Sep 30, 2024
8881dd6
remove custom color switch
SchrodingersGat Sep 30, 2024
264afff
Add simple workflow to build frontend code
SchrodingersGat Sep 30, 2024
48af785
Update node version
SchrodingersGat Sep 30, 2024
9239c89
Remove unused import
SchrodingersGat Sep 30, 2024
01e15b1
Remove unused files
SchrodingersGat Sep 30, 2024
b614025
Restructure
SchrodingersGat Sep 30, 2024
e507c39
setup changes
SchrodingersGat Sep 30, 2024
a378629
Build frontend as part of install script
SchrodingersGat Sep 30, 2024
e33445c
Reorganize again, so that MANIFEST.in works
SchrodingersGat Sep 30, 2024
c429854
Cleanup .gitignore file
SchrodingersGat Sep 30, 2024
5bf6a00
adjust workflows
SchrodingersGat Sep 30, 2024
84818ce
Working, maybe?
SchrodingersGat Sep 30, 2024
abacd35
Adjust workflow files
SchrodingersGat Sep 30, 2024
3406881
Remove compiled files
SchrodingersGat Sep 30, 2024
7751863
Update .gitignore
SchrodingersGat Sep 30, 2024
41c8007
Hack for setup.py
SchrodingersGat Sep 30, 2024
683bdfc
FIx for source file
SchrodingersGat Sep 30, 2024
ff5734a
Fix npm build output dir
SchrodingersGat Sep 30, 2024
9c90623
Add custom settings UI elements
SchrodingersGat Oct 1, 2024
aafff67
Updates to match InvenTree code
SchrodingersGat Oct 16, 2024
8d1b2fd
Fix return data
SchrodingersGat Oct 16, 2024
302bacf
Add icon
SchrodingersGat Nov 19, 2024
22e32c7
Fix typo
SchrodingersGat Nov 19, 2024
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
21 changes: 21 additions & 0 deletions .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Run CI checks for frontend code
name: Frontend CI

on: ["push", "pull_request"]

jobs:
frontend:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "18"
- name: Build Frontend
run: |
cd frontend
npm install
npm run build --emptyOutDir
13 changes: 11 additions & 2 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,24 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "18"
- name: Install Python Dependencies
run: |
pip install --upgrade wheel setuptools twine
- name: Build Frontend
run: |
cd frontend
npm install
npm run build --emptyOutDir
- name: Build Binary
run: |
python3 setup.py sdist bdist_wheel --universal
python -m build
- name: Publish
run: |
python3 -m twine upload dist/*
python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,5 @@ celerybeat.pid
# SageMath parsed files
*.sage.py

# Compiled static files (copied from frontend/dist/static as part of setup.py)
inventree_wireviz/static
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
recursive-include inventree_wireviz/templates *
recursive-include inventree_wireviz/templates *.js *.html
recursive-include inventree_wireviz/static *.js *.css
25 changes: 25 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.tsbuildinfo
31 changes: 31 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Wireviz Plugin - Frontend Code

This directory contains the frontend code for the Wireviz plugin.

## Development

This project uses [Vite](https://vitejs.dev/) as the build tool. We followed [this guide](https://vitejs.dev/guide/#scaffolding-your-first-vite-project) to scaffold the project.

## Building

To compile the frontend code, run:

```bash
npm run build --emptyOutDir
```

This will compile the frontend code into the `../inventree_wireviz/static` directory.

Note: The target directory is intentionally outside of hte frontend directory, so that the compiled files are correctly bundled into the python package install.

## Testing

To test the frontend code, run:

```bash
npm run dev
```

This will start a development server (usually on `localhost:5173`) which will automatically reload when changes are made to the source code.

The development server provides some "dummy" harness data to test the frontend code.
28 changes: 28 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
12 changes: 12 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>InvenTree Wireviz - Developer View</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading
Loading