mirror of
https://github.com/ClementTsang/bottom
synced 2025-02-15 12:48:28 +00:00
Added arrows to indicate process sorting direction
This commit is contained in:
parent
11f8b8ea2b
commit
72a3de98c2
3 changed files with 36 additions and 18 deletions
|
@ -30,7 +30,7 @@ tokio = "0.2.0-alpha.4"
|
|||
winapi = "0.3.8"
|
||||
|
||||
[dependencies.tui-temp-fork]
|
||||
#git = "https://github.com/ClementTsang/tui-rs"
|
||||
git = "https://github.com/ClementTsang/tui-rs"
|
||||
#path = "../tui-rs"
|
||||
version = "0.6.4"
|
||||
default-features = false
|
||||
|
|
4
TODO.md
4
TODO.md
|
@ -4,8 +4,6 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p
|
|||
|
||||
- Rebalance cpu usage in process by using current value (it's currently just summing to 100%)
|
||||
|
||||
- Scrolling support for temp/disk
|
||||
|
||||
- Travis
|
||||
|
||||
- Refactoring! Please.
|
||||
|
@ -18,8 +16,6 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p
|
|||
|
||||
- Mouse + key events conflict? Make it so that some events don't clog up the loop if they are not valid keys!
|
||||
|
||||
- Header should be clear on current sorting direction!
|
||||
|
||||
- It would be maybe a good idea to see if we can run the process calculation across ALL cpus...? Might be more accurate.
|
||||
|
||||
- ~~Add custom error because it's really messy~~ Done, but need to implement across rest of app!
|
||||
|
|
|
@ -358,19 +358,41 @@ pub fn draw_data<B : backend::Backend>(terminal : &mut Terminal<B>, app_state :
|
|||
)
|
||||
});
|
||||
|
||||
Table::new(["PID", "Name", "CPU%", "Mem%"].iter(), process_rows)
|
||||
.block(
|
||||
Block::default()
|
||||
.title("Processes")
|
||||
.borders(Borders::ALL)
|
||||
.border_style(match app_state.current_application_position {
|
||||
app::ApplicationPosition::PROCESS => highlighted_border_style,
|
||||
_ => border_style,
|
||||
}),
|
||||
)
|
||||
.header_style(Style::default().fg(Color::LightBlue))
|
||||
.widths(&[(width * 0.2) as u16, (width * 0.35) as u16, (width * 0.2) as u16, (width * 0.2) as u16])
|
||||
.render(&mut f, bottom_chunks[1]);
|
||||
{
|
||||
use app::data_collection::processes::ProcessSorting;
|
||||
let mut pid = "PID".to_string();
|
||||
let mut name = "Name".to_string();
|
||||
let mut cpu = "CPU%".to_string();
|
||||
let mut mem = "Mem%".to_string();
|
||||
|
||||
let direction_val = if app_state.process_sorting_reverse {
|
||||
" ⯆".to_string()
|
||||
}
|
||||
else {
|
||||
" ⯅".to_string()
|
||||
};
|
||||
|
||||
match app_state.process_sorting_type {
|
||||
ProcessSorting::CPU => cpu += &direction_val,
|
||||
ProcessSorting::MEM => mem += &direction_val,
|
||||
ProcessSorting::PID => pid += &direction_val,
|
||||
ProcessSorting::NAME => name += &direction_val,
|
||||
};
|
||||
|
||||
Table::new([pid, name, cpu, mem].iter(), process_rows)
|
||||
.block(
|
||||
Block::default()
|
||||
.title("Processes")
|
||||
.borders(Borders::ALL)
|
||||
.border_style(match app_state.current_application_position {
|
||||
app::ApplicationPosition::PROCESS => highlighted_border_style,
|
||||
_ => border_style,
|
||||
}),
|
||||
)
|
||||
.header_style(Style::default().fg(Color::LightBlue))
|
||||
.widths(&[(width * 0.2) as u16, (width * 0.35) as u16, (width * 0.2) as u16, (width * 0.2) as u16])
|
||||
.render(&mut f, bottom_chunks[1]);
|
||||
}
|
||||
}
|
||||
})?;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue