diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2020-05-19 17:58:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-19 17:58:17 -0400 |
commit | cf1d41c83af56884611984c7a7b15a59b7a5df8a (patch) | |
tree | 113050ec5e8ac674fe4a6bdfe2b3105ebe48516c /src/canvas | |
parent | e2e1ac300618a06d8cc3f5216cd79ffed39eb913 (diff) |
feature: add back states to unmerged processes
Diffstat (limited to 'src/canvas')
-rw-r--r-- | src/canvas/widgets/process_table.rs | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/src/canvas/widgets/process_table.rs b/src/canvas/widgets/process_table.rs index f0154e28..721d34b0 100644 --- a/src/canvas/widgets/process_table.rs +++ b/src/canvas/widgets/process_table.rs @@ -146,7 +146,7 @@ impl ProcessTableWidget for Painter { let wps = "W/s".to_string(); let total_read = "Read".to_string(); let total_write = "Write".to_string(); - // let process_state = "State".to_string(); + let process_state = "State".to_string(); let direction_val = if proc_widget_state.process_sorting_reverse { "▼".to_string() @@ -161,17 +161,30 @@ impl ProcessTableWidget for Painter { ProcessSorting::NAME => name += &direction_val, }; - let process_headers = [ - pid_or_name, - name, - cpu, - mem, - rps, - wps, - total_read, - total_write, - // process_state, - ]; + let process_headers = if proc_widget_state.is_grouped { + vec![ + pid_or_name, + name, + cpu, + mem, + rps, + wps, + total_read, + total_write, + ] + } else { + vec![ + pid_or_name, + name, + cpu, + mem, + rps, + wps, + total_read, + total_write, + process_state, + ] + }; let process_headers_lens: Vec<usize> = process_headers .iter() .map(|entry| entry.len()) @@ -179,7 +192,11 @@ impl ProcessTableWidget for Painter { // Calculate widths let width = f64::from(draw_loc.width); - let width_ratios = [0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.15, 0.15]; + let width_ratios = if proc_widget_state.is_grouped { + vec![0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.15, 0.15] + } else { + vec![0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] + }; let variable_intrinsic_results = get_variable_intrinsic_widths( width as u16, &width_ratios, |