Add a broken panel which tries to load a non-existent javascript file

This commit is contained in:
Oliver Walters 2024-08-29 10:11:48 +00:00
parent 2536cad8a3
commit d02146a03e

View File

@ -30,6 +30,12 @@ class SampleUserInterfacePlugin(SettingsMixin, UserInterfaceMixin, InvenTreePlug
'default': False,
'validator': bool,
},
'ENABLE_BROKEN_PANELS': {
'name': _('Enable Broken Panels'),
'description': _('Enable broken panels for testing'),
'default': True,
'validator': bool,
},
}
def get_custom_panels(self, instance_type: str, instance_id: int, request):
@ -60,6 +66,14 @@ class SampleUserInterfacePlugin(SettingsMixin, UserInterfaceMixin, InvenTreePlug
'content': content,
})
# A broken panel which tries to load a non-existent JS file
if self.get_setting('ENABLE_BROKEN_PANElS'):
panels.append({
'name': 'broken_panel',
'label': 'Broken Panel',
'source': '/this/does/not/exist.js',
})
# Next, add a custom panel which will appear on the 'part' page
# Note that this content is rendered from a template file,
# using the django templating system