From e831d3c4e3fb94aa847fa4a132d417de2133dad5 Mon Sep 17 00:00:00 2001 From: Mayank Chugh Date: Tue, 26 Mar 2024 10:34:00 +0000 Subject: [PATCH 1/2] BB8-10075: Makes the prompt message generic for vip-import-sql In case tableNames are not available, prompt message should not point to an empty array. The generic message handles it --- src/bin/vip-import-sql.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/vip-import-sql.js b/src/bin/vip-import-sql.js index c7e1a1493..868dae136 100755 --- a/src/bin/vip-import-sql.js +++ b/src/bin/vip-import-sql.js @@ -237,7 +237,7 @@ export const promptToContinue = async ( { launched, formattedEnvironment, track, const promptResponse = await prompt( { type: 'input', name: 'confirmedDomain', - message: `You are about to import the above tables into a ${ + message: `You are about to import into a ${ launched ? 'launched' : 'un-launched' } ${ formattedEnvironment } site ${ chalk.yellow( domain ) }.\nType '${ chalk.yellow( promptToMatch From f658accc0e659f605ad331d0c3d851e000355774 Mon Sep 17 00:00:00 2001 From: Mayank Chugh Date: Tue, 26 Mar 2024 12:24:26 +0000 Subject: [PATCH 2/2] Conditionally checks what to print in promptMessage --- src/bin/vip-import-sql.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/bin/vip-import-sql.js b/src/bin/vip-import-sql.js index 868dae136..b46d54538 100755 --- a/src/bin/vip-import-sql.js +++ b/src/bin/vip-import-sql.js @@ -231,13 +231,21 @@ const examples = [ }, ]; -export const promptToContinue = async ( { launched, formattedEnvironment, track, domain } ) => { +export const promptToContinue = async ( { + launched, + formattedEnvironment, + track, + domain, + tableNames, +} ) => { console.log(); const promptToMatch = domain.toUpperCase(); const promptResponse = await prompt( { type: 'input', name: 'confirmedDomain', - message: `You are about to import into a ${ + message: `You are about to import ${ + tableNames && Array.isArray( tableNames ) && tableNames.length ? 'above tables' : '' + } into a ${ launched ? 'launched' : 'un-launched' } ${ formattedEnvironment } site ${ chalk.yellow( domain ) }.\nType '${ chalk.yellow( promptToMatch @@ -459,6 +467,7 @@ void command( { formattedEnvironment, track, domain, + tableNames, } ); /**