fix(dashboard): fix empty widgets + NULL created_at on campaign tests

1. metrics_query_service: use NULLS LAST in get_recent_tests() so tests
   with actual dates always appear before NULL-dated ones.

2. campaign_service: set created_at=datetime.utcnow() when creating tests
   from campaigns (was missing, leaving 21 tests with NULL created_at).
   Fixed existing NULL values directly in production DB.

3. DashboardPage: add isError handling to all V2 metric widgets
   (pipeline, team activity, validation rate, recent tests).
   - Add retry:2 to all secondary metric queries so transient failures
     are retried before showing empty state.
   - Show 'Could not load X — refresh' instead of empty/misleading
     'No tests created yet' when a query actually fails.
This commit is contained in:
kitos
2026-06-02 08:58:04 +02:00
parent 1fd5e37bd0
commit abcc948513
3 changed files with 20 additions and 6 deletions
+1
View File
@@ -181,6 +181,7 @@ def generate_campaign_from_threat_actor(
tool_used=template.tool_suggested,
created_by=user.id,
state=TestState.draft,
created_at=datetime.utcnow(),
)
db.add(test)
db.flush() # Get test.id