mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
feat(tui/gh): show step-based progress
This commit is contained in:
@@ -5063,6 +5063,10 @@ async fn handle_gh_run_wait(
|
||||
cancelled: usize,
|
||||
skipped: usize,
|
||||
neutral: usize,
|
||||
steps_total: usize,
|
||||
steps_completed: usize,
|
||||
steps_in_progress: usize,
|
||||
steps_queued: usize,
|
||||
running_names: Vec<String>,
|
||||
queued_names: Vec<String>,
|
||||
failed_jobs: Vec<JobFailure>,
|
||||
@@ -5086,6 +5090,10 @@ async fn handle_gh_run_wait(
|
||||
"cancelled": self.cancelled,
|
||||
"skipped": self.skipped,
|
||||
"neutral": self.neutral,
|
||||
"steps_total": self.steps_total,
|
||||
"steps_completed": self.steps_completed,
|
||||
"steps_in_progress": self.steps_in_progress,
|
||||
"steps_queued": self.steps_queued,
|
||||
"running": self.running_names,
|
||||
"queued_names": self.queued_names,
|
||||
})
|
||||
@@ -5171,6 +5179,19 @@ async fn handle_gh_run_wait(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(steps) = job.get("steps").and_then(|v| v.as_array()) {
|
||||
summary.steps_total = summary.steps_total.saturating_add(steps.len());
|
||||
for step in steps {
|
||||
let step_status = step.get("status").and_then(|v| v.as_str()).unwrap_or("");
|
||||
match step_status {
|
||||
"completed" => summary.steps_completed += 1,
|
||||
"in_progress" => summary.steps_in_progress += 1,
|
||||
"queued" => summary.steps_queued += 1,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
summary
|
||||
|
||||
@@ -284,14 +284,29 @@ impl RunningToolCallCell {
|
||||
.and_then(|v| v.as_u64())
|
||||
.unwrap_or(0) as usize;
|
||||
let queued = jobs.get("queued").and_then(|v| v.as_u64()).unwrap_or(0) as usize;
|
||||
let progress = Self::progress_bar(completed, total, 16);
|
||||
if total > 0 {
|
||||
let percent = (completed.saturating_mul(100)) / total.max(1);
|
||||
let steps_total = jobs
|
||||
.get("steps_total")
|
||||
.and_then(|v| v.as_u64())
|
||||
.unwrap_or(0) as usize;
|
||||
let steps_completed = jobs
|
||||
.get("steps_completed")
|
||||
.and_then(|v| v.as_u64())
|
||||
.unwrap_or(0) as usize;
|
||||
let (progress_completed, progress_total, progress_label) = if steps_total > 0 {
|
||||
(steps_completed, steps_total, "progress (steps)")
|
||||
} else {
|
||||
(completed, total, "progress (jobs)")
|
||||
};
|
||||
let progress = Self::progress_bar(progress_completed, progress_total, 16);
|
||||
if progress_total > 0 {
|
||||
let percent = (progress_completed.saturating_mul(100)) / progress_total.max(1);
|
||||
lines.push(Line::from(vec![
|
||||
Span::styled("│ ", dim),
|
||||
Span::styled("progress ", dim),
|
||||
Span::styled(format!("{progress_label} "), dim),
|
||||
Span::styled(
|
||||
format!("{progress} {completed}/{total} ({percent}%)"),
|
||||
format!(
|
||||
"{progress} {progress_completed}/{progress_total} ({percent}%)"
|
||||
),
|
||||
text,
|
||||
),
|
||||
]));
|
||||
|
||||
Reference in New Issue
Block a user