feat(ui): Implement Track Browser and progress visualization in MMA Dashboard
This commit is contained in:
71
gui_2.py
71
gui_2.py
@@ -336,6 +336,9 @@ class App:
|
||||
agent_tools_cfg = self.project.get("agent", {}).get("tools", {})
|
||||
self.ui_agent_tools: dict[str, bool] = {t: agent_tools_cfg.get(t, True) for t in AGENT_TOOL_NAMES}
|
||||
|
||||
# MMA Tracks
|
||||
self.tracks: list[dict] = []
|
||||
|
||||
# Prior session log viewing
|
||||
self.is_viewing_prior_session = False
|
||||
self.prior_session_entries: list[dict] = []
|
||||
@@ -762,6 +765,9 @@ class App:
|
||||
agent_tools_cfg = proj.get("agent", {}).get("tools", {})
|
||||
self.ui_agent_tools = {t: agent_tools_cfg.get(t, True) for t in AGENT_TOOL_NAMES}
|
||||
|
||||
# MMA Tracks
|
||||
self.tracks = project_manager.get_all_tracks(self.ui_files_base_dir)
|
||||
|
||||
# Restore MMA state
|
||||
mma_sec = proj.get("mma", {})
|
||||
self.ui_epic_input = mma_sec.get("epic", "")
|
||||
@@ -790,6 +796,40 @@ class App:
|
||||
if track_history:
|
||||
self.disc_entries = _parse_history_entries(track_history, self.disc_roles)
|
||||
|
||||
def _cb_load_track(self, track_id: str):
|
||||
state = project_manager.load_track_state(track_id, self.ui_files_base_dir)
|
||||
if state:
|
||||
try:
|
||||
# Convert list[Ticket] or list[dict] to list[Ticket] for Track object
|
||||
tickets = []
|
||||
for t in state.tasks:
|
||||
if isinstance(t, dict):
|
||||
tickets.append(Ticket(**t))
|
||||
else:
|
||||
tickets.append(t)
|
||||
|
||||
self.active_track = Track(
|
||||
id=state.metadata.id,
|
||||
description=state.metadata.name,
|
||||
tickets=tickets
|
||||
)
|
||||
# Keep dicts for UI table (or convert Ticket objects back to dicts if needed)
|
||||
from dataclasses import asdict
|
||||
self.active_tickets = [asdict(t) if not isinstance(t, dict) else t for t in tickets]
|
||||
|
||||
# Load track-scoped history
|
||||
history = project_manager.load_track_history(track_id, self.ui_files_base_dir)
|
||||
if history:
|
||||
self.disc_entries = _parse_history_entries(history, self.disc_roles)
|
||||
else:
|
||||
self.disc_entries = []
|
||||
|
||||
self._recalculate_session_usage()
|
||||
self.ai_status = f"Loaded track: {state.metadata.name}"
|
||||
except Exception as e:
|
||||
self.ai_status = f"Load track error: {e}"
|
||||
print(f"Error loading track {track_id}: {e}")
|
||||
|
||||
def _save_active_project(self):
|
||||
if self.active_project_path:
|
||||
try:
|
||||
@@ -2752,7 +2792,36 @@ class App:
|
||||
)
|
||||
|
||||
def _render_mma_dashboard(self):
|
||||
# 1. Global Controls
|
||||
# 1. Track Browser
|
||||
imgui.text("Track Browser")
|
||||
if imgui.begin_table("mma_tracks_table", 4, imgui.TableFlags_.borders | imgui.TableFlags_.row_bg | imgui.TableFlags_.resizable):
|
||||
imgui.table_setup_column("Title")
|
||||
imgui.table_setup_column("Status")
|
||||
imgui.table_setup_column("Progress")
|
||||
imgui.table_setup_column("Actions")
|
||||
imgui.table_headers_row()
|
||||
|
||||
for track in self.tracks:
|
||||
imgui.table_next_row()
|
||||
imgui.table_next_column()
|
||||
imgui.text(track.get("title", "Untitled"))
|
||||
|
||||
imgui.table_next_column()
|
||||
imgui.text(track.get("status", "unknown"))
|
||||
|
||||
imgui.table_next_column()
|
||||
progress = track.get("progress", 0.0)
|
||||
imgui.progress_bar(progress, imgui.ImVec2(-1, 0), f"{int(progress*100)}%")
|
||||
|
||||
imgui.table_next_column()
|
||||
if imgui.button(f"Load##{track.get('id')}"):
|
||||
self._cb_load_track(track.get("id"))
|
||||
|
||||
imgui.end_table()
|
||||
|
||||
imgui.separator()
|
||||
|
||||
# 2. Global Controls
|
||||
changed, self.mma_step_mode = imgui.checkbox("Step Mode (HITL)", self.mma_step_mode)
|
||||
if changed:
|
||||
# We could push an event here if the engine needs to know immediately
|
||||
|
||||
Reference in New Issue
Block a user