refactor: DockerData refactors
Use a croner in the docker_data, instead of in the ui thread, as this thread will be paused when in exec mode. is_initilised is again done in docker_data, after stats have been calculated use bollard from git, waiting for new release due to Docker changes
This commit is contained in:
@@ -121,6 +121,9 @@ pub enum State {
|
||||
}
|
||||
|
||||
impl State {
|
||||
pub const fn is_alive(self) -> bool {
|
||||
matches!(self, Self::Running)
|
||||
}
|
||||
pub const fn get_color(self) -> Color {
|
||||
match self {
|
||||
Self::Paused => Color::Yellow,
|
||||
@@ -158,6 +161,12 @@ impl From<&str> for State {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Option<String>> for State {
|
||||
fn from(input: Option<String>) -> Self {
|
||||
input.map_or(Self::Unknown, |input| Self::from(input.as_str()))
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for State {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let disp = match self {
|
||||
@@ -216,7 +225,7 @@ impl fmt::Display for DockerControls {
|
||||
Self::Restart => "restart",
|
||||
Self::Start => "start",
|
||||
Self::Stop => "stop",
|
||||
Self::Unpause => "unpause",
|
||||
Self::Unpause => "resume",
|
||||
};
|
||||
write!(f, "{disp}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user