diff --git a/packages/core/src/amazonqGumby/chat/controller/messenger/messenger.ts b/packages/core/src/amazonqGumby/chat/controller/messenger/messenger.ts index bdfe55b0c9f..15a9c3f1df9 100644 --- a/packages/core/src/amazonqGumby/chat/controller/messenger/messenger.ts +++ b/packages/core/src/amazonqGumby/chat/controller/messenger/messenger.ts @@ -728,6 +728,12 @@ ${codeSnippet} id: ButtonActions.SELECT_SQL_CONVERSION_METADATA_FILE, }) + buttons.push({ + keepCardAfterClick: false, + text: 'Cancel', + id: ButtonActions.CANCEL_TRANSFORMATION_FORM, + }) + this.dispatcher.sendChatMessage( new ChatMessage( { diff --git a/packages/core/src/codewhisperer/commands/startTransformByQ.ts b/packages/core/src/codewhisperer/commands/startTransformByQ.ts index 449da34c2dc..5d5d0a60929 100644 --- a/packages/core/src/codewhisperer/commands/startTransformByQ.ts +++ b/packages/core/src/codewhisperer/commands/startTransformByQ.ts @@ -101,6 +101,8 @@ export async function processSQLConversionTransformFormInput(pathToProject: stri transformByQState.setProjectName(path.basename(pathToProject)) transformByQState.setProjectPath(pathToProject) transformByQState.setSchema(schema) + transformByQState.setSourceJDKVersion(JDKVersion.JDK8) // use dummy value of JDK8 so that startJob API can be called + // targetJDKVersion defaults to JDK17, the only supported version, which is fine } export async function validateSQLMetadataFile(fileContents: string, message: any) { @@ -136,7 +138,7 @@ export async function validateSQLMetadataFile(fileContents: string, message: any serverNodeLocations.forEach((serverNodeLocation: any) => { const schemaNodes = serverNodeLocation['FullNameNodeInfoList'][0]['nameParts'][0][ 'FullNameNodeInfo' - ].filter((node: any) => node['$']['typeNode'] === 'schema') + ].filter((node: any) => node['$']['typeNode'].toLowerCase() === 'schema') schemaNodes.forEach((node: any) => { schemaNames.add(node['$']['nameNode'].toUpperCase()) }) diff --git a/packages/core/src/codewhisperer/models/constants.ts b/packages/core/src/codewhisperer/models/constants.ts index 26faec954c1..b387a58cc94 100644 --- a/packages/core/src/codewhisperer/models/constants.ts +++ b/packages/core/src/codewhisperer/models/constants.ts @@ -507,18 +507,10 @@ export const selectSQLMetadataFileHelpMessage = export const invalidMetadataFileUnsupportedSourceDB = `Sorry, your .sct metadata file appears to be invalid; the source DB must be Oracle.` -export const invalidMetadataFileUnsupportedTargetDB = `Sorry, your .sct metadata file appears to be invalid; the target DB must be Aurora Postgresql or Amazon RDS for Postgresql.` +export const invalidMetadataFileUnsupportedTargetDB = `Sorry, your .sct metadata file appears to be invalid; the target DB must be Aurora PostgreSQL or Amazon RDS for PostgreSQL.` export const invalidMetadataFileErrorParsing = 'Sorry, the .sct metadata file you provided appears to be invalid.' -export const oracleVendor = 'Oracle' - -export const otherVendor = 'Other' - -export const auroraTargetVendor = 'Amazon Aurora PostgreSQL' - -export const rdsTargetVendor = 'Amazon RDS for PostgreSQL' - export const failedToStartJobChatMessage = "Sorry, I couldn't begin the transformation. Please try starting the transformation again." diff --git a/packages/core/src/codewhisperer/models/model.ts b/packages/core/src/codewhisperer/models/model.ts index 5b4f3a80608..e406fe8ce2d 100644 --- a/packages/core/src/codewhisperer/models/model.ts +++ b/packages/core/src/codewhisperer/models/model.ts @@ -756,7 +756,6 @@ export class TransformByQState { this.sourceDB = undefined this.targetDB = undefined this.sourceServerName = '' - this.schema = '' this.schemaOptions.clear() this.errorLog = '' this.customBuildCommand = '' diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts b/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts index 5b4ff475ae4..60318712cdd 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts @@ -212,6 +212,10 @@ export async function uploadPayload(payloadFileName: string, uploadContext?: Upl transformByQState.setJobId(encodeHTML(response.uploadId)) } jobPlanProgress['uploadCode'] = StepProgress.Succeeded + if (transformByQState.getSchema()) { + // if doing a SQL conversion, we don't build the code, so mark this step as succeeded immediately so that next step renders + jobPlanProgress['buildCode'] = StepProgress.Succeeded + } updateJobHistory() return response.uploadId } @@ -402,7 +406,6 @@ export async function zipCode({ dependenciesFolder, humanInTheLoopFlag, projectP export async function startJob(uploadId: string) { const sourceLanguageVersion = `JAVA_${transformByQState.getSourceJDKVersion()}` const targetLanguageVersion = `JAVA_${transformByQState.getTargetJDKVersion()}` - // TO-DO: figure out what to set source and target language version too, along with transformation type try { const response = await codeWhisperer.codeWhispererClient.codeModernizerStartCodeTransformation({ workspaceState: { @@ -410,9 +413,9 @@ export async function startJob(uploadId: string) { programmingLanguage: { languageName: CodeWhispererConstants.defaultLanguage.toLowerCase() }, }, transformationSpec: { - transformationType: CodeWhispererConstants.transformationType, - source: { language: sourceLanguageVersion }, - target: { language: targetLanguageVersion }, + transformationType: CodeWhispererConstants.transformationType, // shared b/w language upgrades & sql conversions for now + source: { language: sourceLanguageVersion }, // dummy value of JDK8 used for SQL conversions just so that this API can be called + target: { language: targetLanguageVersion }, // always JDK17 }, }) if (response.$response.requestId) { @@ -619,6 +622,7 @@ export async function pollTransformationJob(jobId: string, validStates: string[] transformationJobId: jobId, }) status = response.transformationJob.status! + // if doing a SQL conversion, we don't build the code, so mark this step as succeeded immediately so that next step gets rendered if (CodeWhispererConstants.validStatesForBuildSucceeded.includes(status)) { jobPlanProgress['buildCode'] = StepProgress.Succeeded } diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationHubViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationHubViewProvider.ts index 57536c78fb9..f79984696f5 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationHubViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationHubViewProvider.ts @@ -263,10 +263,13 @@ export class TransformationHubViewProvider implements vscode.WebviewViewProvider return CodeWhispererConstants.filesUploadedMessage case 'PREPARING': case 'PREPARED': - return CodeWhispererConstants.buildingCodeMessage.replace( - 'JAVA_VERSION_HERE', - transformByQState.getSourceJDKVersion() ?? '' - ) + // for SQL conversions, skip to planningMessage since we don't build the code + return transformByQState.getSchema() + ? CodeWhispererConstants.planningMessage + : CodeWhispererConstants.buildingCodeMessage.replace( + 'JAVA_VERSION_HERE', + transformByQState.getSourceJDKVersion() ?? '' + ) case 'PLANNING': case 'PLANNED': return CodeWhispererConstants.planningMessage @@ -331,7 +334,7 @@ export class TransformationHubViewProvider implements vscode.WebviewViewProvider activeStepId === 0 ) const buildMarkup = - activeStepId >= 1 && !transformByQState.getMetadataPathSQL() // for SQL conversions, don't show buildCode step + activeStepId >= 1 && !transformByQState.getSchema() // for SQL conversions, don't show buildCode step ? simpleStep( this.getProgressIconMarkup(jobPlanProgress['buildCode']), CodeWhispererConstants.buildCodeStepMessage,