Commit Graph

63 Commits

Author SHA1 Message Date
Matthias Mair
0bace3f3af
Code structure refactor (#5582)
* moved docker files to /contrib/container

* changed code owners to make more precise

* updated CI to use new subdirs

* added manual trigger for testing

* moved ci files

* moved assets into subdir

* moved deploy template file to contrib

* moved django files to src/backend

* updated paths in scripts etc

* updated reqs path

* fixed version file path

* fixed flake8 path

* fixed path to node ressources

* fixed task paths

* added dep path for node

* removed unused yarn lockfile

* removed unused ci script

* updated internal backend paths for tasks

* updated translation stats path

* fixed source path for coverage

* fixed main commit repo path

* fit in changes from testing

* gather packager improvements (#149)

* Matmair/issue5578 (#143)

* moved docker files to /contrib/container

* changed code owners to make more precise

* updated CI to use new subdirs

* added manual trigger for testing

* moved ci files

* moved assets into subdir

* moved deploy template file to contrib

* moved django files to src/backend

* updated paths in scripts etc

* updated reqs path

* fixed version file path

* fixed flake8 path

* fixed path to node ressources

* fixed task paths

* added dep path for node

* removed unused yarn lockfile

* removed unused ci script

* updated internal backend paths for tasks

* updated translation stats path

* fixed source path for coverage

* fixed main commit repo path

* fix docker path

* use project dir

* move project dir command

* fixed docker paths

* another fix?

* seperate tasks out

* remove tasks

* some debugging

* ci: add .deepsource.toml

* Update .deepsource.toml

* also ignore migrations

* more debugging

* fix path issues

* remove debug script

* fix style

* change locale path

* Fixed paths for requirements

* Added dummy requirements to fool packager

* fixed exec path

* remove deepsource

---------

Co-authored-by: deepsource-io[bot] <42547082+deepsource-io[bot]@users.noreply.github.com>

* Added docs for file structure

* Fixed style errors

* updated deepsource paths

* fix deepsource paths

* fixed reqs

* merge fixes

* move newly added dirs too

* fix reqs files

* another dep fix

* merge upstream/master

* revert removal of tags

* merge upstream

* enabled detection of old config files

* adapt coverage src

* also detect and support old location for plugins.txt

* style fix

* fix ~/init.sh location

* fix requirements path

* fix config to current master

* move new folders

* fix import order

* fix paths for qc_check

* fix docs build

* fix fix path

* set docker project dir

* just use a cd

* set image path?

* set file correct

* fix copy path

* fix tasks dir

* fix init path

* fix copy path

* set prject dir

* fix paths

* remove old prod files

* fix dev env path

* set docker file

* Fix devcontainer docker compose file

* fix login attempt values

* fix init.sh path

* Fix pathing for Docker

* Docker build fix

- Set INVENTREE_BACKEND_DIR separately

* Update init.sh

* Fix path

* Update requirements.txt

* merge

* fix rq merge

* fix docker compose usage

---------

Co-authored-by: deepsource-io[bot] <42547082+deepsource-io[bot]@users.noreply.github.com>
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
2024-04-03 12:16:59 +11:00
Oliver
39ba25c5ed
Render API docs (#6463)
* Render API docs

* Cleanup broken links

* Re-enable strict mode

* Change json to yaml

* Update docs/docs/api/schema.md

Co-authored-by: Matthias Mair <code@mjmair.com>

* Update docs/docs/api/schema.md

Co-authored-by: Matthias Mair <code@mjmair.com>

* Use neoteroi-mkdocs instead

- seems to render more reliably

* Fix SERVERS section for SPECTACTULAR_SETTINGS

* Script for splitting schema into smaller sections

* Generate an index file for the schema pages

* Move schema.md up one directory

* Fix formatting

* Remove tracked file

* Add hook for rebuilding API schema as part of RTD build

* Extract schema as RTD build step

* install invoke

* export env vars

* remove argparse

* Fix order of operations

* Compress env vars

* Remove custom env vars

- Now configured as part of RTD project

* Migrate db

* Revert "remove argparse"

This reverts commit 4665805340.

* Post-process generated schema file

* Fix file formatting

* Add note about schema repo

* no message

* Reduce schema overhead

* Ignore generated files

* Delete generated file

* Update .gitignore

* Add extra split for machine integration

* Remove schema files

- These will be auto-generated too

* Generate individual schema .md files

* Re-add .md files

- Need git commit log to work

* Update .gitignore

* Fix for CI test

* patch machine.api

* Revert previous change

* Formatting fix

* Adjust export step

* Bump API version

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
2024-03-02 11:28:37 +11:00
Matthias Mair
85225538e6
Create test files in seperate folder & cleanup before image build (#6571)
* move ignore

* create testfiles in seperate folder

* add cleanup step to docker build

* use pathlib for paths
2024-02-26 11:23:49 +11:00
Oliver
af4d888b1b
Generate API docs (#6319)
* Add basic task for generating apidocs

* Fix SPECTACTULAR_SETTINGS

- Some provided options were not correct

* Update .gitignore

* Fix for duplicated API path

- `/api/plugins/activate` routed to PluginActivate view
- Must be associated with a specific plugin ID

* By default, fail if warnings are raised

* Use GenericAPIView for GetAuthToken

* Use GenericAPIView for RolesDetail endpoint

* Refactor more endpoints to use GenericApiView

* More API cleanup

* Add extra type hints for exposed methods

* Update RoleDetails endpoint

- Specify serializer
- Use RetrieveAPI class type

* More type hints

* Export API docs as part of CI

* add more api views docs

* even more docs

* extend tests to api-version

* simplify serializer

* and more docs

* fix serializer

* added more API docs

* clean diff

* Added APISearch base

* do not assume you know the user
he might be anonymously creating the schema ;-)

* set empty serializer where no input is needed

* Use dummy model for schema generation

* fix OpenAPI docs section

* Update .github/workflows/qc_checks.yaml

Co-authored-by: Matthias Mair <code@mjmair.com>

* REmove duplicate commands

* Ignore warnings in CI

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
2024-02-08 16:19:57 +11:00
Oliver
7d36049ac9
[React] UI Translation Updates (#6257)
* Move locales definition into separate file

- Cleanup settings.py a bit

* Update docstring

* Expose 'default_locale' to info API endpoint

* Validate settings.LANGUAGE_CODE

* Fix bug in BuildDetail page

* Use selected language when making API queries

* Translate more strings

* Tweak variable name

* Update locale config

* Remove duplicate code

* Remove compiled messages.ts translation files

* Fixes for LanguageContext.tsx

* Update messages.d.ts for sr locale

* Ensure compiled files are served by django runserver

* Amend changes to STATICFILES_DIRS

* Cleanup prerender.py

* Refetch status codes when locale is changed

* Fix log msg

* Clear out old static files
2024-01-17 16:29:06 +11:00
Oliver
75f75ed820
Tasks API Endpoint (#6230)
* Add API endpoint for background task overview

* Cleanup other pending heartbeat tasks

* Adds API endpoint for queued tasks

* Adds API endpoint for scheduled tasks

* Add API endpoint for failed tasks

* Update API version info

* Add table for displaying pending tasks

* Add failed tasks table

* Use accordion

* Annotate extra data to scheduled tasks serializer

* Extend API functionality

* Update tasks.py

- Allow skipping of static file step in "invoke update"
- Allows for quicker updates in dev mode

* Display task result error for failed tasks

* Allow delete of failed tasks

* Remove old debug message

* Adds ability to delete pending tasks

* Update table columns

* Fix unused imports

* Prevent multiple heartbeat functions from being added to the queue at startup

* Add unit tests for API
2024-01-17 07:10:42 +11:00
Oliver
fb42878c11
Give the people what they want (#6021)
* Add 'existing_image' field to part API serializer

* Ensure that the specified directory exists

* Fix serializer

- Use CharField instead of FilePathField
- Custom validation
- Save part with existing image

* Add unit test for new feature

* Bump API version
2023-12-02 18:52:50 +11:00
Oliver
45aa8c39b3
React tweaks (#5300)
* Add .gitignore for static web files

* Add invoke task to start frontend dev server
2023-07-21 09:46:44 +10:00
Oliver
e8d16298a4
Label plugin refactor (#5251)
* Add skeleton for builtin label printing plugin

* Force selection of plugin when printing labels

* Enhance LabelPrintingMixin class

- Add render_to_pdf method
- Add render_to_html method

* Enhance plugin mixin

- Add class attribute to select blocking or non-blocking printing
- Add render_to_png method
- Add default method for printing multiple labels
- Add method for offloding print job

* Simplify print_label background function

- All arguments now handled by specific plugin

* Simplify label printing API

- Simply pass data to the particular plugin
- Check result type
- Return result

* Updated sample plugin

* Working on client side code

* Cleanup

* Update sample plugin

* Add new model type

- LabelOutput model
- Stores generated label file to the database
- Makes available for download

* Update label printing plugin mixin

* Add background task to remove any old label outputs

* Open file if response contains filename

* Remove "default printer" option which does not specify a plugin

* Delete old labels after 5 days

* Remove debug statements

* Update API version

* Changed default behaviour to background printing

* Update label plugin mixin docs

* Provide default printer if none provided (legacy)

* Update unit test

* unit test updates

* Further fixes for unit tests

* unit test updates
2023-07-17 21:39:53 +10:00
Lukas
4d9e92011e
Fix/settings bugs and added model SettingKeyType typing (#4944)
* fix .gitignore and spelling issues

* Fix setting get not cached correctly

* Add model to settings key type

* Fix plugin setting slug url

* Fix typo

* Fix resetting of related setting field

* Improved model comment
2023-06-01 23:53:06 +10:00
Oliver
2ffd2354eb
Documentation integration (#4653)
* Add documentation under docs/ directory

* Add CI workflow for mkdocs configuration checking

* Add documentation issue template

* update pip-tools?

* Update .gitignore files

* Fix .gitignore rules

* Improve release notes page

* remove references to old repo
2023-04-22 22:40:29 +10:00
Oliver
abeb85cbb3
Extend functionality of custom validation plugins (#4391)
* Pass "Part" instance to plugins when calling validate_serial_number

* Pass part instance through when validating IPN

* Improve custom part name validation

- Pass the Part instance through to the plugins
- Validation is performed at the model instance level
- Updates to sample plugin code

* Pass StockItem through when validating batch code

* Pass Part instance through when calling validate_serial_number

* Bug fix

* Update unit tests

* Unit test fixes

* Fixes for unit tests

* More unit test fixes

* More unit tests

* Furrther unit test fixes

* Simplify custom batch code validation

* Further improvements to unit tests

* Further unit test
2023-03-07 22:43:12 +11:00
Oliver
d246169c93
Add unit test for deleting part which has pricing information (#3986)
* Add unit test for deleting part which has pricing information

* Test delete of part without pricing

* Deal with post_delete errors

1. Deleting a Part deleted related objects (e.g. InternalPriceBreak)
2. post_delete signal is called for InternalPriceBreak
3. Subsequent updates to Part / PartPricing throw error

* Add unit test for deleting a Part via the API

- Add InternalPriceBreak so the previous error condition is checked

* Fix for unit test

* More unit test fixes

(cherry picked from commit fa346257f5)

* Ensure unique part names for unit testing

* Further unit test fixes
2022-12-13 11:07:35 +11:00
luwol03
2d63122ebe
vscode devcontainer (#3474)
* Added devcontainer configuration files

* Added launch.json and improved devcontainer

* Added tasks.json

* fix: lint

* fix: lint

* Applied suggestions from codereview

* Added more system dependencies and preserve history

* devcontainer updates

- Add extra environment variables for InvenTree config
- Move venv into dev directory (cleaner structure)
- Ensure base package requirements get installed
- Handle write-permission error for compiling translations
- Install test data inside dev directory

* Auto create plugin dir and added gh cli

* Refactored postCreateCommand into own file

* Applied suggestions from codereview

Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
2022-08-09 16:06:32 +10:00
Oliver
e9b0f02ecd
Update demo data hook to copy media files (#3441)
* Simplify settings.py / config.py

- get_setting function has been streamlined
- move some functions into config.py

* Spelling fix: IGNORRED is IGNORED

* Ensure yaml is installed as part of docker image

- invoke path is still mucking us around

* Fix broken migration

* Copy media files from demo dataset when installing test data

* Cleanup settings.py

* Fix for configuration file traversal

* Line fix

* Update quickstart guide for docker

* Allow plugin file and plugin dir to be specified in configuration file

* Cleanup config template file

* Allow secret_key information to be provided in configuration file

* Adjust root paths for CI tests

* resolve paths

* Revert paths for CI step

* remove dead code

* Revert configuration variables to old names

- Prevent breaking changes

* Simplify secret key generation

* Fix default timeout for background worker process

* Revert change for customization options
2022-07-31 23:16:58 +10:00
Oliver
3fc9a36d4b
Simplification of development docker-compose file (#3429)
* Simplification of development docker-compose file

- Rename .env file
- Remove requirement for variable interpolation within the docker-compose file itself

* Add debug flag to CI test

* Additional quick-start docs (for docker)

* docker-compose update

- Introspection did not work quite as expected
- Set project name inside docker-compose file

* Fixes for "setup_test" task

- Check if directory exists before first deleting it
- Parameterize the "path" variable
- Add option to ignore update step

* Add demo data dir to .gitignore

* Remove debug call

* Update CONTRIBUTING.md
2022-07-30 10:34:16 +10:00
Matthias Mair
864d69d968
Add test command (#3372)
* integrate test loading as task - use with gitpod

* ignore test data with git
2022-07-21 11:41:42 +10:00
Oliver
b9fd263899
Docker improvements (#3042)
* Simplified dockerfile

- Changed from alpine to python:slim
- Removed some database libs (because we *connect* to a db, not host it)

* - Add gettext as required package
- Only create inventree user as part of production build (leave admin access for dev build)

* Tweaks for tasks.py

* Fix user permissions (drop to inventree user)

* Drop to the 'inventree' user level as part of init.sh

- As we have mounted volumes at 'run time' we need to ensure that the inventree user has correct permissions!
- Ref: https://stackoverflow.com/questions/39397548/how-to-give-non-root-user-in-docker-container-access-to-a-volume-mounted-on-the

* Adjust user setup

- Only drop to non-root user as part of "production" build
- Mounted external volumes make it tricky when in the dev build
- Might want to revisit this later on

* More dockerfile changes

- reduce required system packages
-

* Add new docker github workflow

* Print some more debug

* GITHUB_BASE_REF

* Add gnupg to base requirements

* Improve debug output during testing

* Refactoring updates for label printing API

- Update weasyprint version to 55.0
- Generate labels as pdf files
- Provide filename to label printing plugin
- Additional unit testing
- Improve extraction of some hidden debug data during TESTING
- Fix a spelling mistake (notifaction -> notification)

* Working on github action

* More testing

* Add requirement for pdf2image

* Fix label printing plugin and update unit testing

* Add required packages for CI

* Move docker files to the top level directory

- This allows us to build the production image directly from soure
- Don't need to re-download the source code from github
- Note: The docker install guide will need to be updated!

* Fix for docker ci file

* Print GIT SHA

* Bake git information into the production image

* Add some exta docstrings to dockerfile

* Simplify version check script

* Extract git commit info

* Extract docker tag from check_version.py

* Newline

* More work on the docker workflow

* Dockerfile fixes

- Directory / path issues

* Dockerfile fixes

- Directory / path issues

* Ignore certain steps on a pull request

* Add poppler-utils to CI

* Consolidate version check into existing CI file

* Don't run docker workflow on pull request

* Pass docker image tag through to the build

Also check .j2k files

* Add supervisord.conf example file back in

* Remove --no-cache-dir option from pip install
2022-05-29 09:40:37 +10:00
Oliver Walters
8abc96a79a Ignore .mo files 2022-05-01 22:42:25 +10:00
Oliver
5c2121b1a1 Add invoke target to install plugins from file 2022-01-06 12:25:07 +11:00
Matthias
bb2ad7c2cb
Merge branch 'master' of https://github.com/inventree/InvenTree into plugin-2037 2021-12-04 18:04:47 +01:00
Matthias
83708d645c
add packagelock 2021-12-03 01:11:04 +01:00
Matthias
045d0c241d
add package-log back in 2021-12-02 17:33:03 +01:00
Matthias
329b00ae07
Merge branch 'master' of https://github.com/inventree/InvenTree into plugin-2037 2021-12-02 17:16:26 +01:00
Matthias
0bf986c58b
remove package json 2021-12-02 11:27:10 +01:00
Matthias
695999282d
add package json 2021-12-02 11:01:37 +01:00
Matthias
1b382a62ce
git ignore plugins dir 2021-11-17 02:18:06 +01:00
Matthias
bf0129788d
gitignore for locking file 2021-11-15 23:50:41 +01:00
Oliver Walters
3d5144b9bc Simplify eslintrc file 2021-08-30 20:30:44 +10:00
Oliver Walters
f57a31c9b5 Add a test framework script to pull down rendered javascript files
- Use the testing framework so we don't need to spin up a server
2021-08-28 20:46:51 +10:00
Oliver
537573d0e3 Add extra unit testing for BOM export 2021-08-12 23:40:07 +10:00
Matthias
d6672372a5
script to save the locale stats 2021-08-05 00:44:02 +02:00
Oliver
5ba7aeaa27 Fixes:
- Use DRF ImageField, not FileField
- Ensure that permissions get updated correctly in 'test' mode
- Allow file upload in the APITester class
2021-06-23 10:28:21 +10:00
Oliver Walters
632ea593fe Fix default port association 2021-06-15 23:40:50 +10:00
Oliver Walters
01328075ea All "development" related stuff now goes under ./dev
- Update dev-config.env
- Update docker-compose.dev.yml
- Development target of Dockerfile no longer creates any folders
- Update entry point scripts
2021-06-15 23:05:03 +10:00
Oliver Walters
00c5a88383 Split environment variables out into a .env file
- No need to collect "static" file when we are running in DEBUG mode
2021-05-12 21:15:53 +10:00
Oliver Walters
2f2354afdc Pre-process json data before importing
- Removes any unwanted "permissions" entries from data imported from an *older* version of InvenTree
2021-04-25 12:07:58 +10:00
Oliver Walters
e13850515d PEP fixes 2021-04-25 11:30:17 +10:00
Oliver Walters
792ff16127 Ignore data file 2021-04-25 10:14:13 +10:00
Matthias
2943dc6083 initial implementation as in #1485 2021-04-20 13:37:19 +02:00
Oliver Walters
4e3825682a Doc fix for mgiration
(cherry picked from commit 6ef32dfa2d)
2020-04-13 20:20:18 +10:00
Oliver Walters
b28487760a Rename Part.URL -> part.link
- Previous migration needed some tweaking to get it to run... because.. why?
- It seems to pass when running manage.py migrate but fails when running manage.py test
- Stumped on this one
2020-04-06 11:16:39 +10:00
Oliver Walters
9112196b8f Add fontawesome files 2020-04-05 19:30:57 +10:00
Oliver Walters
f648433e53 Add documentation for creating a virtual environment 2019-12-05 22:56:20 +11:00
Oliver Walters
ee17d5d3c3 Allow for custom url schemes to be specified in the config file 2019-09-14 00:03:13 +10:00
Oliver Walters
13270617b9 Ensure PartParameterTemplate name is unique 2019-09-07 19:43:41 +10:00
Oliver Walters
7b4c8cdc4f Ignore local config file 2019-08-14 12:06:51 +10:00
Oliver Walters
d0e1dc52f8 Example gunicorn conf file 2019-07-11 23:57:07 +10:00
Oliver Walters
f36757c87b Load database settings from config.yaml file
- Provide an initial config file
2019-07-10 23:11:13 +10:00
Oliver Walters
b77bfc74ea Pass column and index data through to each cell in the template
Allows for much more intelligent template rendering
2019-07-07 09:50:59 +10:00