chore: dependencies updated

This commit is contained in:
Jack Wills
2026-01-24 16:32:39 +00:00
parent 8b5899ca23
commit 4b7bf38a3f
5 changed files with 930 additions and 275 deletions
+15 -10
View File
@@ -5,7 +5,7 @@ use std::{
net::IpAddr,
};
use bollard::service::Port;
use bollard::secret::{ContainerSummaryHealthStatusEnum, PortSummary};
use jiff::{Timestamp, tz::TimeZone};
use ratatui::{
layout::Size,
@@ -121,8 +121,8 @@ pub struct ContainerPorts {
pub public: Option<u16>,
}
impl From<Port> for ContainerPorts {
fn from(value: Port) -> Self {
impl From<PortSummary> for ContainerPorts {
fn from(value: PortSummary) -> Self {
Self {
ip: value.ip.and_then(|i| i.parse::<IpAddr>().ok()),
private: value.private_port,
@@ -242,6 +242,7 @@ impl From<String> for ContainerStatus {
impl ContainerStatus {
/// Check if a container is unhealthy
/// TODO should have a healthy Option<X> part now, so no need to parse
pub fn unhealthy(&self) -> bool {
self.contains("(unhealthy)")
}
@@ -689,11 +690,11 @@ impl Logs {
if let Some(new_index) = match sd {
ScrollDirection::Next => current_position.checked_add(1),
ScrollDirection::Previous => current_position.checked_sub(1),
} && let Some(f) = self.search_results.get(new_index)
{
self.lines.state.select(Some(*f));
return Some(());
}
&& let Some(f) = self.search_results.get(new_index) {
self.lines.state.select(Some(*f));
return Some(());
}
} else {
let range = match sd {
ScrollDirection::Previous => (0..=current_selected).rev().collect::<Vec<_>>(),
@@ -922,9 +923,11 @@ impl Logs {
pub fn forward(&mut self, width: u16) {
let offset = usize::from(self.offset);
if self.horizontal_scroll_able(width)
&& self.adjusted_max_width > 0 && offset < self.adjusted_max_width {
self.offset = self.offset.saturating_add(1);
}
&& self.adjusted_max_width > 0
&& offset < self.adjusted_max_width
{
self.offset = self.offset.saturating_add(1);
}
}
/// Reduce the char offset
@@ -968,6 +971,7 @@ pub struct ContainerItem {
pub cpu_stats: VecDeque<CpuStats>,
pub created: u64,
pub docker_controls: StatefulList<DockerCommand>,
pub health: Option<ContainerSummaryHealthStatusEnum>,
pub id: ContainerId,
pub image: ContainerImage,
pub is_oxker: bool,
@@ -1017,6 +1021,7 @@ impl ContainerItem {
cpu_stats: VecDeque::with_capacity(60),
created,
docker_controls,
health: None,
id,
image: image.into(),
is_oxker,
+2
View File
@@ -203,6 +203,7 @@ impl DockerData {
if let std::collections::hash_map::Entry::Vacant(spawns) =
self.spawns.lock().entry(spawn_id.clone())
{
// TODO Replace this with toktio tokens
spawns.insert(tokio::spawn(Self::update_container_stat(
Arc::clone(&self.app_data),
Arc::clone(&self.docker),
@@ -478,6 +479,7 @@ mod tests {
fn gen_stats() -> ContainerStatsResponse {
ContainerStatsResponse {
read: None,
os_type: None,
preread: None,
num_procs: Some(1),
pids_stats: None,
+14 -12
View File
@@ -64,16 +64,17 @@ async fn docker_init(
});
if let Ok(docker) = connection
&& docker.ping().await.is_ok() {
tokio::spawn(DockerData::start(
Arc::clone(app_data),
docker,
docker_rx,
docker_tx,
Arc::clone(gui_state),
));
return;
}
&& docker.ping().await.is_ok()
{
tokio::spawn(DockerData::start(
Arc::clone(app_data),
docker,
docker_rx,
docker_tx,
Arc::clone(gui_state),
));
return;
}
app_data
.lock()
.set_error(AppError::DockerConnect, gui_state, Status::DockerConnect);
@@ -153,7 +154,7 @@ mod tests {
use std::{str::FromStr, sync::Arc};
use bollard::service::{ContainerSummary, Port};
use bollard::service::{ContainerSummary, PortSummary};
use crate::{
app_data::{
@@ -232,13 +233,14 @@ mod tests {
pub fn gen_container_summary(index: usize, state: &str) -> ContainerSummary {
ContainerSummary {
image_manifest_descriptor: None,
health: None,
id: Some(format!("{index}")),
names: Some(vec![format!("container_{}", index)]),
image: Some(format!("image_{index}")),
image_id: Some(format!("{index}")),
command: None,
created: Some(i64::try_from(index).unwrap()),
ports: Some(vec![Port {
ports: Some(vec![PortSummary {
ip: None,
private_port: u16::try_from(index).unwrap_or(1) + 8000,
public_port: None,