Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions dev-tools/omdb/src/bin/omdb/nexus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ use std::fs::OpenOptions;
use std::os::unix::fs::PermissionsExt;
use std::str::FromStr;
use std::sync::Arc;
use std::time::Duration;
use support_bundle_viewer::LocalFileAccess;
use support_bundle_viewer::SupportBundleAccessor;
use tabled::Tabled;
Expand Down Expand Up @@ -2612,6 +2613,7 @@ fn print_task_support_bundle_collector(details: &serde_json::Value) {
listed_in_service_sleds,
listed_sps,
activated_in_db_ok,
mut steps,
ereports,
}) = collection_report
{
Expand All @@ -2623,6 +2625,35 @@ fn print_task_support_bundle_collector(details: &serde_json::Value) {
println!(
" Bundle was able to list service processors: {listed_sps}"
);

#[derive(Tabled)]
#[tabled(rename_all = "SCREAMING_SNAKE_CASE")]
struct StepRow {
step_name: String,
start_time: String,
duration: String,
status: String,
}

steps.sort_unstable_by_key(|s| s.start);
let rows: Vec<StepRow> = steps
.into_iter()
.map(|step| {
let duration = (step.end - step.start)
.to_std()
.unwrap_or(Duration::from_millis(0));
StepRow {
step_name: step.name,
start_time: step.start.to_rfc3339(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

take it or leave it: we have a helper for doing this, so you _ could_ just use a DateTime as the struct field and add the attribute to use that. Not important either way, this is fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, left as "DateTime" in row struct

duration: format!("{:.3}s", duration.as_secs_f64()),
status: step.status.to_string(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since status is Display, we could just make the status field that type instead of ToStringing it...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use stronger type here

}
})
.collect();

if !rows.is_empty() {
println!("\n{}", tabled::Table::new(rows));
}
println!(
" Bundle was activated in the database: {activated_in_db_ok}"
);
Expand Down
Loading
Loading