mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-16 20:15:44 +00:00
* package tag results better
* Add docs for missing frontend
* better error indication
Fixes #8875
* fix test assertations
* fix test exception
* group setup admin stuff
* add operations supgourp
* add basic structure
* move error code
* fix link
* fix grammar issues
(cherry picked from commit bbeaf0e791
)
# Conflicts:
# docs/docs/faq.md
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
{% load spa_helper %}
|
||||
{% load inventree_extras %}
|
||||
{% spa_bundle as bundle %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@ -12,8 +13,17 @@
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
{% spa_settings %}
|
||||
{% spa_bundle %}
|
||||
<div id="spa_settings">{% spa_settings %}</div>
|
||||
{% if bundle == "NOT_FOUND" %}
|
||||
<div id="spa_bundle_error">
|
||||
<div>
|
||||
<h1>INVE-E1 - No frontend included</h1>
|
||||
<p>The frontend bundle could not be found. Please check that your deployment method includes the bundle or check the <a href="https://docs.inventree.org/en/stable/faq/">FAQ</a>.<br/>
|
||||
<span>Install method: <code>{% inventree_installer %}</code></span></p>
|
||||
</div>
|
||||
{% else %}
|
||||
<div id="spa_bundle">{{ bundle }}</div>
|
||||
{% endif %}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -37,13 +37,13 @@ def spa_bundle(manifest_path: Union[str, Path] = '', app: str = 'web'):
|
||||
# Final check - fail if manifest file not found
|
||||
if not manifest.exists():
|
||||
logger.error('Manifest file not found')
|
||||
return
|
||||
return 'NOT_FOUND'
|
||||
|
||||
try:
|
||||
manifest_data = json.load(manifest.open())
|
||||
except (TypeError, json.decoder.JSONDecodeError):
|
||||
logger.exception('Failed to parse manifest file')
|
||||
return
|
||||
return ''
|
||||
|
||||
return_string = ''
|
||||
# JS (based on index.html file as entrypoint)
|
||||
|
@ -26,9 +26,8 @@ class TemplateTagTest(InvenTreeTestCase):
|
||||
def test_spa_bundle(self):
|
||||
"""Test the 'spa_bundle' template tag."""
|
||||
resp = spa_helper.spa_bundle()
|
||||
if not resp:
|
||||
if resp == 'NOT_FOUND':
|
||||
# No Vite, no test
|
||||
# TODO: Add a test for the non-Vite case (docker)
|
||||
return # pragma: no cover
|
||||
|
||||
shipped_js = resp.split('<script type="module" src="')[1:]
|
||||
@ -41,7 +40,7 @@ class TemplateTagTest(InvenTreeTestCase):
|
||||
manifest_file.with_suffix('.json.bak')
|
||||
) # Rename
|
||||
resp = spa_helper.spa_bundle()
|
||||
self.assertIsNone(resp)
|
||||
self.assertEqual(resp, 'NOT_FOUND')
|
||||
|
||||
# Try with differing name
|
||||
resp = spa_helper.spa_bundle(new_name)
|
||||
@ -50,7 +49,7 @@ class TemplateTagTest(InvenTreeTestCase):
|
||||
# Broken manifest file
|
||||
manifest_file.write_text('broken')
|
||||
resp = spa_helper.spa_bundle(manifest_file)
|
||||
self.assertIsNone(resp)
|
||||
self.assertEqual(resp, '')
|
||||
|
||||
new_name.rename(manifest_file.with_suffix('.json')) # Name back
|
||||
|
||||
|
Reference in New Issue
Block a user