-
-
Notifications
You must be signed in to change notification settings - Fork 198
tui: allow theming selected rows in hops table #1718
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
base: master
Are you sure you want to change the base?
tui: allow theming selected rows in hops table #1718
Conversation
|
@PerchunPak did you try running this? When I do, I see all rows in the table as selected/highlighted which is not what we want as there is no way to tell which row is currently selected.
This is because the call to I like the idea of making the background of the selected row configurable, but it needs to be done such that the default styling remains as it is today and that the currently selected row is visible. |
055a40a to
dd1c1be
Compare
hops-table-row-active-bg-color option|
The reason why this PR didn't work, is because
made me realize that I can change the modifier in that |
2533fc9 to
f41eba0
Compare
|
@PerchunPak I adjust the defaults to match the current style, so now: |
|
@PerchunPak the remaing issue is selected inactive rows. See hop 12 in this screenshot, it should be dimmed like hop 11
I think we'll need:
|
f41eba0 to
df0658a
Compare
|
@PerchunPak pushed changes to add the 4x needed styles. I'm not yet convinced if the complexity of having 4x styles for selected row (vs |
df0658a to
337c7cf
Compare
It happens when each round of tracing follows a different path through the network with a different length (number of hops). This is typically due to ECMP, which normally only impacts UDP and TCP traffic. Imagine a trace from a Src to a Dest such that the path followed* in rounds 1 and 2 is as follows:
If we combine all round by ttl (as Trippy does) we get the following table:
The columns round 1 and round 2 shows the active/inactive status as observed during that round. Here we can see that during round two, no probe responded for ttl=4 as the path through the network was shorter. Trippy will report ttl=4 as a previous round did respond for ttl=4, but it will be marked as inactive for the current round. It is of course entirely possible that in rounds 3..N the probe with ttl=4 will respond and therefore the ttl will be shown as active once more. To stress, a ttl not reporting in a given round does not indicate a problem with that host, it only indicates that the probe followed a different path through the network which took fewer hops than the previous path. Observing this will depend entirely on where the Src and Dest hosts are and how traffic is routed between them. Usually it can be seen with some trial end error over different Dest hosts when using UDP or TCP probes. Networks with heavy use of ECMP (such as the big cloud providers) tend to show this much more frequently. *In reality, each probe within a round is an independent trial, so we cannot say anything about the path a probe follows to a given ttl within a round. Trippy has some tricks to make this much more likely however. |
@PerchunPak as would I. I believe the vast majority of the Trippy TUI can have a custom bg/text colour, though there are a handful of exceptions such as this and it would be good to close the gaps. Moreover, I'd like Trippy to have first class support for named themes, perhaps included by default. I wrote a little about it here. Let me know if you're interested in working on that. |
|
Thanks for the explanation. I still couldn't get the skipped hops, so instead I just patched that function diff --git a/crates/trippy-core/src/state.rs b/crates/trippy-core/src/state.rs
index 7d9da0a..4db5379 100644
--- a/crates/trippy-core/src/state.rs
+++ b/crates/trippy-core/src/state.rs
@@ -512,7 +512,7 @@ impl FlowState {
}
const fn is_in_round(&self, hop: &Hop) -> bool {
- hop.ttl <= self.highest_ttl_for_round
+ hop.ttl <= (self.highest_ttl_for_round - 3)
}
fn target_hop(&self) -> &Hop {I like the current solution, much better than what I had staged right before you committed. Personally, I wouldn't dim the background of skipped hops, but that's just my taste.
I already have four catppuccin themes ready in https://github.com/PerchunPak/ctp-trippy/tree/main/themes, but they are not yet updated to the latest changes here. I can make other popular themes as well I would imagine the |




Previously, it used
hops-table-row-active-text-colorfor background (applied it to foreground, then for some reason applied inversion filter (switch foreground and background places)). This resulted in usingbg-coloras foreground.Now, there is just a new option for that, and there is no filter. I have changed the default value for
hops-table-row-active-text-color(because it was technically a setting for background color, not foreground) to black (default value forbg-color).Tested with #1717, but did not include it in this PR.
Closes #1735