MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / draw

Function draw

atomic-cli/src/commands/git/rolling_dashboard.rs:164–308  ·  view source on GitHub ↗
(
    frame: &mut Frame,
    progress: &Progress,
    sample: &Resources,
    cpu: Option<f64>,
    elapsed: Duration,
    metrics: &Metrics,
)

Source from the content-addressed store, hash-verified

162}
163
164fn draw(
165 frame: &mut Frame,
166 progress: &Progress,
167 sample: &Resources,
168 cpu: Option<f64>,
169 elapsed: Duration,
170 metrics: &Metrics,
171) {
172 let area = frame.area();
173 if area.width < 76 || area.height < 22 {
174 let content = format!("{}\nBlob budget is not total process memory.\nStaging is private; final proof is required.", plain(progress, sample, cpu, elapsed));
175 frame.render_widget(
176 Paragraph::new(content).wrap(Wrap { trim: true }).block(
177 panel(" Atomic import ").title_style(Style::default().fg(Color::Cyan).bold()),
178 ),
179 area,
180 );
181 return;
182 }
183 let rows = Layout::vertical([
184 Constraint::Length(4),
185 Constraint::Length(3),
186 Constraint::Length(6),
187 Constraint::Min(7),
188 Constraint::Length(2),
189 ])
190 .split(area);
191 let status_color = match progress.phase {
192 "complete" => Color::Green,
193 "stopped / failed" => Color::Red,
194 "final proof / promote" => Color::Yellow,
195 _ => Color::Cyan,
196 };
197 let header = vec![
198 Line::from(vec![
199 Span::styled(
200 format!(" {} ", progress.phase),
201 Style::default().fg(status_color).bold(),
202 ),
203 Span::raw(format!(" {:.1}s elapsed", elapsed.as_secs_f64())),
204 ]),
205 Line::from(format!(
206 " {:.1} commits/s average Staging ETA {}",
207 rate(progress, elapsed),
208 eta(progress, elapsed)
209 )),
210 ];
211 frame.render_widget(
212 Paragraph::new(header).block(panel(" ATOMIC / ROLLING IMPORT ")),
213 rows[0],
214 );
215 frame.render_widget(
216 Gauge::default()
217 .block(panel(" Privately staged history "))
218 .gauge_style(Style::default().fg(Color::Cyan))
219 .ratio(ratio(progress.published, progress.total))
220 .label(format!(
221 "{} / {} commits",

Callers 2

startMethod · 0.70

Calls 8

panelFunction · 0.85
ratioFunction · 0.85
labelMethod · 0.45
innerMethod · 0.45
collectMethod · 0.45
iterMethod · 0.45
lenMethod · 0.45
dataMethod · 0.45