Skip to content

Commit b8d6cc8

Browse files
committed
tweak case display a bit more
1 parent a05ce9d commit b8d6cc8

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

nexus/types/src/fm/case.rs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,9 @@ impl fmt::Display for DisplayCase<'_> {
117117
} = self;
118118
writeln!(
119119
f,
120-
"{:>indent$}case: {id:?}",
120+
"{:>indent$}case: {id}",
121121
if indent > 0 { BULLET } else { "" }
122122
)?;
123-
writeln!(f, "{:>indent$}comment: {comment}", "")?;
124123
writeln!(f, "{:>indent$}diagnosis engine: {de}", "")?;
125124
writeln!(f, "{:>indent$}created in sitrep: {created_sitrep_id}", "")?;
126125
writeln!(f, "{:>indent$} at: {time_created}", "")?;
@@ -133,25 +132,41 @@ impl fmt::Display for DisplayCase<'_> {
133132
}
134133
}
135134

135+
writeln!(f, "\n{:>indent$}comment: {comment}", "")?;
136+
136137
if !ereports.is_empty() {
137-
writeln!(f, "\n{:>indent$}ereports:", "")?;
138+
writeln!(f, "\n{:>indent$}ereports:\n", "")?;
138139
let indent = indent + LIST_INDENT;
139140
for CaseEreport { ereport, assigned_sitrep_id, comment } in ereports
140141
{
142+
let pn =
143+
ereport.part_number.as_deref().unwrap_or("<UNKNOWN PART>");
144+
let sn = ereport
145+
.serial_number
146+
.as_deref()
147+
.unwrap_or("<UNKNOWN SERIAL>");
141148
writeln!(f, "{BULLET:>indent$}{}", ereport.id())?;
142-
writeln!(f, "{:>indent$}class: {:?}", "", ereport.class)?;
143-
writeln!(f, "{:>indent$}reporter: {}", "", ereport.reporter)?;
149+
writeln!(
150+
f,
151+
"{:>indent$}class: {}",
152+
"",
153+
ereport.class.as_deref().unwrap_or("<NONE>")
154+
)?;
155+
writeln!(f, "{:>indent$}reported by:", "")?;
156+
157+
writeln!(f, "{:>indent$} location: {}", "", ereport.reporter)?;
158+
writeln!(f, "{:>indent$} identity: {pn}:{sn}", "")?;
144159
writeln!(
145160
f,
146161
"{:>indent$}added in sitrep: {assigned_sitrep_id}",
147162
""
148163
)?;
149-
writeln!(f, "{:>indent$}comment: {comment}", "")?;
164+
writeln!(f, "{:>indent$}comment: {comment}\n", "")?;
150165
}
151166
}
152167

153168
if !impacted_sp_slots.is_empty() {
154-
writeln!(f, "\n{:>indent$}SP slots impacted:", "")?;
169+
writeln!(f, "\n{:>indent$}SP slots impacted:\n", "")?;
155170
let indent = indent + LIST_INDENT;
156171
for ImpactedSpSlot { sp_type, slot, created_sitrep_id, comment } in
157172
impacted_sp_slots
@@ -162,21 +177,21 @@ impl fmt::Display for DisplayCase<'_> {
162177
"{:>indent$}added in sitrep: {created_sitrep_id}",
163178
""
164179
)?;
165-
writeln!(f, "{:>indent$}comment: {comment}", "")?;
180+
writeln!(f, "{:>indent$}comment: {comment}\n", "")?;
166181
}
167182
}
168183

169184
if !alerts_requested.is_empty() {
170-
writeln!(f, "\n{:>indent$}alerts requested:", "")?;
185+
writeln!(f, "{:>indent$}alerts requested:\n", "")?;
171186
let indent = indent + LIST_INDENT;
172187
for AlertRequest { id, class, requested_sitrep_id, .. } in
173188
alerts_requested
174189
{
175-
writeln!(f, "{BULLET:>indent$}{id:?}")?;
190+
writeln!(f, "{BULLET:>indent$}{id}")?;
176191
writeln!(f, "{:>indent$}class: {class:?}", "")?;
177192
writeln!(
178193
f,
179-
"{:>indent$}requested in sitrep: {requested_sitrep_id}",
194+
"{:>indent$}requested in sitrep: {requested_sitrep_id}\n",
180195
""
181196
)?;
182197
}

0 commit comments

Comments
 (0)