2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-12 10:05:39 +00:00

Platform UI - React integration (#5011)

* Add SPA views for react #2789

* split up frontend urls

* Add settings for frontend url loading

* add new UI scaffold

* remove tracking insert

* add platform app

* ensure static indexes work too

* add lingui

* add lingui config

* add mgmt tasks

* add base locales

* settings for frontend dev

* fix typo

* update deps

* add pre-commit

* add eslint

* add testing scaffold

* fix paths

* remove error - tests trip correctly

* merge workflow

* cleanup samples

* use name inline with other tests

* Add real worl frontend tests

* setup env

* tun migrations first

* optimize setup time

* setup demo dataset

* optimize run setup

* add test for class ui

* rename

* fix typo

* and another typo

* do install

* run migrations first

* fix name

* cleanup

* use other credentials

* use other credentials

* fix qc

* move envs to qc

* remove create_site

* reduce testing env

* fix test

* fix test call

* allaccess user

* add ui plattform check

* add better check

* remove unneeded env

* enable debug

* reduce wait time

* also build frontend on static

* add sort plugin

* fix order

* run pre-commit fixes

* add node min version

* Docker container (#129)

* Fix allocation check for completing build order (#5199)

- Allocation check only applies to untracked line items

* docker dev

Install required node packages to docker development image

* add import order settings

* cleanout built ui

* remove default arg from build

* remove eslint

* optimize svg

* add build step for plattform UI

* fix install command

* use alpine commands

* do not use cache when creating image

---------

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
Matthias Mair
2023-07-18 14:45:49 +02:00
committed by GitHub
parent b717011f06
commit 3e37469350
44 changed files with 2817 additions and 7 deletions

View File

@ -89,6 +89,19 @@ def manage(c, cmd, pty: bool = False):
), pty=pty)
def yarn(c, cmd, pty: bool = False):
"""Runs a given command against the yarn package manager.
Args:
c: Command line context.
cmd: Yarn command to run.
pty (bool, optional): Run an interactive session. Defaults to False.
"""
path = managePyDir().parent.joinpath('src').joinpath('frontend')
c.run(f'cd "{path}" && {cmd}', pty=pty)
def check_file_existance(filename: str, overwrite: bool = False):
"""Checks if a file exists and asks the user if it should be overwritten.
@ -188,6 +201,7 @@ def remove_mfa(c, mail=''):
def static(c):
"""Copies required static files to the STATIC_ROOT directory, as per Django requirements."""
manage(c, "prerender")
frontend_build(c)
manage(c, "collectstatic --no-input")
@ -290,6 +304,9 @@ def update(c, skip_backup=False):
# Perform database migrations
migrate(c)
# Compile frontend
frontend_compile(c)
# Data tasks
@task(help={
@ -697,3 +714,50 @@ You are probably running the package installer / single-line installer. Please m
Use '--list' for a list of available commands
Use '--help' for help on a specific command""")
@task
def frontend_compile(c):
"""Generate react frontend.
Args:
c: Context variable
"""
frontend_install(c)
frontend_trans(c)
frontend_build(c)
@task
def frontend_install(c):
"""Install frontend requirements.
Args:
c: Context variable
"""
print("Installing frontend dependencies")
yarn(c, "yarn install")
@task
def frontend_trans(c):
"""Compile frontend translations.
Args:
c: Context variable
"""
print("Compiling frontend translations")
yarn(c, "yarn run extract")
yarn(c, "yarn run compile")
@task
def frontend_build(c):
"""Build frontend.
Args:
c: Context variable
"""
print("Building frontend")
yarn(c, "yarn run build --emptyOutDir")