Skip to content

Commit

Permalink
chore: increased page size and added port enumerate (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulobressan authored Oct 24, 2024
1 parent fc7a5df commit 11333f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/ports/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ pub fn pretty_print_resource_table(resources: Vec<Resource>) {
.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,
]);
}

Expand Down
6 changes: 5 additions & 1 deletion src/rpc/projects/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ pub async fn find(access_token: &str) -> miette::Result<Vec<proto::Project>> {
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;

Expand Down
3 changes: 2 additions & 1 deletion src/rpc/resources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ pub async fn find(api_key: &str, project_id: &str) -> miette::Result<Vec<proto::

let request = tonic::Request::new(proto::FetchResourcesRequest {
project_id: project_id.to_owned(),
..Default::default()
page: Some(1),
page_size: Some(100),
});

let response = client.fetch_resources(request).await.into_diagnostic()?;
Expand Down

0 comments on commit 11333f6

Please sign in to comment.