From 64017daa09289b5e88e578f0d87edd06fe8d9565 Mon Sep 17 00:00:00 2001 From: Hannes Kuchelmeister Date: Wed, 22 Jun 2022 19:39:23 +0200 Subject: [PATCH] add created ToolboxStatus as it was missing --- src/toolbx/mod.rs | 10 ++++++++++ src/ui/app/update.rs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/toolbx/mod.rs b/src/toolbx/mod.rs index 6cffd45..eb03c15 100644 --- a/src/toolbx/mod.rs +++ b/src/toolbx/mod.rs @@ -32,6 +32,7 @@ impl Display for ToolbxError { pub enum ToolbxStatus { Running, Configured, + Created, Exited, } @@ -48,6 +49,7 @@ impl FromStr for ToolbxStatus { match s { "running" => Ok(ToolbxStatus::Running), "configured" => Ok(ToolbxStatus::Configured), + "created" => Ok(ToolbxStatus::Created), "exited" => Ok(ToolbxStatus::Exited), s => Err(ToolbxError::ParseStatusError(format!( "'{}' is not a valid toolbx status.", @@ -352,6 +354,7 @@ fn test_parse_cmd_list_containers() { "CONTAINER ID CONTAINER NAME CREATED STATUS IMAGE NAME\n", "cee1002b5f0b fedora-toolbox-35 2 months ago exited registry.fedoraproject.org/fedora-toolbox:35\n", "9b611313bf65 latex 4 months ago configured registry.fedoraproject.org/fedora-toolbox:35\n", + "1235203091ab website 4 months ago created registry.fedoraproject.org/fedora-toolbox:35\n", "ae05203091ab rust 4 months ago running registry.fedoraproject.org/fedora-toolbox:35\n" ); @@ -370,6 +373,13 @@ fn test_parse_cmd_list_containers() { status: ToolbxStatus::Configured, image: "registry.fedoraproject.org/fedora-toolbox:35".to_string(), }, + ToolbxContainer { + id: "1235203091ab".to_string(), + name: "website".to_string(), + created: "4 months ago".to_string(), + status: ToolbxStatus::Created, + image: "registry.fedoraproject.org/fedora-toolbox:35".to_string(), + }, ToolbxContainer { id: "ae05203091ab".to_string(), name: "rust".to_string(), diff --git a/src/ui/app/update.rs b/src/ui/app/update.rs index 7fd8200..e32bf39 100644 --- a/src/ui/app/update.rs +++ b/src/ui/app/update.rs @@ -30,7 +30,7 @@ impl AppUpdate for AppModel { AppMsg::ToolbxContainerToggleStartStop(index) => { if let Some(toolbx_container) = self.toolboxes.get_mut(index.current_index()) { match toolbx_container.toolbx_container.status { - ToolbxStatus::Exited | ToolbxStatus::Configured => { + ToolbxStatus::Exited | ToolbxStatus::Configured | ToolbxStatus::Created => { toolbx_container.changing_status = true; components .async_handler