From e1bcf031b1358d7fd9b4860b8f5180ee8789c92d Mon Sep 17 00:00:00 2001 From: shay Date: Wed, 27 Sep 2023 09:30:44 +0300 Subject: [PATCH 1/5] feature: add ability to provide user tip message from GCP --- src/services/push-service.ts | 9 +++++---- src/services/schemas/push-service-schemas.ts | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/services/push-service.ts b/src/services/push-service.ts index 5d65043..527d3c4 100644 --- a/src/services/push-service.ts +++ b/src/services/push-service.ts @@ -62,7 +62,7 @@ export const getAppVersionDeploymentStatus = async (appVersionId: number) => { export const pollForDeploymentStatus = async ( appVersionId: number, retryAfter: number, - options: { ttl?: number; progressLogger?: (message: keyof typeof DeploymentStatusTypesSchema) => void } = {}, + options: { ttl?: number; progressLogger?: (message: keyof typeof DeploymentStatusTypesSchema, tip?: string) => void } = {}, ): Promise => { const { ttl, progressLogger } = options; @@ -79,7 +79,7 @@ export const pollForDeploymentStatus = async ( const response = await getAppVersionDeploymentStatus(appVersionId); if (statusesToKeepPolling.includes(response.status)) { if (progressLogger) { - progressLogger(response.status); + progressLogger(response.status, response.tip); } return false; @@ -199,9 +199,10 @@ export const handleDeploymentTask = async ( const ttl = TimeInMs.minute * 30; const deploymentStatus = await pollForDeploymentStatus(ctx.appVersionId, retryAfter, { ttl, - progressLogger: (message: keyof typeof DeploymentStatusTypesSchema) => { + progressLogger: (message: keyof typeof DeploymentStatusTypesSchema, tip?: string) => { const deltaInSeconds = (Date.now() - now) / TimeInMs.second; - task.title = `Deployment in progress: ${message}`; + const customTip = tip ? `, tip: ${tip}` : ''; + task.title = `Deployment in progress: ${message}${customTip}`; task.output = createProgressBarString(MAX_PROGRESS_VALUE, STATUS_TO_PROGRESS_VALUE[message], deltaInSeconds); }, }); diff --git a/src/services/schemas/push-service-schemas.ts b/src/services/schemas/push-service-schemas.ts index 2af8ac0..3cdac2f 100644 --- a/src/services/schemas/push-service-schemas.ts +++ b/src/services/schemas/push-service-schemas.ts @@ -24,6 +24,7 @@ export const deploymentStatusTypesSchema = z.enum(deploymentStatusTypesArray); export const appVersionDeploymentStatusSchema = z .object({ status: deploymentStatusTypesSchema, + tip: z.string().optional(), deployment: z .object({ url: z.string(), From 5a87adbd008d658274425c4b62bb158cee25479e Mon Sep 17 00:00:00 2001 From: shay Date: Wed, 27 Sep 2023 09:53:35 +0300 Subject: [PATCH 2/5] feature: add ability to provide user tip message from GCP --- src/services/push-service.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/services/push-service.ts b/src/services/push-service.ts index 527d3c4..f271c04 100644 --- a/src/services/push-service.ts +++ b/src/services/push-service.ts @@ -1,4 +1,5 @@ import axios from 'axios'; +import chalk from 'chalk'; import { ListrTaskWrapper } from 'listr2'; import { getAppVersionDeploymentStatusUrl, getDeploymentSignedUrl } from 'consts/urls'; @@ -201,9 +202,9 @@ export const handleDeploymentTask = async ( ttl, progressLogger: (message: keyof typeof DeploymentStatusTypesSchema, tip?: string) => { const deltaInSeconds = (Date.now() - now) / TimeInMs.second; - const customTip = tip ? `, tip: ${tip}` : ''; - task.title = `Deployment in progress: ${message}${customTip}`; - task.output = createProgressBarString(MAX_PROGRESS_VALUE, STATUS_TO_PROGRESS_VALUE[message], deltaInSeconds); + task.title = `Deployment in progress: ${message}`; + const customTip = tip ? `\n ${chalk.bold(chalk.green('Tip:'))} ${chalk.italic(chalk.green(tip))}` : ''; + task.output = createProgressBarString(MAX_PROGRESS_VALUE, STATUS_TO_PROGRESS_VALUE[message], deltaInSeconds) + customTip; }, }); From f5e467c139458f27af6232611880416b6e954144 Mon Sep 17 00:00:00 2001 From: shay Date: Wed, 27 Sep 2023 10:03:35 +0300 Subject: [PATCH 3/5] feature: add ability to provide user tip message from GCP --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1aa9280..e84975e 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mondaycom/apps-cli", - "version": "1.1.0", + "version": "1.2.0", "description": "A cli tool to manage apps (and monday-code projects) in monday.com", "author": "monday.com Apps Team", "type": "module", From 648749d4e23b814d6be554a1522905df4b536426 Mon Sep 17 00:00:00 2001 From: shay Date: Wed, 27 Sep 2023 10:16:37 +0300 Subject: [PATCH 4/5] feature: add ability to provide user tip message from GCP --- src/services/push-service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/push-service.ts b/src/services/push-service.ts index f271c04..5cdfa90 100644 --- a/src/services/push-service.ts +++ b/src/services/push-service.ts @@ -203,7 +203,7 @@ export const handleDeploymentTask = async ( progressLogger: (message: keyof typeof DeploymentStatusTypesSchema, tip?: string) => { const deltaInSeconds = (Date.now() - now) / TimeInMs.second; task.title = `Deployment in progress: ${message}`; - const customTip = tip ? `\n ${chalk.bold(chalk.green('Tip:'))} ${chalk.italic(chalk.green(tip))}` : ''; + const customTip = tip ? `\n ${chalk.italic(chalk.green(tip))}` : ''; task.output = createProgressBarString(MAX_PROGRESS_VALUE, STATUS_TO_PROGRESS_VALUE[message], deltaInSeconds) + customTip; }, }); From f2a02215bb06b8359716e6a951c86293eb8bb16c Mon Sep 17 00:00:00 2001 From: shay Date: Wed, 27 Sep 2023 13:06:28 +0300 Subject: [PATCH 5/5] feature: add ability to provide user tip message from GCP --- src/services/push-service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/services/push-service.ts b/src/services/push-service.ts index 5cdfa90..767b304 100644 --- a/src/services/push-service.ts +++ b/src/services/push-service.ts @@ -63,7 +63,10 @@ export const getAppVersionDeploymentStatus = async (appVersionId: number) => { export const pollForDeploymentStatus = async ( appVersionId: number, retryAfter: number, - options: { ttl?: number; progressLogger?: (message: keyof typeof DeploymentStatusTypesSchema, tip?: string) => void } = {}, + options: { + ttl?: number; + progressLogger?: (message: keyof typeof DeploymentStatusTypesSchema, tip?: string) => void; + } = {}, ): Promise => { const { ttl, progressLogger } = options; @@ -204,7 +207,8 @@ export const handleDeploymentTask = async ( const deltaInSeconds = (Date.now() - now) / TimeInMs.second; task.title = `Deployment in progress: ${message}`; const customTip = tip ? `\n ${chalk.italic(chalk.green(tip))}` : ''; - task.output = createProgressBarString(MAX_PROGRESS_VALUE, STATUS_TO_PROGRESS_VALUE[message], deltaInSeconds) + customTip; + task.output = + createProgressBarString(MAX_PROGRESS_VALUE, STATUS_TO_PROGRESS_VALUE[message], deltaInSeconds) + customTip; }, });