Skip to content

Commit 29c1b69

Browse files
authored
Add metrics section (#39)
1 parent 0ed04df commit 29c1b69

File tree

8 files changed

+604
-91
lines changed

8 files changed

+604
-91
lines changed

Cargo.lock

Lines changed: 42 additions & 87 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Real-time traffic inspection and visualization.
1212
- Comprehensive Traffic Statistics.
1313
- Firewall functionalities.
14+
- Metrics explorer.
1415
- Fuzzy search.
1516

1617
## 💡 Prerequisites

oryx-tui/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ aya = "0.13"
1818
oryx-common = { path = "../oryx-common" }
1919
mio = { version = "1", features = ["os-poll", "os-ext"] }
2020
itertools = "0.14"
21-
dirs = "5"
21+
dirs = "6"
2222
kanal = "0.1.0-pre8"
2323
mimalloc = "0.1"
2424
clap = { version = "4", features = ["derive", "cargo"] }
@@ -28,6 +28,7 @@ log = "0.4"
2828
env_logger = "0.11"
2929
serde_json = "1"
3030
serde = { version = "1", features = ["derive"] }
31+
regex = "1"
3132

3233
[[bin]]
3334
name = "oryx"

oryx-tui/src/app.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub enum ActivePopup {
2828
UpdateFilters,
2929
PacketInfos,
3030
NewFirewallRule,
31+
NewMetricExplorer,
3132
}
3233

3334
#[derive(Debug)]

oryx-tui/src/handler.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ pub fn handle_key_events(
7070
.handle_keys(key_event, event_sender.clone())?;
7171
app.is_editing = false;
7272
}
73+
ActivePopup::NewMetricExplorer => {
74+
app.section.metrics.handle_popup_keys(key_event)?;
75+
app.is_editing = false;
76+
}
7377
_ => {}
7478
}
7579
}
@@ -92,6 +96,12 @@ pub fn handle_key_events(
9296
app.is_editing = false;
9397
}
9498
}
99+
ActivePopup::NewMetricExplorer => {
100+
if app.section.metrics.handle_popup_keys(key_event).is_ok() {
101+
app.active_popup = None;
102+
app.is_editing = false;
103+
}
104+
}
95105
_ => {}
96106
},
97107

@@ -104,6 +114,9 @@ pub fn handle_key_events(
104114
.firewall
105115
.handle_keys(key_event, event_sender.clone())?;
106116
}
117+
ActivePopup::NewMetricExplorer => {
118+
app.section.metrics.handle_popup_keys(key_event)?;
119+
}
107120
_ => {}
108121
},
109122
}
@@ -158,11 +171,21 @@ pub fn handle_key_events(
158171

159172
KeyCode::Char('n') | KeyCode::Char('e') => {
160173
if app.section.focused_section == FocusedSection::Firewall
161-
&& app.section.handle_keys(key_event, event_sender).is_ok()
174+
&& app
175+
.section
176+
.handle_keys(key_event, event_sender.clone())
177+
.is_ok()
162178
{
163179
app.is_editing = true;
164180
app.active_popup = Some(ActivePopup::NewFirewallRule);
165181
}
182+
183+
if app.section.focused_section == FocusedSection::Metrics
184+
&& app.section.handle_keys(key_event, event_sender).is_ok()
185+
{
186+
app.is_editing = true;
187+
app.active_popup = Some(ActivePopup::NewMetricExplorer);
188+
}
166189
}
167190

168191
KeyCode::Char('i') => {

0 commit comments

Comments
 (0)