diff --git a/bin/core/src/helpers/resource.rs b/bin/core/src/helpers/resource.rs index 5dc3769ae..014fe4969 100644 --- a/bin/core/src/helpers/resource.rs +++ b/bin/core/src/helpers/resource.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use anyhow::{anyhow, Context}; -use futures::future::join_all; +use futures::{future::join_all, FutureExt}; use monitor_client::entities::{ alerter::{ Alerter, AlerterConfig, AlerterInfo, AlerterListItem, @@ -41,7 +41,10 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::db::db_client; -use super::cache::{deployment_status_cache, server_status_cache}; +use super::{ + cache::{deployment_status_cache, server_status_cache}, + get_tag, +}; pub trait StateResource { type ListItem: Serialize + Send; @@ -193,6 +196,14 @@ pub trait StateResource { id_or_name: &str, tags: Vec, ) -> anyhow::Result<()> { + let futures = tags + .iter() + .map(|tag| get_tag(tag).map(|tag| tag.map(|tag| tag.id))); + let tags = join_all(futures) + .await + .into_iter() + .flatten() + .collect::>(); Self::coll() .await .update_one( diff --git a/frontend/src/components/resources/deployment/logs.tsx b/frontend/src/components/resources/deployment/logs.tsx index e3fbe76c1..b1e511884 100644 --- a/frontend/src/components/resources/deployment/logs.tsx +++ b/frontend/src/components/resources/deployment/logs.tsx @@ -58,8 +58,12 @@ export const DeploymentLogs = ({ id }: { id: string }) => { ); const deployment = useDeployment(id); + console.log(deployment); - if (deployment?.info.state === Types.DockerContainerState.NotDeployed) + if ( + deployment?.info.state === Types.DockerContainerState.Unknown || + deployment?.info.state === Types.DockerContainerState.NotDeployed + ) return null; return (