From 3c8f0bc0e0a150e6767b70a28afca82917f6361e Mon Sep 17 00:00:00 2001 From: Marcus Behrendt Date: Thu, 2 Mar 2023 22:35:59 +0100 Subject: [PATCH] fix(container/status): Handle `configured` --- data/resources/style-hc.css | 1 + data/resources/style.css | 1 + src/model/container.rs | 9 ++++++++- src/view/container/mod.rs | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/data/resources/style-hc.css b/data/resources/style-hc.css index 2c4603881..44dc80cde 100644 --- a/data/resources/style-hc.css +++ b/data/resources/style-hc.css @@ -6,6 +6,7 @@ font-weight: bold; } +.container-status-configured .container-status-created, .container-status-exited, .container-status-removing, diff --git a/data/resources/style.css b/data/resources/style.css index 40b3345e0..d18890514 100644 --- a/data/resources/style.css +++ b/data/resources/style.css @@ -108,6 +108,7 @@ connectionchooserpage connectionswitchermenu row { margin: 0 0 -4px -2px; } +.container-status-configured, .container-status-created, .container-status-exited, .container-status-initialized, diff --git a/src/model/container.rs b/src/model/container.rs index 6bb5ac03a..12f407ff9 100644 --- a/src/model/container.rs +++ b/src/model/container.rs @@ -24,6 +24,7 @@ use crate::utils; #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, glib::Enum)] #[enum_type(name = "ContainerStatus")] pub(crate) enum Status { + Configured, Created, Dead, Exited, @@ -43,6 +44,7 @@ impl FromStr for Status { fn from_str(s: &str) -> Result { Ok(match s { + "configured" => Self::Configured, "created" => Self::Created, "dead" => Self::Dead, "exited" => Self::Exited, @@ -64,6 +66,7 @@ impl fmt::Display for Status { f, "{}", match self { + Self::Configured => gettext("Configured"), Self::Created => gettext("Created"), Self::Dead => gettext("Dead"), Self::Exited => gettext("Exited"), @@ -716,7 +719,11 @@ impl Container { pub(crate) fn can_start(&self) -> bool { matches!( self.status(), - Status::Created | Status::Exited | Status::Initialized | Status::Stopped + Status::Configured + | Status::Created + | Status::Exited + | Status::Initialized + | Status::Stopped ) } diff --git a/src/view/container/mod.rs b/src/view/container/mod.rs index fb346ea13..e84fadb46 100644 --- a/src/view/container/mod.rs +++ b/src/view/container/mod.rs @@ -33,6 +33,7 @@ fn container_status_css_class(status: model::ContainerStatus) -> &'static str { use model::ContainerStatus::*; match status { + Configured => "container-status-configured", Created => "container-status-created", Dead => "container-status-dead", Exited => "container-status-exited",