From fe09d2745e6b608f3b4c3641cd34fb0d94eaa6c7 Mon Sep 17 00:00:00 2001 From: Proudlock <270015376@geaerospace.com> Date: Fri, 11 Sep 2026 16:49:10 -0400 Subject: [PATCH] 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 --- frontend/src/router/routes/core.js | 10 ++--- .../src/views/settings/ModelCatalogHub.vue | 42 +++++++++++++++---- plugins/computers/plugin.py | 10 +++++ shopdb/core/api/plugins.py | 24 +++++++++++ shopdb/plugins/base.py | 24 +++++++++++ 5 files changed, 95 insertions(+), 15 deletions(-) diff --git a/frontend/src/router/routes/core.js b/frontend/src/router/routes/core.js index bfd97f37..303a5b3e 100644 --- a/frontend/src/router/routes/core.js +++ b/frontend/src/router/routes/core.js @@ -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. ] }, { diff --git a/frontend/src/views/settings/ModelCatalogHub.vue b/frontend/src/views/settings/ModelCatalogHub.vue index 8c6dc2aa..53d31c04 100644 --- a/frontend/src/views/settings/ModelCatalogHub.vue +++ b/frontend/src/views/settings/ModelCatalogHub.vue @@ -27,14 +27,16 @@ > Models - - + - Operating Systems - --> + {{ tab.tab }} +
@@ -44,13 +46,37 @@