get clientcontainer; container findable with id image name ahs to be implemented
This commit is contained in:
@@ -22,8 +22,9 @@ pub async fn get_available_container(docker: &Docker) -> Vec<DockerContainer> {
|
||||
container.id.as_ref()?; // Skip if no ID
|
||||
|
||||
let id = container.id?;
|
||||
let short_id = if id.len() > 12 { &id[..12] } else { &id };
|
||||
|
||||
let short_string_id = if id.len() > 12 { &id[..12] } else { &id };
|
||||
let short_id: u32 = short_string_id.trim().parse().unwrap();
|
||||
|
||||
let name = container.names
|
||||
.and_then(|names| names.into_iter().next())
|
||||
.map(|name| name.trim_start_matches('/').to_string())
|
||||
@@ -46,7 +47,7 @@ pub async fn get_available_container(docker: &Docker) -> Vec<DockerContainer> {
|
||||
println!(" - ID: {}, Image: {:?}, Name: {}", short_id, container.image, name);
|
||||
|
||||
Some(DockerContainer {
|
||||
ID: short_id.to_string(),
|
||||
ID: short_id,
|
||||
image,
|
||||
Name: name,
|
||||
Status: status,
|
||||
@@ -66,7 +67,7 @@ pub async fn get_available_container(docker: &Docker) -> Vec<DockerContainer> {
|
||||
containers_list
|
||||
}
|
||||
|
||||
pub fn extract_container_id(line: &str) -> Option<String> {
|
||||
/*pub fn extract_client_container_id(line: &str) -> Option<String> {
|
||||
// Split by slashes and take the last part
|
||||
if let Some(last_part) = line.split('/').last() {
|
||||
let last_part = last_part.trim();
|
||||
@@ -94,4 +95,4 @@ pub fn extract_container_id(line: &str) -> Option<String> {
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
}*/
|
Reference in New Issue
Block a user