add created ToolboxStatus as it was missing

This commit is contained in:
2022-06-22 19:39:23 +02:00
parent 321fb23661
commit 64017daa09
2 changed files with 11 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ impl Display for ToolbxError {
pub enum ToolbxStatus { pub enum ToolbxStatus {
Running, Running,
Configured, Configured,
Created,
Exited, Exited,
} }
@@ -48,6 +49,7 @@ impl FromStr for ToolbxStatus {
match s { match s {
"running" => Ok(ToolbxStatus::Running), "running" => Ok(ToolbxStatus::Running),
"configured" => Ok(ToolbxStatus::Configured), "configured" => Ok(ToolbxStatus::Configured),
"created" => Ok(ToolbxStatus::Created),
"exited" => Ok(ToolbxStatus::Exited), "exited" => Ok(ToolbxStatus::Exited),
s => Err(ToolbxError::ParseStatusError(format!( s => Err(ToolbxError::ParseStatusError(format!(
"'{}' is not a valid toolbx status.", "'{}' 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", "CONTAINER ID CONTAINER NAME CREATED STATUS IMAGE NAME\n",
"cee1002b5f0b fedora-toolbox-35 2 months ago exited registry.fedoraproject.org/fedora-toolbox:35\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", "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" "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, status: ToolbxStatus::Configured,
image: "registry.fedoraproject.org/fedora-toolbox:35".to_string(), 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 { ToolbxContainer {
id: "ae05203091ab".to_string(), id: "ae05203091ab".to_string(),
name: "rust".to_string(), name: "rust".to_string(),

View File

@@ -30,7 +30,7 @@ impl AppUpdate for AppModel {
AppMsg::ToolbxContainerToggleStartStop(index) => { AppMsg::ToolbxContainerToggleStartStop(index) => {
if let Some(toolbx_container) = self.toolboxes.get_mut(index.current_index()) { if let Some(toolbx_container) = self.toolboxes.get_mut(index.current_index()) {
match toolbx_container.toolbx_container.status { match toolbx_container.toolbx_container.status {
ToolbxStatus::Exited | ToolbxStatus::Configured => { ToolbxStatus::Exited | ToolbxStatus::Configured | ToolbxStatus::Created => {
toolbx_container.changing_status = true; toolbx_container.changing_status = true;
components components
.async_handler .async_handler