@smbcloud / cli / commits / 3c80262

show deployment id

Seto Elkahfi committed May 29, 2025 at 01:28 UTC 3c802621f083c8556bfbd442e766d6ac863c2126
2 files changed +27 -21
crates/cli/src/project/deployment.rs
+25 -15
@@ -63,22 +63,32 @@ pub fn show_project_deployments(deployments: &[Deployment]) {
63 println!("{table}");
64 }
65
66 -#[derive(Tabled)]
67 -struct DeploymentDetailRow {
68 - field: &'static str,
69 - value: String,
70 -}
71 -
66 pub fn show_deployment_detail(deployment: &Deployment) {
73 - let rows = vec![
74 - DeploymentDetailRow { field: "ID", value: deployment.id.to_string() },
75 - DeploymentDetailRow { field: "Project ID", value: deployment.project_id.to_string() },
76 - DeploymentDetailRow { field: "Commit Hash", value: deployment.commit_hash.clone() },
77 - DeploymentDetailRow { field: "Status", value: format!("{:?}", deployment.status) },
78 - DeploymentDetailRow { field: "Created At", value: deployment.created_at.format("%Y-%m-%d %H:%M:%S").to_string() },
79 - DeploymentDetailRow { field: "Updated At", value: deployment.updated_at.format("%Y-%m-%d %H:%M:%S").to_string() },
80 - ];
67 + #[derive(Tabled)]
68 + struct Detail {
69 + #[tabled(rename = "ID")]
70 + id: i32,
71 + #[tabled(rename = "Project ID")]
72 + project_id: i32,
73 + #[tabled(rename = "Commit Hash")]
74 + commit_hash: String,
75 + #[tabled(rename = "Status")]
76 + status: String,
77 + #[tabled(rename = "Created At")]
78 + created_at: String,
79 + #[tabled(rename = "Updated At")]
80 + updated_at: String,
81 + }
82
82 - let table = Table::new(rows);
83 + let row = Detail {
84 + id: deployment.id,
85 + project_id: deployment.project_id,
86 + commit_hash: deployment.commit_hash.clone(),
87 + status: format!("{:?}", deployment.status),
88 + created_at: deployment.created_at.format("%Y-%m-%d %H:%M:%S").to_string(),
89 + updated_at: deployment.updated_at.format("%Y-%m-%d %H:%M:%S").to_string(),
90 + };
91 +
92 + let table = Table::new(vec![row]);
93 println!("{table}");
94 }
\ No newline at end of file
crates/smbcloud-networking-project/src/crud_project_deployment_read.rs
+2 -6
@@ -1,4 +1,4 @@
1 -use crate::build_project_deployment_index;
1 +use crate::{build_project_deployment, build_project_deployment_index};
2 use anyhow::{anyhow, Result};
3 use reqwest::Client;
4 use smbcloud_model::project::Deployment;
@@ -33,11 +33,7 @@ pub async fn get_deployment_detail(
33 ) -> Result<Deployment> {
34 let token = get_smb_token(env).await?;
35
36 - let url = format!(
37 - "{}/{}",
38 - build_project_deployment_index(env, project_id.to_string()),
39 - deployment_id
40 - );
36 + let url = build_project_deployment(env, project_id.to_string(), deployment_id.to_string());
37
38 let response = Client::new()
39 .get(url)