feat: ContainerPorts use ipaddr

This commit is contained in:
Jack Wills
2024-12-03 20:39:51 +00:00
parent 508c697cf4
commit 1b26997d25
4 changed files with 29 additions and 25 deletions
+10 -6
View File
@@ -330,7 +330,7 @@ pub fn ports(
)];
for item in ports.0 {
let fg = Color::White;
let strings = item.print();
let strings = item.get_all();
let line = vec![
Span::from(format!("{:>ip$}", strings.0)).fg(fg),
@@ -1066,7 +1066,11 @@ fn popup(text_lines: usize, text_width: usize, r: Rect, box_location: BoxLocatio
#[allow(clippy::unwrap_used)]
mod tests {
use std::{ops::RangeInclusive, sync::Arc};
use std::{
net::{IpAddr, Ipv4Addr},
ops::RangeInclusive,
sync::Arc,
};
use parking_lot::Mutex;
use ratatui::{
@@ -3171,7 +3175,7 @@ mod tests {
setup.app_data.lock().containers.items[0]
.ports
.push(ContainerPorts {
ip: Some("127.0.0.1".to_owned()),
ip: Some(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1))),
private: 8003,
public: Some(8003),
});
@@ -3317,7 +3321,7 @@ mod tests {
setup.app_data.lock().containers.items[0]
.ports
.push(ContainerPorts {
ip: Some("127.0.0.1".to_owned()),
ip: Some(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1))),
private: 8003,
public: Some(8003),
});
@@ -3381,7 +3385,7 @@ mod tests {
setup.app_data.lock().containers.items[1]
.ports
.push(ContainerPorts {
ip: Some("127.0.0.1".to_owned()),
ip: Some(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1))),
private: 8003,
public: Some(8003),
});
@@ -3498,7 +3502,7 @@ mod tests {
setup.app_data.lock().containers.items[0]
.ports
.push(ContainerPorts {
ip: Some("127.0.0.1".to_owned()),
ip: Some(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1))),
private: 8003,
public: Some(8003),
});