Add dynamic loading of standard alert references
All checks were successful
PostgreSQL Compatibility Matrix / PG14 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 7s
All checks were successful
PostgreSQL Compatibility Matrix / PG14 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 7s
Replaced hardcoded standard alert metadata with API-driven data. This change ensures the standard alert information is dynamically loaded from the backend, improving maintainability and scalability. Also adjusted the frontend to handle cases where no data is available.
This commit is contained in:
@@ -12,8 +12,10 @@ from app.schemas.alert import (
|
||||
AlertDefinitionTestResponse,
|
||||
AlertDefinitionUpdate,
|
||||
AlertStatusResponse,
|
||||
StandardAlertReferenceItem,
|
||||
)
|
||||
from app.services.alerts import (
|
||||
get_standard_alert_reference,
|
||||
get_alert_status,
|
||||
invalidate_alert_cache,
|
||||
run_scalar_sql_for_target,
|
||||
@@ -44,6 +46,14 @@ async def list_alert_status(
|
||||
return payload
|
||||
|
||||
|
||||
@router.get("/standard-reference", response_model=list[StandardAlertReferenceItem])
|
||||
async def list_standard_alert_reference(
|
||||
user: User = Depends(get_current_user),
|
||||
) -> list[StandardAlertReferenceItem]:
|
||||
_ = user
|
||||
return [StandardAlertReferenceItem(**item) for item in get_standard_alert_reference()]
|
||||
|
||||
|
||||
@router.get("/definitions", response_model=list[AlertDefinitionOut])
|
||||
async def list_alert_definitions(
|
||||
user: User = Depends(get_current_user), db: AsyncSession = Depends(get_db)
|
||||
|
||||
Reference in New Issue
Block a user