From 11333f6b9c0a0f9e1afc5e80f821ab7e93eb2f57 Mon Sep 17 00:00:00 2001 From: Paulo Bressan Date: Thu, 24 Oct 2024 12:00:04 -0300 Subject: [PATCH] chore: increased page size and added port enumerate (#52) --- src/ports/format.rs | 13 +++++++------ src/rpc/projects/mod.rs | 6 +++++- src/rpc/resources/mod.rs | 3 ++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/ports/format.rs b/src/ports/format.rs index 011d8e1..9fd4556 100644 --- a/src/ports/format.rs +++ b/src/ports/format.rs @@ -11,14 +11,15 @@ pub fn pretty_print_resource_table(resources: Vec) { .load_preset(UTF8_FULL) .apply_modifier(UTF8_ROUND_CORNERS) .set_content_arrangement(ContentArrangement::Dynamic) - .set_header(vec!["ID", "Kind", "Name", "Created At"]); + .set_header(vec!["", "ID", "Kind", "Name", "Created At"]); - for resource in resources { + for (i, resource) in resources.iter().enumerate() { table.add_row(vec![ - resource.id, - resource.name, - resource.kind, - resource.created_at, + &(i + 1).to_string(), + &resource.id, + &resource.name, + &resource.kind, + &resource.created_at, ]); } diff --git a/src/rpc/projects/mod.rs b/src/rpc/projects/mod.rs index a56fea1..2e091ec 100644 --- a/src/rpc/projects/mod.rs +++ b/src/rpc/projects/mod.rs @@ -22,7 +22,11 @@ pub async fn find(access_token: &str) -> miette::Result> { let mut client = proto::project_service_client::ProjectServiceClient::with_interceptor(channel, interceptor); - let request = tonic::Request::new(proto::FetchProjectsRequest::default()); + let request = tonic::Request::new(proto::FetchProjectsRequest { + page: Some(1), + page_size: Some(100), + }); + let response = client.fetch_projects(request).await.into_diagnostic()?; let records = response.into_inner().records; diff --git a/src/rpc/resources/mod.rs b/src/rpc/resources/mod.rs index b7b1d61..f32bb2c 100644 --- a/src/rpc/resources/mod.rs +++ b/src/rpc/resources/mod.rs @@ -21,7 +21,8 @@ pub async fn find(api_key: &str, project_id: &str) -> miette::Result