killzoner commented on code in PR #1949:
URL:
https://github.com/apache/datafusion-ballista/pull/1949#discussion_r3558770929
##########
ballista-cli/src/tui/ui/main/jobs/stage_tasks_popup.rs:
##########
@@ -101,18 +101,16 @@ fn build_stage_task_row(i: usize, task:
&StageTaskResponse, app: &App) -> Row<'s
app.theme.row_odd
};
- let status_style = match task.status.as_str() {
- "Running" => app.theme.status_running,
- "Queued" => app.theme.status_queued,
- "Successful" | "Completed" => app.theme.status_completed,
- "Failed" => app.theme.status_failed,
- _ => app.theme.status_unknown,
+ let (status_label, status_style) = match &task.status {
+ StageTaskStatus::Running => ("Running", app.theme.status_running),
+ StageTaskStatus::Successful => ("Successful",
app.theme.status_completed),
+ StageTaskStatus::Failed { reason } => (reason.as_str(),
app.theme.status_failed),
};
Row::new(vec![
Cell::from(Text::from(task.id.to_string()).right_aligned()),
Cell::from(
- Text::from(task.status.clone())
+ Text::from(status_label.to_string())
.style(status_style)
.centered(),
Review Comment:
i agree it's better to optimize for happy path
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]