feat(ui): Implement enhanced MMA track progress visualization with color-coded bars, breakdown, and ETA
This commit is contained in:
89
src/gui_2.py
89
src/gui_2.py
@@ -1,4 +1,4 @@
|
||||
# gui_2.py
|
||||
# gui_2.py
|
||||
from __future__ import annotations
|
||||
import tomli_w
|
||||
import time
|
||||
@@ -1752,26 +1752,21 @@ class App:
|
||||
def _render_mma_dashboard(self) -> None:
|
||||
# Task 5.3: Dense Summary Line
|
||||
track_name = self.active_track.description if self.active_track else "None"
|
||||
total_tickets = len(self.active_tickets)
|
||||
done_tickets = sum(1 for t in self.active_tickets if t.get('status') == 'complete')
|
||||
track_stats = {"percentage": 0.0, "completed": 0, "total": 0, "in_progress": 0, "blocked": 0, "todo": 0}
|
||||
if self.active_track:
|
||||
track_stats = project_manager.calculate_track_progress(self.active_track.tickets)
|
||||
|
||||
total_cost = 0.0
|
||||
for stats in self.mma_tier_usage.values():
|
||||
model = stats.get('model', 'unknown')
|
||||
in_t = stats.get('input', 0)
|
||||
out_t = stats.get('output', 0)
|
||||
for usage in self.mma_tier_usage.values():
|
||||
model = usage.get('model', 'unknown')
|
||||
in_t = usage.get('input', 0)
|
||||
out_t = usage.get('output', 0)
|
||||
total_cost += cost_tracker.estimate_cost(model, in_t, out_t)
|
||||
|
||||
imgui.text("Track:")
|
||||
imgui.same_line()
|
||||
imgui.text_colored(C_VAL, track_name)
|
||||
imgui.same_line()
|
||||
imgui.text(" | Tickets:")
|
||||
imgui.same_line()
|
||||
imgui.text_colored(C_VAL, f"{done_tickets}/{total_tickets}")
|
||||
imgui.same_line()
|
||||
imgui.text(" | Cost:")
|
||||
imgui.same_line()
|
||||
imgui.text_colored(imgui.ImVec4(0, 1, 0, 1), f"${total_cost:,.4f}")
|
||||
imgui.same_line()
|
||||
imgui.text(" | Status:")
|
||||
imgui.same_line()
|
||||
status_col = imgui.ImVec4(1, 1, 1, 1)
|
||||
@@ -1780,7 +1775,54 @@ class App:
|
||||
elif self.mma_status == "done": status_col = imgui.ImVec4(0, 1, 0, 1)
|
||||
elif self.mma_status == "error": status_col = imgui.ImVec4(1, 0, 0, 1)
|
||||
imgui.text_colored(status_col, self.mma_status.upper())
|
||||
|
||||
imgui.same_line()
|
||||
imgui.text(" | Cost:")
|
||||
imgui.same_line()
|
||||
imgui.text_colored(imgui.ImVec4(0, 1, 0, 1), f"${total_cost:,.4f}")
|
||||
|
||||
# Progress Bar
|
||||
perc = track_stats["percentage"] / 100.0
|
||||
p_color = imgui.ImVec4(0.0, 1.0, 0.0, 1.0)
|
||||
if track_stats["percentage"] < 33:
|
||||
p_color = imgui.ImVec4(1.0, 0.0, 0.0, 1.0)
|
||||
elif track_stats["percentage"] < 66:
|
||||
p_color = imgui.ImVec4(1.0, 1.0, 0.0, 1.0)
|
||||
|
||||
imgui.push_style_color(imgui.Col_.plot_histogram, p_color)
|
||||
imgui.progress_bar(perc, imgui.ImVec2(-1, 0), f"{track_stats['percentage']:.1f}%")
|
||||
imgui.pop_style_color()
|
||||
|
||||
# Detailed breakdown
|
||||
if imgui.begin_table("ticket_stats_breakdown", 4):
|
||||
imgui.table_next_column()
|
||||
imgui.text_colored(C_LBL, "Completed:")
|
||||
imgui.same_line()
|
||||
imgui.text_colored(C_VAL, str(track_stats["completed"]))
|
||||
|
||||
imgui.table_next_column()
|
||||
imgui.text_colored(C_LBL, "In Progress:")
|
||||
imgui.same_line()
|
||||
imgui.text_colored(C_VAL, str(track_stats["in_progress"]))
|
||||
|
||||
imgui.table_next_column()
|
||||
imgui.text_colored(C_LBL, "Blocked:")
|
||||
imgui.same_line()
|
||||
imgui.text_colored(C_VAL, str(track_stats["blocked"]))
|
||||
|
||||
imgui.table_next_column()
|
||||
imgui.text_colored(C_LBL, "Todo:")
|
||||
imgui.same_line()
|
||||
imgui.text_colored(C_VAL, str(track_stats["todo"]))
|
||||
|
||||
imgui.end_table()
|
||||
|
||||
if self.active_track:
|
||||
remaining = track_stats["total"] - track_stats["completed"]
|
||||
eta_mins = (self._avg_ticket_time * remaining) / 60.0
|
||||
imgui.text_colored(C_LBL, "ETA:")
|
||||
imgui.same_line()
|
||||
imgui.text_colored(C_VAL, f"~{int(eta_mins)}m ({remaining} tickets remaining)")
|
||||
|
||||
imgui.separator()
|
||||
imgui.text_colored(C_LBL, 'Epic Planning (Tier 1)')
|
||||
_, self.ui_epic_input = imgui.input_text_multiline('##epic_input', self.ui_epic_input, imgui.ImVec2(-1, 80))
|
||||
@@ -1874,20 +1916,7 @@ class App:
|
||||
if imgui.button("Go to Approval"):
|
||||
pass # scroll/focus handled by existing dialog rendering
|
||||
imgui.separator()
|
||||
# 2. Active Track Info
|
||||
if self.active_track:
|
||||
imgui.text(f"Track: {self.active_track.description}")
|
||||
# Progress bar
|
||||
tickets = self.active_tickets
|
||||
total = len(tickets)
|
||||
if total > 0:
|
||||
complete = sum(1 for t in tickets if t.get('status') == 'complete')
|
||||
progress = complete / total
|
||||
imgui.progress_bar(progress, imgui.ImVec2(-1, 0), f"{complete}/{total} Tickets")
|
||||
else:
|
||||
imgui.text_disabled("No active MMA track.")
|
||||
# 3. Token Usage Table
|
||||
imgui.separator()
|
||||
# 3. Token Usage Table
|
||||
imgui.text("Tier Usage (Tokens & Cost)")
|
||||
if imgui.begin_table("mma_usage", 5, imgui.TableFlags_.borders | imgui.TableFlags_.row_bg):
|
||||
imgui.table_setup_column("Tier")
|
||||
|
||||
Reference in New Issue
Block a user