Implement plugin dynamic settings routes architecture
Plugins can now register their settings pages dynamically via get_settings_routes()
hook, eliminating hardcoded imports that break lean builds.
Backend:
- Add get_settings_routes() hook to BasePlugin (shopdb/plugins/base.py)
- Implement in ComputersPlugin for Operating Systems management
- Add /api/plugins/settings-routes endpoint to expose plugin routes
Frontend:
- ModelCatalogHub fetches plugin routes and dynamically adds them via router.addRoute()
- Tabs render dynamically from pluginTabs ref
- Components lazy-load when clicked
Benefits:
- Lean builds work without manual route exclusions
- Plugins self-contain their UI extensions
- No core code changes needed when adding plugin settings pages
- Follows plugin architecture best practices
Fixes TODO from commit a03fd3de4f
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -56,13 +56,9 @@ export default [
|
||||
name: 'model-catalog-models',
|
||||
component: () => import('../../views/settings/ModelsList.vue')
|
||||
}
|
||||
// TODO: Operating Systems route should be added by computers plugin, not hardcoded in core
|
||||
// Lean builds without computers plugin fail because this import doesn't exist
|
||||
// {
|
||||
// path: 'operatingsystems',
|
||||
// name: 'model-catalog-os',
|
||||
// component: () => import('../../.plugins-staged/computers/views/OperatingSystemsList.vue')
|
||||
// }
|
||||
// Plugin settings routes (e.g., Operating Systems from computers plugin) are added
|
||||
// dynamically by ModelCatalogHub via router.addRoute() from /api/plugins/settings-routes.
|
||||
// This allows plugins to extend settings hubs without breaking lean builds.
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user