fix: improve usage of indicatif for tracking progress #101
| @ -59,7 +59,7 @@ impl<T: Topology + K8sclient + HelmCommand> Interpret<T> for ArgoInterpret { | |||||||
|             .await |             .await | ||||||
|             .unwrap(); |             .unwrap(); | ||||||
|         Ok(Outcome::success(format!( |         Ok(Outcome::success(format!( | ||||||
|             "Successfully installed ArgoCD and {} Applications", |             "ArgoCD installed with {} applications", | ||||||
|             self.argo_apps.len() |             self.argo_apps.len() | ||||||
|         ))) |         ))) | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -46,7 +46,7 @@ where | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn name(&self) -> String { |     fn name(&self) -> String { | ||||||
|         format!("Application: {}", self.application.name()) |         format!("{} [ApplicationScore]", self.application.name()) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -55,7 +55,7 @@ impl<T: Topology + HelmCommand> Score<T> for HelmChartScore { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn name(&self) -> String { |     fn name(&self) -> String { | ||||||
|         format!("{} {} HelmChartScore", self.release_name, self.chart_name) |         format!("{} [HelmChartScore]", self.release_name) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -33,7 +33,10 @@ impl<T: Topology + PrometheusApplicationMonitoring<CRDPrometheus>> Score<T> | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn name(&self) -> String { |     fn name(&self) -> String { | ||||||
|         "ApplicationMonitoringScore".to_string() |         format!( | ||||||
|  |             "{} monitoring [ApplicationMonitoringScore]", | ||||||
|  |             self.application.name() | ||||||
|  |         ) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -61,7 +64,9 @@ impl<T: Topology + PrometheusApplicationMonitoring<CRDPrometheus>> Interpret<T> | |||||||
| 
 | 
 | ||||||
|         match result { |         match result { | ||||||
|             Ok(outcome) => match outcome { |             Ok(outcome) => match outcome { | ||||||
|                 PreparationOutcome::Success { details } => Ok(Outcome::success(details)), |                 PreparationOutcome::Success { details: _ } => { | ||||||
|  |                     Ok(Outcome::success("Prometheus installed".into())) | ||||||
|  |                 } | ||||||
|                 PreparationOutcome::Noop => Ok(Outcome::noop()), |                 PreparationOutcome::Noop => Ok(Outcome::noop()), | ||||||
|             }, |             }, | ||||||
|             Err(err) => Err(InterpretError::from(err)), |             Err(err) => Err(InterpretError::from(err)), | ||||||
|  | |||||||
| @ -28,7 +28,7 @@ impl<T: Topology + HelmCommand + K8sclient> Score<T> for NtfyScore { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn name(&self) -> String { |     fn name(&self) -> String { | ||||||
|         "NtfyScore".to_string() |         "alert receiver [NtfyScore]".into() | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -119,7 +119,7 @@ impl<T: Topology + HelmCommand + K8sclient> Interpret<T> for NtfyInterpret { | |||||||
| 
 | 
 | ||||||
|         debug!("exec into pod done"); |         debug!("exec into pod done"); | ||||||
| 
 | 
 | ||||||
|         Ok(Outcome::success("installed ntfy".to_string())) |         Ok(Outcome::success("Ntfy installed".to_string())) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn get_name(&self) -> InterpretName { |     fn get_name(&self) -> InterpretName { | ||||||
|  | |||||||
| @ -61,7 +61,7 @@ impl<T: Topology + K8sclient + PrometheusApplicationMonitoring<CRDPrometheus>> S | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn name(&self) -> String { |     fn name(&self) -> String { | ||||||
|         "CRDApplicationAlertingScore".into() |         "prometheus alerting [CRDAlertingScore]".into() | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -93,9 +93,7 @@ impl<T: Topology + K8sclient + PrometheusApplicationMonitoring<CRDPrometheus>> I | |||||||
|         self.install_rules(&self.prometheus_rules, &client).await?; |         self.install_rules(&self.prometheus_rules, &client).await?; | ||||||
|         self.install_monitors(self.service_monitors.clone(), &client) |         self.install_monitors(self.service_monitors.clone(), &client) | ||||||
|             .await?; |             .await?; | ||||||
|         Ok(Outcome::success( |         Ok(Outcome::success("K8s components installed".to_string())) | ||||||
|             "deployed application monitoring composants".to_string(), |  | ||||||
|         )) |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn get_name(&self) -> InterpretName { |     fn get_name(&self) -> InterpretName { | ||||||
|  | |||||||
| @ -28,7 +28,7 @@ impl<T: Topology + TenantManager> Score<T> for TenantScore { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn name(&self) -> String { |     fn name(&self) -> String { | ||||||
|         format!("{} TenantScore", self.config.name) |         format!("{} [TenantScore]", self.config.name) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -47,8 +47,8 @@ impl<T: Topology + TenantManager> Interpret<T> for TenantInterpret { | |||||||
|         topology.provision_tenant(&self.tenant_config).await?; |         topology.provision_tenant(&self.tenant_config).await?; | ||||||
| 
 | 
 | ||||||
|         Ok(Outcome::success(format!( |         Ok(Outcome::success(format!( | ||||||
|             "Successfully provisioned tenant {} with id {}", |             "Tenant provisioned with id '{}'", | ||||||
|             self.tenant_config.name, self.tenant_config.id |             self.tenant_config.id | ||||||
|         ))) |         ))) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -50,7 +50,11 @@ async fn handle_events(base_progress: MultiProgress) { | |||||||
|                 match event { |                 match event { | ||||||
|                     HarmonyEvent::HarmonyStarted => {} |                     HarmonyEvent::HarmonyStarted => {} | ||||||
|                     HarmonyEvent::HarmonyFinished => { |                     HarmonyEvent::HarmonyFinished => { | ||||||
|                         progress_tracker.add_section("harmony-finished", "\n"); |                         progress_tracker.add_section( | ||||||
|  |                             "harmony-summary", | ||||||
|  |                             &format!("\n{} Harmony completed\n\n", crate::theme::EMOJI_HARMONY), | ||||||
|  |                         ); | ||||||
|  |                         progress_tracker.add_section("harmony-finished", "\n\n"); | ||||||
|                         return false; |                         return false; | ||||||
|                     } |                     } | ||||||
|                     HarmonyEvent::TopologyStateChanged { |                     HarmonyEvent::TopologyStateChanged { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user