tests: updated tests
This commit is contained in:
+4
-2
@@ -45,6 +45,9 @@ tracing = "0.1"
|
|||||||
tracing-subscriber = "0.3"
|
tracing-subscriber = "0.3"
|
||||||
uuid = { version = "1.19", features = ["fast-rng", "v4"] }
|
uuid = { version = "1.19", features = ["fast-rng", "v4"] }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
insta = "1.42.2"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
@@ -52,5 +55,4 @@ panic = 'abort'
|
|||||||
strip = true
|
strip = true
|
||||||
debug = false
|
debug = false
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
insta = "1.42.2"
|
|
||||||
|
|||||||
+10
-8
@@ -173,9 +173,10 @@ impl AppData {
|
|||||||
|
|
||||||
pub fn log_search_scroll(&mut self, np: &ScrollDirection) {
|
pub fn log_search_scroll(&mut self, np: &ScrollDirection) {
|
||||||
if let Some(i) = self.get_mut_selected_container()
|
if let Some(i) = self.get_mut_selected_container()
|
||||||
&& i.logs.search_scroll(np).is_some() {
|
&& i.logs.search_scroll(np).is_some()
|
||||||
self.rerender.update_draw();
|
{
|
||||||
}
|
self.rerender.update_draw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn gen_log_search(&self) -> Option<LogSearch> {
|
pub fn gen_log_search(&self) -> Option<LogSearch> {
|
||||||
@@ -340,12 +341,13 @@ impl AppData {
|
|||||||
pub fn set_sort_by_header(&mut self, selected_header: Header) {
|
pub fn set_sort_by_header(&mut self, selected_header: Header) {
|
||||||
let mut output = Some((selected_header, SortedOrder::Asc));
|
let mut output = Some((selected_header, SortedOrder::Asc));
|
||||||
if let Some((current_header, order)) = self.get_sorted()
|
if let Some((current_header, order)) = self.get_sorted()
|
||||||
&& current_header == selected_header {
|
&& current_header == selected_header
|
||||||
match order {
|
{
|
||||||
SortedOrder::Desc => output = None,
|
match order {
|
||||||
SortedOrder::Asc => output = Some((selected_header, SortedOrder::Desc)),
|
SortedOrder::Desc => output = None,
|
||||||
}
|
SortedOrder::Asc => output = Some((selected_header, SortedOrder::Desc)),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
self.set_sorted(output);
|
self.set_sorted(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-15
@@ -159,20 +159,21 @@ impl From<Option<ConfigKeymap>> for Keymap {
|
|||||||
keymap_field: &mut (KeyCode, Option<KeyCode>),
|
keymap_field: &mut (KeyCode, Option<KeyCode>),
|
||||||
keymap_clash: &mut HashSet<KeyCode>| {
|
keymap_clash: &mut HashSet<KeyCode>| {
|
||||||
if let Some(vec_str) = vec_str
|
if let Some(vec_str) = vec_str
|
||||||
&& let Some(vec_keycode) = Self::try_parse_keycode(&vec_str) {
|
&& let Some(vec_keycode) = Self::try_parse_keycode(&vec_str)
|
||||||
if let Some(first) = vec_keycode.first() {
|
{
|
||||||
keymap_clash.insert(*first);
|
if let Some(first) = vec_keycode.first() {
|
||||||
counter += 1;
|
keymap_clash.insert(*first);
|
||||||
keymap_field.0 = *first;
|
counter += 1;
|
||||||
}
|
keymap_field.0 = *first;
|
||||||
if let Some(second) = vec_keycode.get(1) {
|
|
||||||
keymap_clash.insert(*second);
|
|
||||||
counter += 1;
|
|
||||||
keymap_field.1 = Some(*second);
|
|
||||||
} else {
|
|
||||||
keymap_field.1 = None;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if let Some(second) = vec_keycode.get(1) {
|
||||||
|
keymap_clash.insert(*second);
|
||||||
|
counter += 1;
|
||||||
|
keymap_field.1 = Some(*second);
|
||||||
|
} else {
|
||||||
|
keymap_field.1 = None;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(ck) = value {
|
if let Some(ck) = value {
|
||||||
@@ -282,9 +283,10 @@ impl Keymap {
|
|||||||
Some(first_char)
|
Some(first_char)
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
} {
|
|
||||||
output.push(KeyCode::Char(first_char));
|
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
output.push(KeyCode::Char(first_char));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let keycode = match key.to_lowercase().as_str() {
|
let keycode = match key.to_lowercase().as_str() {
|
||||||
"f1" => Some(KeyCode::F(1)),
|
"f1" => Some(KeyCode::F(1)),
|
||||||
|
|||||||
+3
-3
@@ -214,9 +214,9 @@ impl Config {
|
|||||||
if let Some(config_file) = &args.config_file
|
if let Some(config_file) = &args.config_file
|
||||||
&& let Some(config_file) =
|
&& let Some(config_file) =
|
||||||
parse_config_file::ConfigFile::try_parse_from_file(config_file)
|
parse_config_file::ConfigFile::try_parse_from_file(config_file)
|
||||||
{
|
{
|
||||||
return Self::from(config_file).merge_args(config_from_cli);
|
return Self::from(config_file).merge_args(config_from_cli);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(config_file) = parse_config_file::ConfigFile::try_parse(in_container) {
|
if let Some(config_file) = parse_config_file::ConfigFile::try_parse(in_container) {
|
||||||
return Self::from(config_file).merge_args(config_from_cli);
|
return Self::from(config_file).merge_args(config_from_cli);
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ impl DockerData {
|
|||||||
if let std::collections::hash_map::Entry::Vacant(spawns) =
|
if let std::collections::hash_map::Entry::Vacant(spawns) =
|
||||||
self.spawns.lock().entry(spawn_id.clone())
|
self.spawns.lock().entry(spawn_id.clone())
|
||||||
{
|
{
|
||||||
// TODO Replace this with toktio tokens
|
// TODO Replace this with toktio tokens
|
||||||
spawns.insert(tokio::spawn(Self::update_container_stat(
|
spawns.insert(tokio::spawn(Self::update_container_stat(
|
||||||
Arc::clone(&self.app_data),
|
Arc::clone(&self.app_data),
|
||||||
Arc::clone(&self.docker),
|
Arc::clone(&self.docker),
|
||||||
|
|||||||
+29
-29
@@ -167,37 +167,37 @@ impl ExecMode {
|
|||||||
State::Running(RunningState::Unhealthy),
|
State::Running(RunningState::Unhealthy),
|
||||||
]
|
]
|
||||||
.contains(&state)
|
.contains(&state)
|
||||||
|
{
|
||||||
|
if tty_readable()
|
||||||
|
&& !use_cli
|
||||||
|
&& let Ok(exec) = docker
|
||||||
|
.create_exec(
|
||||||
|
id.get(),
|
||||||
|
CreateExecOptions {
|
||||||
|
attach_stdout: Some(true),
|
||||||
|
attach_stderr: Some(true),
|
||||||
|
cmd: Some(vec![command::PWD]),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
&& let Ok(StartExecResults::Attached { mut output, .. }) =
|
||||||
|
docker.start_exec(&exec.id, None).await
|
||||||
|
&& let Some(Ok(msg)) = output.next().await
|
||||||
|
&& !msg.to_string().starts_with(OCI_ERROR)
|
||||||
{
|
{
|
||||||
if tty_readable() && !use_cli
|
return Some(Self::Internal((Arc::new(id), Arc::clone(docker))));
|
||||||
&& let Ok(exec) = docker
|
|
||||||
.create_exec(
|
|
||||||
id.get(),
|
|
||||||
CreateExecOptions {
|
|
||||||
attach_stdout: Some(true),
|
|
||||||
attach_stderr: Some(true),
|
|
||||||
cmd: Some(vec![command::PWD]),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
&& let Ok(StartExecResults::Attached { mut output, .. }) =
|
|
||||||
docker.start_exec(&exec.id, None).await
|
|
||||||
&& let Some(Ok(msg)) = output.next().await
|
|
||||||
&& !msg.to_string().starts_with(OCI_ERROR) {
|
|
||||||
return Some(Self::Internal((
|
|
||||||
Arc::new(id),
|
|
||||||
Arc::clone(docker),
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Ok(output) = std::process::Command::new(command::DOCKER)
|
|
||||||
.args([command::EXEC, id.get(), command::PWD])
|
|
||||||
.output()
|
|
||||||
&& let Ok(output) = String::from_utf8(output.stdout)
|
|
||||||
&& !output.starts_with(OCI_ERROR) {
|
|
||||||
return Some(Self::External(Arc::new(id)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Ok(output) = std::process::Command::new(command::DOCKER)
|
||||||
|
.args([command::EXEC, id.get(), command::PWD])
|
||||||
|
.output()
|
||||||
|
&& let Ok(output) = String::from_utf8(output.stdout)
|
||||||
|
&& !output.starts_with(OCI_ERROR)
|
||||||
|
{
|
||||||
|
return Some(Self::External(Arc::new(id)));
|
||||||
|
}
|
||||||
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+45
-44
@@ -179,57 +179,58 @@ impl InputHandler {
|
|||||||
let args = self.app_data.lock().config.clone();
|
let args = self.app_data.lock().config.clone();
|
||||||
let container = self.app_data.lock().get_selected_container_id_state_name();
|
let container = self.app_data.lock().get_selected_container_id_state_name();
|
||||||
if let Some((id, _, name)) = container
|
if let Some((id, _, name)) = container
|
||||||
&& let Some(log_path) = args.save_dir {
|
&& let Some(log_path) = args.save_dir
|
||||||
let (sx, rx) = tokio::sync::oneshot::channel();
|
{
|
||||||
self.docker_tx.send(DockerMessage::Exec(sx)).await?;
|
let (sx, rx) = tokio::sync::oneshot::channel();
|
||||||
|
self.docker_tx.send(DockerMessage::Exec(sx)).await?;
|
||||||
|
|
||||||
let now = SystemTime::now()
|
let now = SystemTime::now()
|
||||||
.duration_since(SystemTime::UNIX_EPOCH)
|
.duration_since(SystemTime::UNIX_EPOCH)
|
||||||
.map_or(0, |i| i.as_secs());
|
.map_or(0, |i| i.as_secs());
|
||||||
|
|
||||||
let path = log_path.join(format!("{name}_{now}.log"));
|
let path = log_path.join(format!("{name}_{now}.log"));
|
||||||
|
|
||||||
let options = Some(LogsOptions {
|
let options = Some(LogsOptions {
|
||||||
stderr: true,
|
stderr: true,
|
||||||
stdout: true,
|
stdout: true,
|
||||||
timestamps: args.show_timestamp,
|
timestamps: args.show_timestamp,
|
||||||
since: 0,
|
since: 0,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
let mut logs = rx.await?.logs(id.get(), options);
|
let mut logs = rx.await?.logs(id.get(), options);
|
||||||
let mut output = vec![];
|
let mut output = vec![];
|
||||||
|
|
||||||
while let Some(Ok(value)) = logs.next().await {
|
while let Some(Ok(value)) = logs.next().await {
|
||||||
let data = value.to_string();
|
let data = value.to_string();
|
||||||
if !data.trim().is_empty() {
|
if !data.trim().is_empty() {
|
||||||
output.push(
|
output.push(
|
||||||
categorise_text(&data)
|
categorise_text(&data)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|i| i.text)
|
.map(|i| i.text)
|
||||||
.collect::<String>(),
|
.collect::<String>(),
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !output.is_empty() {
|
|
||||||
let mut stream = BufWriter::new(
|
|
||||||
OpenOptions::new()
|
|
||||||
.read(true)
|
|
||||||
.write(true)
|
|
||||||
.create(true)
|
|
||||||
.truncate(true)
|
|
||||||
.open(&path)?,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
for line in &output {
|
|
||||||
stream.write_all(line.as_bytes())?;
|
|
||||||
}
|
|
||||||
stream.flush()?;
|
|
||||||
|
|
||||||
self.gui_state
|
|
||||||
.lock()
|
|
||||||
.set_info_box(&format!("saved to {}", path.display()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !output.is_empty() {
|
||||||
|
let mut stream = BufWriter::new(
|
||||||
|
OpenOptions::new()
|
||||||
|
.read(true)
|
||||||
|
.write(true)
|
||||||
|
.create(true)
|
||||||
|
.truncate(true)
|
||||||
|
.open(&path)?,
|
||||||
|
);
|
||||||
|
|
||||||
|
for line in &output {
|
||||||
|
stream.write_all(line.as_bytes())?;
|
||||||
|
}
|
||||||
|
stream.flush()?;
|
||||||
|
|
||||||
|
self.gui_state
|
||||||
|
.lock()
|
||||||
|
.set_info_box(&format!("saved to {}", path.display()));
|
||||||
|
}
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -194,42 +194,41 @@ mod tests {
|
|||||||
];
|
];
|
||||||
|
|
||||||
// co-ordinates of the dots from the cpu chart
|
// co-ordinates of the dots from the cpu chart
|
||||||
const CPU_XY: [(usize, usize); 15] = [
|
const CPU_XY: [(usize, usize); 16] = [
|
||||||
(1, 12),
|
(1, 13),
|
||||||
(2, 11),
|
|
||||||
(2, 12),
|
(2, 12),
|
||||||
(3, 10),
|
(2, 13),
|
||||||
(3, 11),
|
(3, 11),
|
||||||
(3, 12),
|
(3, 13),
|
||||||
(4, 10),
|
(4, 11),
|
||||||
(4, 12),
|
(4, 13),
|
||||||
(5, 9),
|
(5, 10),
|
||||||
(5, 13),
|
(5, 13),
|
||||||
(5, 14),
|
(6, 9),
|
||||||
(6, 8),
|
|
||||||
(6, 13),
|
(6, 13),
|
||||||
|
(6, 14),
|
||||||
(7, 8),
|
(7, 8),
|
||||||
|
(7, 9),
|
||||||
(7, 13),
|
(7, 13),
|
||||||
|
(7, 14),
|
||||||
];
|
];
|
||||||
|
|
||||||
// co-ordinates of the dots from the memory chart
|
// co-ordinates of the dots from the memory chart
|
||||||
const MEM_XY: [(usize, usize); 16] = [
|
const MEM_XY: [(usize, usize); 14] = [
|
||||||
(1, 54),
|
|
||||||
(1, 55),
|
(1, 55),
|
||||||
(2, 54),
|
(2, 54),
|
||||||
(2, 55),
|
(2, 55),
|
||||||
(3, 53),
|
(3, 54),
|
||||||
(3, 55),
|
(3, 55),
|
||||||
(4, 52),
|
(4, 53),
|
||||||
(4, 55),
|
(4, 55),
|
||||||
(5, 51),
|
|
||||||
(5, 52),
|
(5, 52),
|
||||||
(5, 55),
|
(5, 53),
|
||||||
(5, 56),
|
(5, 56),
|
||||||
(6, 51),
|
(6, 52),
|
||||||
(6, 55),
|
(6, 56),
|
||||||
(7, 51),
|
(7, 51),
|
||||||
(7, 55),
|
(7, 56),
|
||||||
];
|
];
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -336,6 +335,7 @@ mod tests {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_snapshot!(setup.terminal.backend());
|
assert_snapshot!(setup.terminal.backend());
|
||||||
|
//
|
||||||
|
|
||||||
for (row_index, result_row) in get_result(&setup) {
|
for (row_index, result_row) in get_result(&setup) {
|
||||||
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
||||||
|
|||||||
@@ -40,13 +40,14 @@ fn gen_header_block<'a>(colors: AppColors, fd: &FrameData, header: Header) -> (C
|
|||||||
let mut color = colors.headers_bar.text;
|
let mut color = colors.headers_bar.text;
|
||||||
let mut suffix = "";
|
let mut suffix = "";
|
||||||
if let Some((a, b)) = &fd.sorted_by
|
if let Some((a, b)) = &fd.sorted_by
|
||||||
&& &header == a {
|
&& &header == a
|
||||||
match b {
|
{
|
||||||
SortedOrder::Asc => suffix = " ▲",
|
match b {
|
||||||
SortedOrder::Desc => suffix = " ▼",
|
SortedOrder::Asc => suffix = " ▲",
|
||||||
}
|
SortedOrder::Desc => suffix = " ▼",
|
||||||
color = colors.headers_bar.text_selected;
|
|
||||||
}
|
}
|
||||||
|
color = colors.headers_bar.text_selected;
|
||||||
|
}
|
||||||
|
|
||||||
(color, suffix)
|
(color, suffix)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,11 +104,12 @@ fn generate_block<'a>(
|
|||||||
.title(ratatui::text::Line::from(title).left_aligned());
|
.title(ratatui::text::Line::from(title).left_aligned());
|
||||||
|
|
||||||
if panel == SelectablePanel::Logs
|
if panel == SelectablePanel::Logs
|
||||||
&& let Some(x) = fd.scroll_title.as_ref() {
|
&& let Some(x) = fd.scroll_title.as_ref()
|
||||||
block = block
|
{
|
||||||
.title_bottom(x.to_owned())
|
block = block
|
||||||
.title_alignment(ratatui::layout::Alignment::Right);
|
.title_bottom(x.to_owned())
|
||||||
}
|
.title_alignment(ratatui::layout::Alignment::Right);
|
||||||
|
}
|
||||||
if !fd.status.contains(&Status::Filter) {
|
if !fd.status.contains(&Status::Filter) {
|
||||||
if fd.selected_panel == panel {
|
if fd.selected_panel == panel {
|
||||||
block = block.border_style(Style::default().fg(colors.borders.selected));
|
block = block.border_style(Style::default().fg(colors.borders.selected));
|
||||||
|
|||||||
+7
-7
@@ -3,12 +3,12 @@ source: src/ui/draw_blocks/charts.rs
|
|||||||
expression: setup.terminal.backend()
|
expression: setup.terminal.backend()
|
||||||
---
|
---
|
||||||
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
|
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
|
||||||
"│10.00%│ • ││100.00 kB│ •• │"
|
"│10.00%│ • ││100.00 kB│ • │"
|
||||||
"│ │ •• ││ │ •• │"
|
"│ │ •• ││ │ •• │"
|
||||||
"│ │ ••• ││ │ • • │"
|
"│ │ • • ││ │ •• │"
|
||||||
"│ │ • • ││ │ • • │"
|
"│ │ • • ││ │ • • │"
|
||||||
"│ │ • •• ││ │•• •• │"
|
"│ │ • • ││ │ •• • │"
|
||||||
"│ │• • ││ │• • │"
|
"│ │ • •• ││ │ • • │"
|
||||||
"│ │• • ││ │• • │"
|
"│ │•• •• ││ │• • │"
|
||||||
"│ │ ││ │ │"
|
"│ │ ││ │ │"
|
||||||
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
|
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
|
||||||
|
|||||||
+7
-7
@@ -3,12 +3,12 @@ source: src/ui/draw_blocks/charts.rs
|
|||||||
expression: setup.terminal.backend()
|
expression: setup.terminal.backend()
|
||||||
---
|
---
|
||||||
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
|
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
|
||||||
"│10.00%│ • ││100.00 kB│ •• │"
|
"│10.00%│ • ││100.00 kB│ • │"
|
||||||
"│ │ •• ││ │ •• │"
|
"│ │ •• ││ │ •• │"
|
||||||
"│ │ ••• ││ │ • • │"
|
"│ │ • • ││ │ •• │"
|
||||||
"│ │ • • ││ │ • • │"
|
"│ │ • • ││ │ • • │"
|
||||||
"│ │ • •• ││ │•• •• │"
|
"│ │ • • ││ │ •• • │"
|
||||||
"│ │• • ││ │• • │"
|
"│ │ • •• ││ │ • • │"
|
||||||
"│ │• • ││ │• • │"
|
"│ │•• •• ││ │• • │"
|
||||||
"│ │ ││ │ │"
|
"│ │ ││ │ │"
|
||||||
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
|
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
|
||||||
|
|||||||
+7
-7
@@ -3,12 +3,12 @@ source: src/ui/draw_blocks/charts.rs
|
|||||||
expression: setup.terminal.backend()
|
expression: setup.terminal.backend()
|
||||||
---
|
---
|
||||||
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
|
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
|
||||||
"│10.00%│ • ││100.00 kB│ •• │"
|
"│10.00%│ • ││100.00 kB│ • │"
|
||||||
"│ │ •• ││ │ •• │"
|
"│ │ •• ││ │ •• │"
|
||||||
"│ │ ••• ││ │ • • │"
|
"│ │ • • ││ │ •• │"
|
||||||
"│ │ • • ││ │ • • │"
|
"│ │ • • ││ │ • • │"
|
||||||
"│ │ • •• ││ │•• •• │"
|
"│ │ • • ││ │ •• • │"
|
||||||
"│ │• • ││ │• • │"
|
"│ │ • •• ││ │ • • │"
|
||||||
"│ │• • ││ │• • │"
|
"│ │•• •• ││ │• • │"
|
||||||
"│ │ ││ │ │"
|
"│ │ ││ │ │"
|
||||||
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
|
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
|
||||||
|
|||||||
+7
-7
@@ -3,12 +3,12 @@ source: src/ui/draw_blocks/charts.rs
|
|||||||
expression: setup.terminal.backend()
|
expression: setup.terminal.backend()
|
||||||
---
|
---
|
||||||
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
|
"╭───────────── cpu 03.00% ─────────────╮╭────────── memory 30.00 kB ───────────╮"
|
||||||
"│10.00%│ • ││100.00 kB│ •• │"
|
"│10.00%│ • ││100.00 kB│ • │"
|
||||||
"│ │ •• ││ │ •• │"
|
"│ │ •• ││ │ •• │"
|
||||||
"│ │ ••• ││ │ • • │"
|
"│ │ • • ││ │ •• │"
|
||||||
"│ │ • • ││ │ • • │"
|
"│ │ • • ││ │ • • │"
|
||||||
"│ │ • •• ││ │•• •• │"
|
"│ │ • • ││ │ •• • │"
|
||||||
"│ │• • ││ │• • │"
|
"│ │ • •• ││ │ • • │"
|
||||||
"│ │• • ││ │• • │"
|
"│ │•• •• ││ │• • │"
|
||||||
"│ │ ││ │ │"
|
"│ │ ││ │ │"
|
||||||
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
|
"╰──────────────────────────────────────╯╰──────────────────────────────────────╯"
|
||||||
|
|||||||
+5
-5
@@ -26,9 +26,9 @@ expression: setup.terminal.backend()
|
|||||||
"│ │"
|
"│ │"
|
||||||
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
||||||
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
||||||
"│10.00%│ ••• ││100.00 kB│ •• ││ ip private public│"
|
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
|
||||||
"│ │ •• • ││ │ •• • ││ 8001 │"
|
"│ │ • • ││ │ •• • ││ 8001 │"
|
||||||
"│ │ ••• • • ││ │ ••• • • ││127.0.0.1 8003 8003│"
|
"│ │ ••• • ││ │ •• • ││127.0.0.1 8003 8003│"
|
||||||
"│ │• •• ││ │• •• ││ │"
|
"│ │ •• ••• ││ │ •• •• ││ │"
|
||||||
"│ │ ││ │ ││ │"
|
"│ │• • ││ │• • ││ │"
|
||||||
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
||||||
|
|||||||
+7
-7
@@ -33,12 +33,12 @@ expression: setup.terminal.backend()
|
|||||||
"│ │"
|
"│ │"
|
||||||
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
||||||
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
||||||
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
|
"│10.00%│ • ││100.00 kB│ • ││ ip private public│"
|
||||||
"│ │ • • ││ │ •• ││ 8001 │"
|
"│ │ ••• ││ │ ••• ││ 8001 │"
|
||||||
"│ │ •• • ││ │ •• • ││127.0.0.1 8003 8003│"
|
"│ │ • • ││ │ • • ││127.0.0.1 8003 8003│"
|
||||||
"│ │ • • ││ │ • • ││ │"
|
"│ │ • • ││ │ • • ││ │"
|
||||||
"│ │ •• • • ││ │ •• • • ││ │"
|
"│ │ •• • ││ │ • • ││ │"
|
||||||
"│ │• •• ││ │• •• ││ │"
|
"│ │ • • • ││ │ • •• ││ │"
|
||||||
"│ │• • ││ │• • ││ │"
|
"│ │•• •• ││ │•• •• ││ │"
|
||||||
"│ │ ││ │ ││ │"
|
"│ │ ││ │ ││ │"
|
||||||
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
||||||
|
|||||||
+7
-7
@@ -33,12 +33,12 @@ expression: setup.terminal.backend()
|
|||||||
"│ │"
|
"│ │"
|
||||||
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
||||||
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
||||||
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
|
"│10.00%│ • ││100.00 kB│ • ││ ip private public│"
|
||||||
"│ │ • • ││ │ •• ││ 8001 │"
|
"│ │ ••• ││ │ ••• ││ 8001 │"
|
||||||
"│ │ •• • ││ │ •• • ││127.0.0.1 8003 8003│"
|
"│ │ • • ││ │ • • ││127.0.0.1 8003 8003│"
|
||||||
"│ │ • • ││ │ • • ││ │"
|
"│ │ • • ││ │ • • ││ │"
|
||||||
"│ │ •• • • ││ │ •• • • ││ │"
|
"│ │ •• • ││ │ • • ││ │"
|
||||||
"│ │• •• ││ │• •• ││ │"
|
"│ │ • • • ││ │ • •• ││ │"
|
||||||
"│ │• • ││ │• • ││ │"
|
"│ │•• •• ││ │•• •• ││ │"
|
||||||
"│ │ ││ │ ││ │"
|
"│ │ ││ │ ││ │"
|
||||||
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
||||||
|
|||||||
+7
-7
@@ -33,12 +33,12 @@ expression: setup.terminal.backend()
|
|||||||
"│ │ ( 1 - 9 ) sort by header - or click header │ │"
|
"│ │ ( 1 - 9 ) sort by header - or click header │ │"
|
||||||
"╰────────────────────────────────────│ ( - = ) change log section height │────────────────────────────────────╯"
|
"╰────────────────────────────────────│ ( - = ) change log section height │────────────────────────────────────╯"
|
||||||
"╭───────────────────────── cpu 03.00%│ ( \ ) toggle log section visibility │──────╮╭────────── ports ───────────╮"
|
"╭───────────────────────── cpu 03.00%│ ( \ ) toggle log section visibility │──────╮╭────────── ports ───────────╮"
|
||||||
"│10.00%│ •• │ ( esc ) close dialog │ ││ ip private public│"
|
"│10.00%│ • │ ( esc ) close dialog │ ││ ip private public│"
|
||||||
"│ │ • • │ ( q ) quit at any time │ ││ 8001 │"
|
"│ │ ••• │ ( q ) quit at any time │ ││ 8001 │"
|
||||||
"│ │ •• • │ │ ││127.0.0.1 8003 8003│"
|
"│ │ • • │ │ ││127.0.0.1 8003 8003│"
|
||||||
"│ │ • • │ currently an early work in progress, all and any input appreciated │ ││ │"
|
"│ │ • • │ currently an early work in progress, all and any input appreciated │ ││ │"
|
||||||
"│ │ •• • • │ https://github.com/mrjackwills/oxker │ ││ │"
|
"│ │ •• • │ https://github.com/mrjackwills/oxker │ ││ │"
|
||||||
"│ │• •• │ │ ││ │"
|
"│ │ • • • │ │ ││ │"
|
||||||
"│ │• • ╰────────────────────────────────────────────────────────────────────────────────────╯ ││ │"
|
"│ │•• •• ╰────────────────────────────────────────────────────────────────────────────────────╯ ││ │"
|
||||||
"│ │ ││ │ ││ │"
|
"│ │ ││ │ ││ │"
|
||||||
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
||||||
|
|||||||
+7
-7
@@ -33,12 +33,12 @@ expression: setup.terminal.backend()
|
|||||||
"│ │"
|
"│ │"
|
||||||
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
||||||
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
||||||
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
|
"│10.00%│ • ││100.00 kB│ • ││ ip private public│"
|
||||||
"│ │ • • ││ │ •• ││ 8001 │"
|
"│ │ ••• ││ │ ••• ││ 8001 │"
|
||||||
"│ │ •• • ││ │ •• • ││127.0.0.1 8003 8003│"
|
"│ │ • • ││ │ • • ││127.0.0.1 8003 8003│"
|
||||||
"│ │ • • ││ │ • • ││ │"
|
"│ │ • • ││ │ • • ││ │"
|
||||||
"│ │ •• • • ││ │ •• • • ││ │"
|
"│ │ •• • ││ │ • • ││ │"
|
||||||
"│ │• •• ││ │• •• ││ "
|
"│ │ • • • ││ │ • •• ││ "
|
||||||
"│ │• • ││ │• • ││ This is a test "
|
"│ │•• •• ││ │•• •• ││ This is a test "
|
||||||
"│ │ ││ │ ││ "
|
"│ │ ││ │ ││ "
|
||||||
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰─────── "
|
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰─────── "
|
||||||
|
|||||||
+5
-5
@@ -26,9 +26,9 @@ expression: setup.terminal.backend()
|
|||||||
"│ │"
|
"│ │"
|
||||||
"╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
"╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
||||||
"╭───────────────────────────────── cpu 03.00% ─────────────────────────────────╮╭────────────────────────────── memory 30.00 kB ───────────────────────────────╮╭────────── ports ───────────╮"
|
"╭───────────────────────────────── cpu 03.00% ─────────────────────────────────╮╭────────────────────────────── memory 30.00 kB ───────────────────────────────╮╭────────── ports ───────────╮"
|
||||||
"│10.00%│ ••• ││100.00 kB│ •••• ││ ip private public│"
|
"│10.00%│ ••• ││100.00 kB│ •• ││ ip private public│"
|
||||||
"│ │ ••• • ││ │ •• • ││ 8001 │"
|
"│ │ •• • ││ │ •• • ││ 8001 │"
|
||||||
"│ │ ••• • • ││ │ ••• • • ││127.0.0.1 8003 8003│"
|
"│ │ ••• • ││ │ •••• • ││127.0.0.1 8003 8003│"
|
||||||
"│ │•• ••• ││ │•• •• ││ │"
|
"│ │ ••• ••• ││ │ •• ••• ││ │"
|
||||||
"│ │ ││ │ ││ │"
|
"│ │• • ││ │• • ││ │"
|
||||||
"╰──────────────────────────────────────────────────────────────────────────────╯╰──────────────────────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
"╰──────────────────────────────────────────────────────────────────────────────╯╰──────────────────────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
||||||
|
|||||||
+5
-5
@@ -26,9 +26,9 @@ expression: setup.terminal.backend()
|
|||||||
"│ ││ │"
|
"│ ││ │"
|
||||||
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯╰──────────────╯"
|
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯╰──────────────╯"
|
||||||
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
||||||
"│10.00%│ ••• ││100.00 kB│ •• ││ ip private public│"
|
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
|
||||||
"│ │ •• • ││ │ •• • ││ 8001 │"
|
"│ │ • • ││ │ •• • ││ 8001 │"
|
||||||
"│ │ ••• • • ││ │ ••• • • ││127.0.0.1 8003 8003│"
|
"│ │ ••• • ││ │ •• • ││127.0.0.1 8003 8003│"
|
||||||
"│ │• •• ││ │• •• ││ │"
|
"│ │ •• ••• ││ │ •• •• ││ │"
|
||||||
"│ │ ││ │ ││ │"
|
"│ │• • ││ │• • ││ │"
|
||||||
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
||||||
|
|||||||
+5
-5
@@ -26,9 +26,9 @@ expression: setup.terminal.backend()
|
|||||||
"│▶ line 3 │"
|
"│▶ line 3 │"
|
||||||
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
||||||
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
||||||
"│10.00%│ ••• ││100.00 kB│ •• ││ ip private public│"
|
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
|
||||||
"│ │ •• • ││ │ •• • ││ 8001 │"
|
"│ │ • • ││ │ •• • ││ 8001 │"
|
||||||
"│ │ ••• • • ││ │ ••• • • ││127.0.0.1 8003 8003│"
|
"│ │ ••• • ││ │ •• • ││127.0.0.1 8003 8003│"
|
||||||
"│ │• •• ││ │• •• ││ │"
|
"│ │ •• ••• ││ │ •• •• ││ │"
|
||||||
"│ │ ││ │ ││ │"
|
"│ │• • ││ │• • ││ │"
|
||||||
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
||||||
|
|||||||
+5
-5
@@ -25,10 +25,10 @@ expression: setup.terminal.backend()
|
|||||||
"│ │"
|
"│ │"
|
||||||
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
"╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
||||||
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
"╭───────────────────────── cpu 03.00% ──────────────────────────╮╭─────────────────────── memory 30.00 kB ───────────────────────╮╭────────── ports ───────────╮"
|
||||||
"│10.00%│ ••• ││100.00 kB│ •• ││ ip private public│"
|
"│10.00%│ •• ││100.00 kB│ •• ││ ip private public│"
|
||||||
"│ │ •• • ││ │ •• • ││ 8001 │"
|
"│ │ • • ││ │ •• • ││ 8001 │"
|
||||||
"│ │ ••• • • ││ │ ••• • • ││ │"
|
"│ │ ••• • ││ │ •• • ││ │"
|
||||||
"│ │• •• ││ │• •• ││ │"
|
"│ │ •• ••• ││ │ •• •• ││ │"
|
||||||
"│ │ ││ │ ││ │"
|
"│ │• • ││ │• • ││ │"
|
||||||
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯"
|
||||||
" Esc clear ← by → Name Image Status All filter term: r_1 "
|
" Esc clear ← by → Name Image Status All filter term: r_1 "
|
||||||
|
|||||||
+21
-20
@@ -238,32 +238,33 @@ impl Ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if crossterm::event::poll(POLL_RATE).unwrap_or(false)
|
if crossterm::event::poll(POLL_RATE).unwrap_or(false)
|
||||||
&& let Ok(event) = event::read() {
|
&& let Ok(event) = event::read()
|
||||||
if let Event::Key(key) = event {
|
{
|
||||||
if key.kind == event::KeyEventKind::Press {
|
if let Event::Key(key) = event {
|
||||||
|
if key.kind == event::KeyEventKind::Press {
|
||||||
|
self.input_tx
|
||||||
|
.send(InputMessages::ButtonPress((key.code, key.modifiers)))
|
||||||
|
.await
|
||||||
|
.ok();
|
||||||
|
}
|
||||||
|
} else if let Event::Mouse(m) = event {
|
||||||
|
match m.kind {
|
||||||
|
event::MouseEventKind::Down(_)
|
||||||
|
| event::MouseEventKind::ScrollDown
|
||||||
|
| event::MouseEventKind::ScrollUp => {
|
||||||
self.input_tx
|
self.input_tx
|
||||||
.send(InputMessages::ButtonPress((key.code, key.modifiers)))
|
.send(InputMessages::MouseEvent((m, m.modifiers)))
|
||||||
.await
|
.await
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
} else if let Event::Mouse(m) = event {
|
_ => (),
|
||||||
match m.kind {
|
|
||||||
event::MouseEventKind::Down(_)
|
|
||||||
| event::MouseEventKind::ScrollDown
|
|
||||||
| event::MouseEventKind::ScrollUp => {
|
|
||||||
self.input_tx
|
|
||||||
.send(InputMessages::MouseEvent((m, m.modifiers)))
|
|
||||||
.await
|
|
||||||
.ok();
|
|
||||||
}
|
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
} else if let Event::Resize(width, _) = event {
|
|
||||||
self.gui_state.lock().clear_area_map();
|
|
||||||
self.terminal.autoresize().ok();
|
|
||||||
self.gui_state.lock().set_screen_width(width);
|
|
||||||
}
|
}
|
||||||
|
} else if let Event::Resize(width, _) = event {
|
||||||
|
self.gui_state.lock().clear_area_map();
|
||||||
|
self.terminal.autoresize().ok();
|
||||||
|
self.gui_state.lock().set_screen_width(width);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
self.check_clear();
|
self.check_clear();
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user