-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: update process widget code #729
refactor: update process widget code #729
Conversation
385f205
to
0e41747
Compare
Codecov Report
@@ Coverage Diff @@
## consolidate_tables #729 +/- ##
======================================================
+ Coverage 21.23% 24.18% +2.95%
======================================================
Files 54 56 +2
Lines 13606 12918 -688
======================================================
+ Hits 2889 3124 +235
+ Misses 10717 9794 -923
Continue to review full report at Codecov.
|
bcf6cc5
to
69ec526
Compare
eecf396
to
129eb97
Compare
79cec5d
to
c1d3b4e
Compare
if app_state | ||
.proc_state | ||
.widget_states | ||
.get(&app_state.current_widget.widget_id) | ||
.map(|p| matches!(p.mode, ProcWidgetMode::Grouped)) | ||
.unwrap_or(false) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another example of how its a bit annoying how its currently done with a mapping, where it needs an unwrap in the case it "fails". Ideally bind this to the PWS.
0fcab5a
to
9c5efc5
Compare
// TODO: [Refactor] This is an ugly hack to add the disabled style... | ||
// this could be solved by storing style locally to the widget. | ||
for row in &mut proc_widget_state.table_data.data { | ||
if let TableRow::Styled(_, style) = row { | ||
*style = style.patch(self.colours.disabled_text_style); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a fan of this but its fine for now...
@@ -24,7 +30,7 @@ pub struct TextTableTitle<'a> { | |||
|
|||
pub struct TextTable<'a> { | |||
pub table_gap: u16, | |||
pub is_force_redraw: bool, | |||
pub is_force_redraw: bool, // TODO: Is this force redraw thing needed? Or is there a better way? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a fan of this bit. Fix in the future!
9c5efc5
to
b0686ea
Compare
const CPU_PERCENT: CellContent = CellContent::Simple(Cow::Borrowed("CPU%")); | ||
const MEM_PERCENT: CellContent = CellContent::Simple(Cow::Borrowed("Mem%")); | ||
const MEM: CellContent = CellContent::Simple(Cow::Borrowed("Mem")); | ||
const READS_PER_SECOND: CellContent = CellContent::Simple(Cow::Borrowed("R/s")); | ||
const WRITES_PER_SECOND: CellContent = CellContent::Simple(Cow::Borrowed("W/s")); | ||
const TOTAL_READ: CellContent = CellContent::Simple(Cow::Borrowed("T.Read")); | ||
const TOTAL_WRITE: CellContent = CellContent::Simple(Cow::Borrowed("T.Write")); | ||
const STATE: CellContent = CellContent::Simple(Cow::Borrowed("State")); | ||
const PROCESS_NAME: CellContent = CellContent::Simple(Cow::Borrowed("Name")); | ||
const COMMAND: CellContent = CellContent::Simple(Cow::Borrowed("Command")); | ||
const PID: CellContent = CellContent::Simple(Cow::Borrowed("PID")); | ||
const COUNT: CellContent = CellContent::Simple(Cow::Borrowed("Count")); | ||
const USER: CellContent = CellContent::Simple(Cow::Borrowed("User")); | ||
|
||
const SHORTCUT_CPU_PERCENT: CellContent = CellContent::Simple(Cow::Borrowed("CPU%(c)")); | ||
const SHORTCUT_MEM_PERCENT: CellContent = CellContent::Simple(Cow::Borrowed("Mem%(m)")); | ||
const SHORTCUT_MEM: CellContent = CellContent::Simple(Cow::Borrowed("Mem(m)")); | ||
const SHORTCUT_PROCESS_NAME: CellContent = CellContent::Simple(Cow::Borrowed("Name(n)")); | ||
const SHORTCUT_COMMAND: CellContent = CellContent::Simple(Cow::Borrowed("Command(n)")); | ||
const SHORTCUT_PID: CellContent = CellContent::Simple(Cow::Borrowed("PID(p)")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda gross. Feel like there's a better way to do this...
if is_disabled { | ||
TableRow::Styled(contents, tui::style::Style::default()) | ||
} else { | ||
TableRow::Raw(contents) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of the ugly hack for disabled entries.
b0686ea
to
580d02a
Compare
580d02a
to
98e88f9
Compare
98e88f9
to
2646887
Compare
A bunch of work towards also refactoring how the process widget gathers and converts data.
2646887
to
0831a56
Compare
Bugs squashed: - Incorrect column sizing for flex cases - Case where the sort menu bounds were still existing despite being hidden - Proc widget not actually taking into account the calculated row widths in some cases during data conversion.
Description
A description of the change and what it does. If relevant (such as any change that modifies the UI), please provide screenshots of the change:
Refactors how the process widget to work with the (maybe better) consolidated tables code, as well as refactoring a bunch of old logic.
Testing
If relevant, please state how this was tested. All changes must be tested to work:
Please also indicate which platforms were tested. All platforms directly affected by the change must be tested:
Checklist
If relevant, ensure the following have been met:
cargo fmt
)README.md
, help menu, etc.)