summaryrefslogtreecommitdiffstats
path: root/src/canvas.rs
AgeCommit message (Collapse)Author
2024-02-03deps: bump ratatui to 0.26 (#1406)Clement Tsang
* deps: bump ratatui to 0.26 * adjust process width * a few nonzero optimizations * add a todo * update comments to be less confusing about time chart
2024-01-15refactor: simplify some config -> constraints code (#1383)Clement Tsang
* refactor: simplify some config -> constraints code * iteratively progress... * update bcr; this might need testing since I removed some old proc code * widget side * fix battery * fix widget tests with bandaid for now The issue was that the calculations assume a certain ratio for CPU legends. * add some tests * bump up * fix proc drawing issues So with the proc widget in certain places, there would be a panic during constraint determination. Looks like back when I wrote this I made some gross assumptions about certain things. In particular, the problem here was that the search added an additional "one" height, so that needs to be accounted for after we removed the "doubling" code. * tests * fix tests * reorganize tests * clippy * fix cross tests not working * fix builds for android
2024-01-08refactor: clean up help drawing code (#1374)Clement Tsang
* refactor: clean up the help drawing * a bit cleaner * add test * some fmt
2024-01-02refactor: clean up some more drawing/component code (#1372)Clement Tsang
* rename battery info widget file * add widget trait * move basic table arrows over * some renaming * more renaming and shuffling * cleanup * fmt
2024-01-01refactor: move around configuration-related files (#1370)Clement Tsang
* rename general utils file * refactor: move around some configuration files * more shuffling around * fix some ugly formatting
2024-01-01refactor: restructure canvas file folder structure (#1368)Clement Tsang
* refactor: group together some canvas files * rename file * more shuffling around * fmt * more shuffling Going to flatten widgets in another PR. * some docs * naming * fmt
2023-12-27refactor: pull data collection out of nested folder structure (#1364)Clement Tsang
* refactor: pull data collection out of nested folder structure * fix sysinfo * comment
2023-12-25deps: update ratatui version (#1362)Justin Martin
* cargo update ratatui * replace convert_arc_labels with convert_mem_labels * remove redundant generic --------- Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
2023-11-15chore: fix certain uninlined string format uses (#1310)Yuri Astrakhan
* Fixed uninlined args First ran this, and fixed a few more similar issues by hand ``` cargo clippy --workspace --fix --benches --tests --bins -- -A clippy::all -W clippy::uninlined_format_args ``` Note that in a few cases, format args were passed by ref - which is actually a tiny perf hit - compiler would not be able to optimize them. * revert change here since it contains a non-inlineable variable I'm not a fan of using it partially here * revert given the other formats above/below I would prefer keeping it like this --------- Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
2023-10-22chore: Minor cleanup - remove un-needed ident qualifiers (#1307)Yuri Astrakhan
Keep code a bit tidier and consistent (i.e. if an identifier already has a `use` entry above, why in some cases still prove a full path to it?)
2023-06-04refactor: change canvas macOS check to compile-time (#1184)Clement Tsang
2023-05-31deps: bump ratatui to 0.21.0 (#1178)Clement Tsang
2023-05-28refactor: remove typed builder from App struct (#1176)Clement Tsang
Another one on the chopping block. This also moves out the app widget logic to a separate struct.
2023-05-13refactor: use macros for initializing canvas styles (#1149)Clement Tsang
* refactor: use macros for initializing canvas styles * add quotes * Simplify macro * update tests * more renaming
2023-04-12feature: add buffer and cache memory (#1063)Twan Stok
* First implementation of cache memory data collection, mostly copied from RAM and swap implementations * First implementation of cache memory display, copied from RAM and swap implementations. placed cache as second in the list as it is more similar to the RAM than any other item in the list * expanded comment to explain method. * rustfmt * all cache-related code excluded on windows, in the process refactored src/data_conversion.rs convert_mem_label() to convert a single label instead of all at once * better factoring-out of cache memory logic to allow individual disabling * added --enable_cache_memory flag, disabled cache memory collection by default * renamed CCH to CHE not sure how i messed that up * changelog updated * Added command line flag documentation * updated config file documentation * specified that buffer and cache memory display does not work on windows * resolved merge conflicts * added documentation to cache memory data collection * capitalized Windows * implemented missing canvas styling logic * fixed misplaced no-windows flag * reduced colour collisions, as cache colour was the same as the first GPU colour * made FIFTH_COLOUR constant windows-only * Revert "made FIFTH_COLOUR constant windows-only" This reverts commit 72698f1dd7e2de7dbda843708ece6a3dba66f94f. * made FIFTH_COLOUR constant non-windows-only * minor fix for basic mode row count * Update src/app/data_harvester/memory/sysinfo.rs Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> * Update src/canvas/widgets/mem_basic.rs Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> * updated default_config.toml * formatting --------- Co-authored-by: ClementTsang <34804052+ClementTsang@users.noreply.github.com>
2023-02-18bug: fix selected text bg colour being wrong if only the fg colour was set ↵Clement Tsang
(#1021) * rename file to be more generic * fix selected text BG colour being wrong by default * update changelog * add test for bug
2023-01-19other: re-enable disk usage split, update help menu (#963)Clement Tsang
* Revert "other: revert disk usage change for now (#962)" This reverts commit d3661c23200a66c7dc01f4e534d8d7e97dc188d2. * some cleanup * update help menu * update screenshot * update changelog wording * Remove redundant newlines * Use type system to ensure help constants match in size
2022-12-27bug: fix dot marker setting not being considered (#934)Clement Tsang
* bug: fixes marker settings being ignored while rendering time charts * appease clippy
2022-11-26bug: fix possible gaps with widget layout spacing (#916)Clement Tsang
Fixes an occasional gap appearing due to how rect spacing was previously calculated.
2022-11-10refactor: run cargo +nightly fmt with group_imports (#885)Clement Tsang
* refactor: add some disabled unstable fmt options * run cargo +nightly fmt with group_imports * separate out the cfg-specific imports for clarity
2022-10-15feature: add gpu ram collector for nvidia feature flag (#794)Justin Martin
* add gpu ram collector for nvidia feature flag * add row for TX in basic layout * size gpu point_vec * use vec for mem basic widget drawing * remove to_owned * code review: change mem tuple to struct with cfg fields, rename mem_basic ratio and use vec macro for layout * build on freebsd
2022-10-13refactor: move point definition to tui_rs widget (#832)Clement Tsang
2022-10-12refactor: tables V2 (#749)Clement Tsang
* refactor: move to new data table implementation * more work towards refactor * move disk and temp over, fix longstanding bug with disk and temp if removing the last value and selected * work towards porting over CPU work towards porting over CPU fix typo partially port over cpu, fix some potentially inefficient concat_string calls more work towards cpu widget migration some refactoring * sortable data sortable data more refactoring some sort refactoring more refactoringgggg column refactoring renaming and reorganizing more refactoring regarding column logic add sort arrows again * move over sort menu * port over process port over process precommit temp temp two, remember to squash work fix broken ltr calculation and CPU hiding add back row styling temp fix a bunch of issues, get proc working more fixes around click fix frozen issues * fix dd process killing * revert some of the persistent config changes from #257 * fix colouring for trees * fix missing entries in tree * keep columns if there is no data * add and remove tests * Fix ellipsis
2022-09-03other: Clarify help menu (#800)Clement Tsang
* other: clarify that numbers are for help menu * bug: fix incorrect overscroll check, should be min
2022-08-22feature: Add zfs feature flag for arc memory (#784)Justin Martin
* freebsd clippy * add arc support * Code Review: moved runtime cfg checks to compile time and formatting * remove compile platform checks * add zfs feature flag to get_arc_data
2022-06-14docs: re-enable lib docs for development purposes (#750)Clement Tsang
Enables lib docs, primarily intended for dev use. Also change some existing documentation based on warnings (mainly broken/bare links).
2022-06-03refactoring: Move around components and state (#746)Clement Tsang
A small refactor to move some state/component files around in terms of file structure and code location. Should have no effect on logic.
2022-05-15bug: fix issues with macos and windows during refactorClementTsang
2022-05-15other: delete redundant code, run clippy and fmtClementTsang
2022-05-15refactor: more work towards unifying process codeClementTsang
A bunch of work towards also refactoring how the process widget gathers and converts data.
2022-05-15refactor: begin migration of process widgetClementTsang
2022-05-07refactor: consolidate disk and temp table drawing, refactor stateClementTsang
Disk and temp tables now share the same drawing logic, as well as consolidating the "text table" states into one single state, as opposed to two separate states (one for scroll and one for width calculations). BTW I know this is kinda an ugly design - creating a giant struct to call a function - hopefully that's temporary, I want to do a bigger refactor to consolidate more stuff together and therefore avoid this problem, but baby steps, right?
2022-04-28refactor: consolidate time graph componentsClementTsang
This consolidates all the time graph drawing to one main location, as well as some small improvements. This is helpful in that I don't have to reimplement the same thing across three locations if I have to make one change that in theory should affect them all. In particular, the CPU graph, memory graph, and network graph are all now using the same, generic implementation for drawing, which we call (for now) a component. Note this only affects drawing - it accepts some parameters affecting style and labels, as well as data points, and draw similarly to how it used to before. Widget-specific actions, or things affecting widget state, should all be handled by the widget-specific code instead. For example, our current implementation of x-axis autohide is still controlled by the widget, not the component, even if some of the code is shared. Components are, again, only responsible for drawing (at least for now). For that matter, the graph component does not have mutable access to any form of state outside of tui-rs' `Frame`. Note this *might* change in the future, where we might give the component state. Note that while functionally, the graph behaviour for now is basically the same, a few changes were made internally other than the move to components. The big change is that rather than using tui-rs' `Chart` for the underlying drawing, we now use a tweaked custom `TimeChart` tui-rs widget, which also handles all interpolation steps and some extra customization. Personally, I don't like having to deviate from the library's implementation, but this gives us more flexibility and allows greater control. For example, this allows me to move away from the old hacks required to do interpolation (where I had to mutate the existing list to avoid having to reallocate an extra vector just to insert one extra interpolated point). I can also finally allow customizable legends (which will be added in the future).
2022-04-28refactor: remove dead config screen codeClementTsang
This code was never used and might as well be removed for clarity's sake.
2022-04-28refactor: remove trait usage in component drawingClementTsang
When I was newer to Rust, I got the weird impression that you couldn't add functionality to a struct outside of the defining file without using a trait. That's obviously not true, so it's high time I got rid of it and just made it part of the impl of the class itself, rather than declaring a trait and then exporting/importing it.
2022-04-27bug: change as_ref() to build in Rust beta 1.61.0 (#711)Clement Tsang
This changes various as_ref() calls as needed in order for bottom to successfully build in Rust beta 1.61, as they were causing type inference issues. These calls were either removed or changed to an alternative that does build (e.g. as_slice()). Functionally, there should be no change. For context, see: - https://github.com/ClementTsang/bottom/issues/708 - https://github.com/rust-lang/rust/issues/96074
2022-01-27bug: fix issues caused by having a width that is too small (#665)Clement Tsang
Due to a missing check, you could resize the window to a width that was too small, and it would trigger an endless while-loop for any table while trying to redistribute remaining space. This has been rectified with an explicit check, as well as a smarter method of redistributing remaining space borrowed from the rewrite. This also adds explicit width checks for widgets that have borders; if the width is <2, before, it would panic. Note that the rewrite I have kinda fixes all these issues already, so I don't want to invest too hard into this, but this should be fine as a patch for now. Also note that minimal heights don't seem to be causing any issues, it just seems to be minimal widths.
2021-12-28Fix Clippy warnings (#647)Mateusz Mikuła
2021-12-27feature: add basic page up/down scrolling (#646)Clement Tsang
Adds page up/down scrolling support to respectively scroll up/down by a full page. Note that this is mostly just to get the feature out for those interested, and is admittedly a bit rushed - I will be rewriting all logic involving event handling as part of state refactor anyways, so this will also get changed in the work done there, and therefore, I kinda just sped through this.
2021-12-19bug: Fix process command flag breaking sorting (#627)Clement Tsang
Fixes the process_command flag/config not properly toggling off the name column and on the command column on initialization. This would cause sorting of that column to bug out.
2021-07-31other: Add RISC-V to unofficially supported targets (#565)Clement Tsang
Adds CI actions and documentation for RISC-V.
2021-04-24change: remove gap between CPU and columns in basic (#460)Clement Tsang
Removes the gap between the CPU section and other columns in basic mode.
2021-04-04feature: Rework network y-axis, linear interpolation for off-screen data (#437)Clement Tsang
Rewrite of the y-axis labeling and scaling for the network widget, along with more customization. This still has one step to be optimized (cache results so we don't have to recalculate the legend each time), but will be done in another PR for sake of this one being too large already. Furthermore, this change adds linear interpolation at the 0 point in the case a data point shoots too far back - this seems to have lead to ugly gaps to the left of graphs in some cases, because the left hand limit was not big enough for the data point. We address this by grabbing values just outside the time range and linearly interpolating at the leftmost limit. This affects all graph widgets (CPU, mem, network). This can be optimized, and will hopefully be prior to release in a separate change.
2021-03-12feature: Add support for displaying load average (#392)pvanheus
2021-02-18feature: Add mouse support to sorting columns (#413)Clement Tsang
Adds mouse support for sorting columns within the process widget. You can now click on the column header to sort (or invert the sort).
2021-02-15feature: Allow toggling advanced kill menu (#408)Clement Tsang
Allows toggling the advanced kill menu via --advanced_kill or advanced_kill=true.
2021-02-15feature: add nord and nord-light colours (#406)Clement Tsang
Adds colour schemes for Nord, along with a light variant.
2021-01-25bug: Workaround for strange rendering when there are <4 CPU entries reported ↵Clement Tsang
(#398) So it seems that tui-rs doesn't like rendering my CPU bars if the height is exactly 1. It needs at least 2. I have no idea why, this is probably something weird with how I render. This, of course, breaks when there is only one row to report (i.e. with a dual core setup in #397). The workaround switches the gap between the CPU and mem/net parts to 0, and increases the CPU's draw height by 1, only when the height is otherwise 1 (so the draw height is now at least 2). This does have the side effect of including an extra line to the side borders, but I think it's fine.
2020-12-22feature: Hide SWAP graph and legend in normal mode if SWAP is 0 (#372)Clement Tsang
Firstly, note this currently won't affect basic mode. There is code changes due to it, but instead, we'll just display `0.0B/0.0B` instead. I'm personally not really sure if we want to get rid of it in basic mode, since it'll leave an ugly gap in that mode. Anyways, this change is mainly for the normal mode. All this does is hide the legend entry and chart if the total SWAP drops to 0 KB. It also has a small change to do a unit check on the memory used, as well as slightly adjusting the calculation we use.
2020-12-15feature: Fine grained kill signals on unix (#263)Lukas Rysavy
* feature: added signal selection for killing in unix * feature: set default signal to 15 (TERM) * feature: selecting kill signal number with number keys * feature: mouse selection of kill signals * fix: restore working previous kill dialog for win * bug: more fixes for killing on windows * feature: made two digit number selection only work in time window * feature: replaced grid with scrollable list for kill signal selection * fix: handling scrolling myself * chore: replaced tui list with span so we actually know for sure where the buttons are * feature: always display cancel button in kill signal selection * chore: simplified as suggested in review * fix: made scrolling in kill list more intuitive * fix: differentiating macos from linux signals * fix: fixed reversed kill confirmation movement * chore: fixed unused warnings for windows * feature: added G and gg keybindings for kill signal list