From 94a6c66c36e65c9fcab0ecf1874a5d9bc7795191 Mon Sep 17 00:00:00 2001 From: Neeraj Date: Thu, 17 Oct 2024 19:31:01 +0530 Subject: [PATCH] Fetch deployment build logs --- packages/backend/src/database.ts | 3 ++- packages/backend/src/schema.gql | 3 ++- .../project/deployments/DeploymentDetailsCard.tsx | 9 +++++++-- packages/gql-client/src/queries.ts | 7 ++++++- packages/gql-client/src/types.ts | 9 ++++++++- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/backend/src/database.ts b/packages/backend/src/database.ts index 61f3263d..2798f1bc 100644 --- a/packages/backend/src/database.ts +++ b/packages/backend/src/database.ts @@ -216,7 +216,8 @@ export class Database { relations: { project: true, domain: true, - createdBy: true + createdBy: true, + deployer: true, }, where: { project: { diff --git a/packages/backend/src/schema.gql b/packages/backend/src/schema.gql index a559868c..1d788b67 100644 --- a/packages/backend/src/schema.gql +++ b/packages/backend/src/schema.gql @@ -104,7 +104,8 @@ type Deployment { commitMessage: String! url: String environment: Environment! - deployerId: String + deployer: Deployer + applicationDeploymentRequestId: String isCurrent: Boolean! baseDomain: String status: DeploymentStatus! diff --git a/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx b/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx index 2d36cdbe..54916591 100644 --- a/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx +++ b/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx @@ -72,6 +72,11 @@ const DeploymentDetailsCard = ({ leftIcon={getIconByDeploymentStatus(deployment.status)} size="xs" type={STATUS_COLORS[deployment.status] ?? 'neutral'} + onClick={async()=> { + let url = `${deployment.deployer.deployerApiUrl}/log/${deployment.applicationDeploymentRequestId}` + const res = await fetch(url); + console.log(">>>>RESPONSE",await res.text()) + }} > {deployment.status} @@ -96,9 +101,9 @@ const DeploymentDetailsCard = ({ )} - {deployment.deployerLrn && ( + {deployment.deployer.deployerLrn && ( - Deployer LRN: {deployment.deployerLrn} + Deployer LRN: {deployment.deployer.deployerLrn} )} diff --git a/packages/gql-client/src/queries.ts b/packages/gql-client/src/queries.ts index a87a4cb8..c41c75a4 100644 --- a/packages/gql-client/src/queries.ts +++ b/packages/gql-client/src/queries.ts @@ -136,7 +136,11 @@ query ($projectId: String!) { commitHash commitMessage url - deployerLrn + deployer { + deployerId + deployerLrn, + deployerApiUrl, + } environment isCurrent baseDomain @@ -148,6 +152,7 @@ query ($projectId: String!) { name email } + applicationDeploymentRequestId } } `; diff --git a/packages/gql-client/src/types.ts b/packages/gql-client/src/types.ts index 15b9e073..af46bfa5 100644 --- a/packages/gql-client/src/types.ts +++ b/packages/gql-client/src/types.ts @@ -105,7 +105,7 @@ export type Deployment = { commitHash: string; commitMessage: string; url?: string; - deployerLrn: string; + deployer: Deployer; environment: Environment; isCurrent: boolean; baseDomain?: string; @@ -113,8 +113,15 @@ export type Deployment = { createdBy: User; createdAt: string; updatedAt: string; + applicationDeploymentRequestId: string; }; +export type Deployer = { + deployerApiUrl: string; + deployerId: string; + deployerLrn: string; +} + export type OrganizationMember = { id: string; member: User;