Phase 1 - Vendor Router Integration: - Wire up vendor module routers in app/api/v1/vendor/__init__.py - Use lazy imports via __getattr__ to avoid circular dependencies Phase 2 - Extract Remaining Modules: - Create 6 new module directories: customers, cms, analytics, messaging, dev_tools, monitoring - Each module has definition.py and route wrappers - Update registry to import from extracted modules Phase 3 - Database Table Migration: - Add PlatformModule junction table for auditable module tracking - Add migration zc2m3n4o5p6q7_add_platform_modules_table.py - Add modules relationship to Platform model - Update ModuleService with JSON-to-junction-table migration Phase 4 - Module-Specific Configuration UI: - Add /api/v1/admin/module-config/* endpoints - Add module-config.html template and JS Phase 5 - Integration Tests: - Add tests/fixtures/module_fixtures.py - Add tests/integration/api/v1/admin/test_modules.py - Add tests/integration/api/v1/modules/test_module_access.py Architecture fixes: - Fix JS-003 errors: use ...data() directly in Alpine components - Fix JS-005 warnings: add init() guards to prevent duplicate init - Fix API-001 errors: add MenuActionResponse Pydantic model - Add FE-008 noqa for dynamic number input in template Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
# app/modules/monitoring/definition.py
|
|
"""
|
|
Monitoring module definition.
|
|
|
|
Defines the monitoring module including its features, menu items,
|
|
and route configurations.
|
|
"""
|
|
|
|
from app.modules.base import ModuleDefinition
|
|
from models.database.admin_menu_config import FrontendType
|
|
|
|
|
|
def _get_admin_router():
|
|
"""Lazy import of admin router to avoid circular imports."""
|
|
from app.modules.monitoring.routes.admin import admin_router
|
|
|
|
return admin_router
|
|
|
|
|
|
# Monitoring module definition
|
|
monitoring_module = ModuleDefinition(
|
|
code="monitoring",
|
|
name="Platform Monitoring",
|
|
description="Logs, background tasks, imports, and system health.",
|
|
features=[
|
|
"application_logs", # Log viewing
|
|
"background_tasks", # Task monitoring
|
|
"import_jobs", # Import job tracking
|
|
"capacity_monitoring", # System capacity
|
|
"testing_hub", # Test runner
|
|
"code_quality", # Code quality tools
|
|
],
|
|
menu_items={
|
|
FrontendType.ADMIN: [
|
|
"imports", # Import jobs
|
|
"background-tasks", # Background tasks
|
|
"logs", # Application logs
|
|
"platform-health", # Platform health
|
|
"testing", # Testing hub
|
|
"code-quality", # Code quality
|
|
],
|
|
FrontendType.VENDOR: [], # No vendor menu items
|
|
},
|
|
is_core=False,
|
|
)
|
|
|
|
|
|
def get_monitoring_module_with_routers() -> ModuleDefinition:
|
|
"""
|
|
Get monitoring module with routers attached.
|
|
|
|
This function attaches the routers lazily to avoid circular imports
|
|
during module initialization.
|
|
"""
|
|
monitoring_module.admin_router = _get_admin_router()
|
|
return monitoring_module
|
|
|
|
|
|
__all__ = ["monitoring_module", "get_monitoring_module_with_routers"]
|