diff options
author | cyqsimon <28627918+cyqsimon@users.noreply.github.com> | 2023-10-19 16:55:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-19 16:55:04 +0800 |
commit | 0c4987aa86dc5210c11024b74f3f8947ba1358ac (patch) | |
tree | d133948be851cb4209a006237dd99fda25d1909c /src/tests | |
parent | d9cc84b3732fe9cb0c819b93d67d2a6420f6a065 (diff) |
Table formatting logic overhaul (#305)
* Table formatting logic overhaul
- Columns now auto-expand and auto-shrink proportionally
- Data column selection logic is now set per-table
- Necessary boilerplate added to allow tables with more (or fewer) columns in the future
* Better naming: `TableLayout` -> `DisplayLayout`
* Fix clippy complaints
* Optimise layout cutoff widths
- These values are pretty much arbitrary. I'm open to further optimising them in the future.
* Updated test snapshots to match new layout settings
* Remove unnecessary logging
* Correct `debug_fn` impl for `column_selector`
* Further optimise bandwidth column display
* Update test snapshots
* Layout width preset minor adjustment
Diffstat (limited to 'src/tests')
34 files changed, 260 insertions, 260 deletions
diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap index 7dfb89c..cbb9496 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap @@ -2,9 +2,9 @@ source: src/tests/cases/ui.rs expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - Total Up / Down: 0Bps / 0Bps + Total Rate (Up / Down): 0.00B / 0.00B ┌Utilization by remote address───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│Remote Address Connections Up / Down │ +│Remote Address Connections Rate (Up / Down) │ │ │ │ │ │ │ diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap index ce0e15a..61bdb23 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap @@ -2,9 +2,9 @@ source: src/tests/cases/ui.rs expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - Total Up / Down: 0Bps / 0Bps + Total Rate (Up / Down): 0.00B / 0.00B ┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│Connection Process Up / Down │ +│Connection Process Rate (Up / Down) │ │ │ │ │ │ │ diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap index 74471af..6ea91e9 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap @@ -2,9 +2,9 @@ source: src/tests/cases/ui.rs expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - Total Up / Down: 0Bps / 0Bps + Total Rate (Up / Down): 0.00B / 0.00B ┌Utilization by process name─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│Process Connections Up / Down │ +│Process Connections Rate (Up / Down) │ │ │ │ │ │ │ diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap index d112db0..905f34a 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap @@ -2,9 +2,9 @@ source: src/tests/cases/ui.rs expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - Total Up / Down: 0Bps / 0Bps + Total Rate (Up / Down): 0.00B / 0.00B ┌Utilization by process name─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│Process Connections Up / Down │ +│Process Connections Rate (Up / Down) │ │ │ │ │ │ │ diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap index 3244791..f1056c8 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap @@ -2,9 +2,9 @@ source: src/tests/cases/ui.rs expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - Total Up / Down: 0Bps / 0Bps + Total Rate (Up / Down): 0.00B / 0.00B ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ -│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│Process Connections Rate (Up / Down) ││Remote Address Connections Rate (Up / Down) │ │ ││ │ │ ││ │ │ ││ │ @@ -28,7 +28,7 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR │ ││ │ └─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ ┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│Connection Process Up / Down │ +│Connection Process Rate (Up / Down) │ │ │ │ │ │ │ diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap index 4ddabc7..de1acbe 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap @@ -2,9 +2,9 @@ source: src/tests/cases/ui.rs expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - Total Up / Down: 0Bps / 0Bps + Total Rate (Up / Down): 0.00B / 0.00B ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ -│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│Process Connections Rate (Up / Down) ││Remote Address Connections Rate (Up / Down) │ │ ││ │ │ ││ │ │ ││ │ @@ -28,7 +28,7 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR │ ││ │ └─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘ ┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│Connection Process Up / Down │ +│Connection Process Rate (Up / Down) │ │ │ │ │ │ │ @@ -54,10 +54,10 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR Press <SPACE> to pause. Use <TAB> to rearrange tables. (DNS queries hidden). --- SECTION SEPARATOR --- - 24Bps / 25Bps + 24. 0B / 25.00B - 1 1 24Bps / 25Bps 1.1.1.1 1 24Bps / 25Bps + 1 1 24.00B / 25.00B 1.1.1.1 1 24.00B / 25.00B @@ -81,7 +81,7 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR - <interface_name>:443 => 1.1.1.1:12345 (tcp) 1 24Bps / 25Bps + <interface_name>:443 => 1.1.1.1:12345 (tcp) 1 24.00B / 25.00B diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap index 3a2696a..c00c367 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap @@ -2,9 +2,9 @@ source: src/tests/cases/ui.rs expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - Total Up / Down: 0Bps / 0Bps + Total Rate (Up / Down): 0.00B / 0.00B ┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐ -│Process Connections Up / Down ││Remote Address Connections Up / Down │ +│Process Connections Rate (Up / Down) ││Remote Address Connections Rate (Up / Down) │ │ ││ │ │ ││ │ │ ││ │ @@ -33,13 +33,13 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR Press <SPACE> to pause. Use <TAB> to rearrange tables. (DNS queries hidden). --- SECTION SEPARATOR --- - 98Bps + 98. 0B - 5 1 0Bps / 28Bps 3.3.3.3 1 0Bps / 28Bps - 4 1 0Bps / 26Bps 2.2.2.2 1 0Bps / 26Bps - 1 1 0Bps / 22Bps 1.1.1.1 1 0Bps / 22Bps - 2 1 0Bps / 21Bps 4.4.4.4 1 0Bps / 21Bps + 5 1 0.00B / 28.00B 3.3.3.3 1 0.00B / 28.00B + 4 1 0.00B / 26.00B 2.2.2.2 1 0.00B / 26.00B + 1 1 0.00B / 22.00B 1.1.1.1 1 0.00B / 22.00B + 2 1 0.00B / 21.00B 4.4.4.4 1 0.00B / 21.00B diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap index b0ef8e1..4a9c967 100644 --- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap +++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap @@ -2,9 +2,9 @@ source: src/tests/cases/ui.rs expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR) --- - Total Up / Down: 0Bps / 0Bps + Total Rate (Up / Down): 0.00B / 0.00B ┌Utilization by process name──────────────────────────────────────────────────────────────────────────────────────────┐ -│Process Connections Up / Down │ +│Process Connections Rate (Up / Down) │ │ │ │ │ │ │ @@ -28,7 +28,7 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR │ │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ┌Utilization by remote address────────────────────────────────────────────────────────────────────────────────────────┐ -│Remote Address Connections Up / Down │ +│Remote Address Connections Rate (Up / Down) │ │ │ │ │ │ │ @@ -54,13 +54,13 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR Press <SPACE> to pause. Use <TAB> to rearrange tables. (DNS queries hidden). |