feat: add ReconConfig API and UI for managing configurations

- Added a new API endpoint for managing ReconConfigs at /api/configs, including GET, POST, PUT, and a test URL feature.
- Implemented a new configuration editor UI at /configs for creating and editing ReconConfigs.
- Introduced a new configs list page at /configs to display existing configurations with options to edit.
- Updated base HTML template to include a link to the new configs page.
- Created stub configuration and authentication models for workspace development.
- Added a stub configuration module to handle database configuration without a real database.
This commit is contained in:
2026-05-26 21:58:04 +12:00
parent cf8ec5f094
commit 35d70a7746
10 changed files with 2181 additions and 725 deletions
+2
View File
@@ -6,6 +6,7 @@ from fastapi.staticfiles import StaticFiles
from app.api.reporting import router as reporting_router
from app.api.transactions import router as transactions_router
from app.api.configs import router as configs_router
from app.core.settings import get_settings
from app.views.auth import router as auth_router
from app.views.views import router as dashboard_router
@@ -34,6 +35,7 @@ def create_app() -> FastAPI:
app.include_router(transactions_router)
app.include_router(reporting_router)
app.include_router(configs_router)
app.include_router(auth_router)
app.include_router(dashboard_router)
app.include_router(docs_router)
+29
View File
@@ -0,0 +1,29 @@
"""Stub config module for the workspace.
The production repo has a full config with database URLs and connection maps.
This stub satisfies imports without a real database.
"""
from functools import lru_cache
from os import getenv
db_config_map = {
"NETREVEAL": "netreveal",
"DATAPRODUCT": "dataproduct",
"GROUPDW": "groupdw",
"SNOWFLAKE": "snowflake",
}
class DBConfig:
def __init__(self) -> None:
self.db_url = getenv("DATABASE_URL", "sqlite+aiosqlite:///./recon_ranger.db")
@lru_cache
def get_db_config() -> DBConfig:
return DBConfig()
db_config = get_db_config()
config = db_config
+24 -2
View File
@@ -1,7 +1,7 @@
"""Fake reference-data enums.
The real `app.core.refdata` lives in the production repo. For this workspace
we only need `ReconJobStatus` (consumed by `app.models.recon_job`).
The real `app.core.refdata` lives in the production repo. This workspace
extends it with the enums needed by the config editor.
"""
from enum import Enum
@@ -12,3 +12,25 @@ class ReconJobStatus(str, Enum):
COMPLETED = "completed"
FAILED = "failed"
CANCELLED = "cancelled"
class ReconConfigStatus(str, Enum):
DRAFT = "draft"
PUBLISHED = "published"
ARCHIVED = "archived"
class ReconPatterns(str, Enum):
ONE_TO_ONE = "one_to_one"
MANY_TO_ONE = "many_to_one"
ONE_TO_MANY = "one_to_many"
POSITIONAL = "positional"
class ProfileFields(str, Enum):
ROW_COUNT = "row_count"
NULL_COUNT = "null_count"
DISTINCT_COUNT = "distinct_count"
SUM = "sum"
MIN = "min"
MAX = "max"