feat: delete container, closes #27

Enable a user to delete a container. A dialog will pop up to ask the user to confirm the deletion. A user can then click on either button, or press N/Y to make a selection
This commit is contained in:
Jack Wills
2023-03-30 02:12:03 +00:00
parent 7c92ffef7d
commit 937202fe34
9 changed files with 310 additions and 55 deletions
+10
View File
@@ -456,6 +456,15 @@ impl AppData {
self.containers.items.iter_mut().find(|i| &i.id == id)
}
/// return a mutable container by given id
pub fn get_container_name_by_id(&mut self, id: &ContainerId) -> Option<String> {
self.containers
.items
.iter_mut()
.find(|i| &i.id == id)
.map(|i| i.name.clone())
}
/// Find the id of the currently selected container.
/// If any containers on system, will always return a ContainerId
/// Only returns None when no containers found.
@@ -532,6 +541,7 @@ impl AppData {
}
}
}
// Trim a &String and return String
let trim_owned = |x: &String| x.trim().to_owned();