This is an automated email from the ASF dual-hosted git repository.

martin-g pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-ballista.git


The following commit(s) were added to refs/heads/main by this push:
     new 2e6fa3472 Right align all numeric columns in the TUI tables (#1695)
2e6fa3472 is described below

commit 2e6fa3472201cd600591efc72eced9e219117141
Author: Martin Grigorov <[email protected]>
AuthorDate: Tue May 12 21:00:43 2026 +0300

    Right align all numeric columns in the TUI tables (#1695)
---
 .../src/tui/ui/main/executors/executors_table.rs   | 36 +++++++++--------
 .../src/tui/ui/main/jobs/job_stages_popup.rs       | 31 +++++++-------
 ballista-cli/src/tui/ui/main/jobs/mod.rs           | 28 ++++++-------
 .../src/tui/ui/main/jobs/stage_tasks_popup.rs      | 47 ++++++++++------------
 4 files changed, 67 insertions(+), 75 deletions(-)

diff --git a/ballista-cli/src/tui/ui/main/executors/executors_table.rs 
b/ballista-cli/src/tui/ui/main/executors/executors_table.rs
index 58b767417..daadd498b 100644
--- a/ballista-cli/src/tui/ui/main/executors/executors_table.rs
+++ b/ballista-cli/src/tui/ui/main/executors/executors_table.rs
@@ -68,18 +68,20 @@ fn render_executors_table(frame: &mut Frame, area: Rect, 
app: &App) {
         sort_suffix!(SortColumn::PeakPhysicalMemoryUsage, sort_column, 
sort_order);
     let last_seen_suffix = sort_suffix!(SortColumn::LastSeen, sort_column, 
sort_order);
 
-    let header = [
-        format!("Host{host_suffix}"),
-        format!("Id{id_suffix}"),
-        format!("Task Slots{task_slots_suffix}"),
-        format!("Physical Memory{proc_physical_memory_suffix}"),
-        format!("Peak Physical Memory{peak_physical_memory_suffix}"),
-        format!("Last seen{last_seen_suffix}"),
-    ]
-    .into_iter()
-    .map(|item| Text::from(item).centered())
-    .map(Cell::from)
-    .collect::<Row>()
+    let header_row = Row::new(vec![
+        Cell::from(Text::from(format!("Host{host_suffix}")).centered()),
+        Cell::from(Text::from(format!("Id{id_suffix}")).right_aligned()),
+        Cell::from(Text::from(format!("Task 
Slots{task_slots_suffix}")).right_aligned()),
+        Cell::from(
+            Text::from(format!("Physical Memory{proc_physical_memory_suffix}"))
+                .right_aligned(),
+        ),
+        Cell::from(
+            Text::from(format!("Peak Physical 
Memory{peak_physical_memory_suffix}"))
+                .right_aligned(),
+        ),
+        Cell::from(Text::from(format!("Last 
Seen{last_seen_suffix}")).centered()),
+    ])
     .style(header_style)
     .height(1);
 
@@ -97,22 +99,22 @@ fn render_executors_table(frame: &mut Frame, area: Rect, 
app: &App) {
             let host_cell = Cell::from(
                 Text::from(format!("{}:{}", executor.host, 
executor.port)).centered(),
             );
-            let id_cell = 
Cell::from(Text::from(executor.id.clone()).centered());
+            let id_cell = 
Cell::from(Text::from(executor.id.clone()).right_aligned());
             let task_slots_cell = Cell::from(
                 Text::from(app.format_count(executor.specification.task_slots 
as usize))
-                    .centered(),
+                    .right_aligned(),
             );
             let proc_physical_memory_cell = Cell::from(
                 Text::from(
                     app.format_size(executor.proc_physical_memory_usage() as 
usize),
                 )
-                .centered(),
+                .right_aligned(),
             );
             let peak_physical_memory_cell = Cell::from(
                 Text::from(
                     app.format_size(executor.peak_physical_memory_usage() as 
usize),
                 )
-                .centered(),
+                .right_aligned(),
             );
             let last_seen_cell = render_last_seen_cell(executor, app);
 
@@ -139,7 +141,7 @@ fn render_executors_table(frame: &mut Frame, area: Rect, 
app: &App) {
         ],
     )
     .block(Block::default().borders(Borders::all()))
-    .header(header)
+    .header(header_row)
     .row_highlight_style(Style::default().bg(Color::Indexed(29)))
     .highlight_spacing(HighlightSpacing::Always);
     let mut table_state = app.executors_data.table_state;
diff --git a/ballista-cli/src/tui/ui/main/jobs/job_stages_popup.rs 
b/ballista-cli/src/tui/ui/main/jobs/job_stages_popup.rs
index 974496084..b2b696bc2 100644
--- a/ballista-cli/src/tui/ui/main/jobs/job_stages_popup.rs
+++ b/ballista-cli/src/tui/ui/main/jobs/job_stages_popup.rs
@@ -37,18 +37,15 @@ pub(crate) fn render_job_stages_popup(f: &mut Frame, app: 
&App) {
         .fg(Color::LightYellow)
         .bg(Color::Black)
         .bold();
-    let header = [
-        "Stage ID",
-        "Status",
-        "Input Rows",
-        "Output Rows",
-        "Elapsed Compute",
-        "Input percentiles\n(min/p25/med/p75/max)",
-        "Duration percentiles\n(min/p25/med/p75/max)",
-    ]
-    .into_iter()
-    .map(|h| Cell::from(Text::from(h).centered()))
-    .collect::<Row>()
+    let header_row = Row::new(vec![
+        Cell::from(Text::from("Stage ID").right_aligned()),
+        Cell::from(Text::from("Status").centered()),
+        Cell::from(Text::from("Input Rows").right_aligned()),
+        Cell::from(Text::from("Output Rows").right_aligned()),
+        Cell::from(Text::from("Compute Time").right_aligned()),
+        Cell::from(Text::from("Input 
percentiles\n(min/p25/med/p75/max)").centered()),
+        Cell::from(Text::from("Duration 
percentiles\n(min/p25/med/p75/max)").centered()),
+    ])
     .style(header_style)
     .height(2);
 
@@ -78,7 +75,7 @@ pub(crate) fn render_job_stages_popup(f: &mut Frame, app: 
&App) {
             .border_style(Style::default().fg(Color::LightBlue).bold())
             .border_type(BorderType::Thick),
     )
-    .header(header)
+    .header(header_row)
     .row_highlight_style(Style::default().bg(Color::Indexed(29)))
     .highlight_spacing(HighlightSpacing::Always);
 
@@ -120,15 +117,15 @@ fn build_stage_row(i: usize, stage: &JobStageResponse, 
app: &App) -> Row<'static
     );
 
     Row::new(vec![
-        Cell::from(Text::from(stage.id.clone()).centered()),
+        Cell::from(Text::from(stage.id.clone()).right_aligned()),
         Cell::from(
             Text::from(stage.status.clone())
                 .style(Style::default().fg(status_color).bold())
                 .centered(),
         ),
-        Cell::from(Text::from(app.format_count(stage.input_rows)).centered()),
-        Cell::from(Text::from(app.format_count(stage.output_rows)).centered()),
-        Cell::from(Text::from(stage.elapsed_compute.clone()).centered()),
+        
Cell::from(Text::from(app.format_count(stage.input_rows)).right_aligned()),
+        
Cell::from(Text::from(app.format_count(stage.output_rows)).right_aligned()),
+        Cell::from(Text::from(stage.elapsed_compute.clone()).right_aligned()),
         Cell::from(Text::from(input_percentiles).centered()),
         Cell::from(Text::from(duration_percentiles).centered()),
     ])
diff --git a/ballista-cli/src/tui/ui/main/jobs/mod.rs 
b/ballista-cli/src/tui/ui/main/jobs/mod.rs
index 1ddc5a5ab..a6b3955a1 100644
--- a/ballista-cli/src/tui/ui/main/jobs/mod.rs
+++ b/ballista-cli/src/tui/ui/main/jobs/mod.rs
@@ -203,19 +203,15 @@ fn render_jobs_table(
         column_suffix(sort_column, sort_order, &SortColumn::StartTime);
     let duration_suffix = column_suffix(sort_column, sort_order, 
&SortColumn::Duration);
 
-    let header = [
-        format!("Id{id_suffix}"),
-        format!("Name{name_suffix}"),
-        format!("Status{status_suffix}"),
-        format!("Stages Completed{stages_suffix}"),
-        format!("Percent Completed{percent_suffix}"),
-        format!("Start time{start_time_suffix}"),
-        format!("Duration{duration_suffix}"),
-    ]
-    .into_iter()
-    .map(|item| Text::from(item).centered())
-    .map(Cell::from)
-    .collect::<Row>()
+    let header_row = Row::new(vec![
+        Cell::from(Text::from(format!("Id{id_suffix}")).right_aligned()),
+        Cell::from(Text::from(format!("Name{name_suffix}")).centered()),
+        Cell::from(Text::from(format!("Status{status_suffix}")).centered()),
+        Cell::from(Text::from(format!("Stages 
Completed{stages_suffix}")).centered()),
+        Cell::from(Text::from(format!("Percent 
Completed{percent_suffix}")).centered()),
+        Cell::from(Text::from(format!("Start 
Time{start_time_suffix}")).centered()),
+        
Cell::from(Text::from(format!("Duration{duration_suffix}")).right_aligned()),
+    ])
     .style(header_style)
     .height(1);
 
@@ -225,7 +221,7 @@ fn render_jobs_table(
             _ => Color::Black,
         };
 
-        let id_cell = Cell::from(Text::from(job.job_id.clone()).centered());
+        let id_cell = 
Cell::from(Text::from(job.job_id.clone()).right_aligned());
         let name_cell = 
Cell::from(Text::from(job.job_name.clone()).centered());
         let status_cell = render_job_status_cell(job);
         let stage_completion_cell = render_job_stage_completion_cell(job);
@@ -258,7 +254,7 @@ fn render_jobs_table(
         ],
     )
     .block(Block::default().borders(Borders::all()))
-    .header(header)
+    .header(header_row)
     .row_highlight_style(Style::default().bg(Color::Indexed(29)))
     .highlight_spacing(HighlightSpacing::Always);
     frame.render_stateful_widget(t, area, state);
@@ -276,7 +272,7 @@ fn render_job_duration_cell<'a>(job: &'a Job, app: &App) -> 
Cell<'a> {
     } else {
         "N/A".to_string()
     };
-    Cell::from(Text::from(duration).centered())
+    Cell::from(Text::from(duration).right_aligned())
 }
 
 fn render_job_percent_completion_cell(job: &Job) -> Cell<'_> {
diff --git a/ballista-cli/src/tui/ui/main/jobs/stage_tasks_popup.rs 
b/ballista-cli/src/tui/ui/main/jobs/stage_tasks_popup.rs
index 080af7d9b..c04bf45a7 100644
--- a/ballista-cli/src/tui/ui/main/jobs/stage_tasks_popup.rs
+++ b/ballista-cli/src/tui/ui/main/jobs/stage_tasks_popup.rs
@@ -41,22 +41,19 @@ pub(crate) fn render_stage_tasks_popup(f: &mut Frame, app: 
&App) {
         .fg(Color::LightYellow)
         .bg(Color::Black)
         .bold();
-    let header = [
-        "Task ID",
-        "Status",
-        "Input Rows",
-        "Output Rows",
-        "Partition ID",
-        "Scheduled Time",
-        "Launch latency",
-        "Start latency",
-        // "End Time",
-        "Duration",
-        "Total Time",
-    ]
-    .into_iter()
-    .map(|h| Cell::from(Text::from(h).centered()))
-    .collect::<Row>()
+
+    let header_row = Row::new(vec![
+        Cell::from(Text::from("Task ID".to_string()).right_aligned()),
+        Cell::from(Text::from("Status".to_string()).centered()),
+        Cell::from(Text::from("Input Rows".to_string()).right_aligned()),
+        Cell::from(Text::from("Output Rows".to_string()).right_aligned()),
+        Cell::from(Text::from("Partition ID".to_string()).right_aligned()),
+        Cell::from(Text::from("Scheduled Time".to_string()).centered()),
+        Cell::from(Text::from("Launch Latency".to_string()).right_aligned()),
+        Cell::from(Text::from("Start Latency".to_string()).right_aligned()),
+        Cell::from(Text::from("Duration".to_string()).right_aligned()),
+        Cell::from(Text::from("Total Time".to_string()).right_aligned()),
+    ])
     .style(header_style)
     .height(1);
 
@@ -91,7 +88,7 @@ pub(crate) fn render_stage_tasks_popup(f: &mut Frame, app: 
&App) {
             .border_style(Style::default().fg(Color::Indexed(193)).bold())
             .border_type(BorderType::Thick),
     )
-    .header(header)
+    .header(header_row)
     .row_highlight_style(Style::default().bg(Color::Indexed(29)))
     .highlight_spacing(HighlightSpacing::Always);
 
@@ -113,31 +110,31 @@ fn build_stage_task_row(i: usize, task: 
&StageTaskResponse, app: &App) -> Row<'s
     };
 
     Row::new(vec![
-        Cell::from(Text::from(task.id.to_string()).centered()),
+        Cell::from(Text::from(task.id.to_string()).right_aligned()),
         Cell::from(
             Text::from(task.status.clone())
                 .style(Style::default().fg(status_color).bold())
                 .centered(),
         ),
-        Cell::from(Text::from(app.format_count(task.input_rows)).centered()),
-        Cell::from(Text::from(app.format_count(task.output_rows)).centered()),
-        Cell::from(Text::from(task.partition_id.to_string()).centered()),
+        
Cell::from(Text::from(app.format_count(task.input_rows)).right_aligned()),
+        
Cell::from(Text::from(app.format_count(task.output_rows)).right_aligned()),
+        Cell::from(Text::from(task.partition_id.to_string()).right_aligned()),
         Cell::from(Text::from(format_datetime(task.scheduled_time, 
app)).centered()),
         Cell::from(
             Text::from(app.format_duration(task.launch_time - 
task.scheduled_time))
-                .centered(),
+                .right_aligned(),
         ),
         Cell::from(
             Text::from(app.format_duration(task.start_exec_time - 
task.scheduled_time))
-                .centered(),
+                .right_aligned(),
         ),
         Cell::from(
             Text::from(app.format_duration(task.end_exec_time - 
task.start_exec_time))
-                .centered(),
+                .right_aligned(),
         ),
         Cell::from(
             Text::from(app.format_duration(task.finish_time - 
task.scheduled_time))
-                .centered(),
+                .right_aligned(),
         ),
     ])
     .style(Style::default().bg(bg))


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to