Skip to content

Commit 4d2a557

Browse files
authored
Merge pull request #323 from lbedner/fix-overseer-modals
Fix overseer modals
2 parents d7a9677 + db75878 commit 4d2a557

42 files changed

Lines changed: 2667 additions & 3110 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

aegis/templates/cookiecutter-aegis-project/{{cookiecutter.project_slug}}/app/components/backend/startup/component_health.py.j2

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,19 +228,28 @@ async def _frontend_component_health() -> ComponentStatus:
228228
"""
229229
try:
230230
# Check if frontend component is available
231+
from importlib.metadata import version
232+
231233
from app.components.frontend.main import create_frontend_app
232234

233235
# Verify the frontend app factory function works
234236
create_frontend_app()
235237

238+
# Get Flet version safely
239+
try:
240+
flet_version = version("flet")
241+
except Exception:
242+
flet_version = "unknown"
243+
236244
return ComponentStatus(
237245
name="frontend",
238246
status=ComponentStatusType.HEALTHY,
239247
message="Flet frontend component available",
240248
response_time_ms=None,
241249
metadata={
242250
"type": "component_check",
243-
"framework": "flet",
251+
"framework": "Flet",
252+
"version": flet_version,
244253
"note": "Frontend integrated with FastAPI",
245254
},
246255
)

aegis/templates/cookiecutter-aegis-project/{{cookiecutter.project_slug}}/app/components/frontend/dashboard/cards/card_utils.py.j2

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,18 @@ def create_progress_indicator(
238238

239239

240240
def create_modal_for_component(
241-
component_name: str, component_data: ComponentStatus
242-
) -> ft.AlertDialog | None:
241+
component_name: str, component_data: ComponentStatus, page: ft.Page
242+
) -> ft.Container | None:
243243
"""
244-
Factory function to create appropriate modal dialog for a component.
244+
Factory function to create appropriate popup dialog for a component.
245245

246246
Args:
247247
component_name: Name of the component (e.g., "scheduler", "worker")
248248
component_data: ComponentStatus containing component health and metrics
249+
page: The Flet page instance
249250

250251
Returns:
251-
AlertDialog instance for the component, or None if component not supported
252+
Popup Container instance for the component, or None if component not supported
252253
"""
253254
from ..modals import (
254255
{%- if cookiecutter.include_ai == "yes" %}
@@ -276,7 +277,7 @@ def create_modal_for_component(
276277
{%- endif %}
277278
)
278279

279-
modal_map: dict[str, type[ft.AlertDialog]] = {
280+
modal_map: dict[str, type[ft.Container]] = {
280281
{%- if cookiecutter.include_ai == "yes" %}
281282
"ai": AIDetailDialog,
282283
{%- endif %}
@@ -304,7 +305,7 @@ def create_modal_for_component(
304305

305306
modal_class = modal_map.get(component_name)
306307
if modal_class:
307-
return modal_class(component_data)
308+
return modal_class(component_data, page)
308309

309310
return None
310311

@@ -313,7 +314,7 @@ def create_card_click_handler(
313314
component_name: str, component_data: ComponentStatus
314315
) -> Callable[[ft.ControlEvent], None]:
315316
"""
316-
Create a click handler for a card that opens its detail modal.
317+
Create a click handler for a card that opens its detail popup.
317318

318319
Args:
319320
component_name: Name of the component
@@ -324,10 +325,16 @@ def create_card_click_handler(
324325
"""
325326

326327
def handle_click(e: ft.ControlEvent) -> None:
327-
"""Handle card click by opening detail modal."""
328-
modal = create_modal_for_component(component_name, component_data)
329-
if modal and e.page:
330-
e.page.open(modal)
328+
"""Handle card click by opening detail popup."""
329+
if not e.page:
330+
return
331+
332+
popup = create_modal_for_component(component_name, component_data, e.page)
333+
if popup:
334+
# Add to page overlay and show
335+
e.page.overlay.append(popup)
336+
popup.show()
337+
e.page.update()
331338

332339
return handle_click
333340

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""Modal components for the Overseer dashboard."""
2+
3+
from app.components.frontend.dashboard.modals.base_modal import BaseDetailDialog
4+
from app.components.frontend.dashboard.modals.modal_sections import (
5+
EmptyStatePlaceholder,
6+
MetricCardSection,
7+
StatRowsSection,
8+
)
9+
10+
__all__ = [
11+
"BaseDetailDialog",
12+
"MetricCardSection",
13+
"StatRowsSection",
14+
"EmptyStatePlaceholder",
15+
]

0 commit comments

Comments
 (0)