Skip to content

Commit c6368c7

Browse files
author
David Hasani
committed
skip buildCode step in hub
1 parent 502b7d3 commit c6368c7

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

packages/core/src/codewhisperer/commands/startTransformByQ.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
ZipManifest,
2020
TransformByQStatus,
2121
DB,
22+
TransformationType,
2223
} from '../models/model'
2324
import { convertDateToTimestamp } from '../../shared/utilities/textUtilities'
2425
import {
@@ -91,13 +92,15 @@ export async function processLanguageUpgradeTransformFormInput(
9192
fromJDKVersion: JDKVersion,
9293
toJDKVersion: JDKVersion
9394
) {
95+
transformByQState.setTransformationType(TransformationType.LANGUAGE_UPGRADE)
9496
transformByQState.setProjectName(path.basename(pathToProject))
9597
transformByQState.setProjectPath(pathToProject)
9698
transformByQState.setSourceJDKVersion(fromJDKVersion)
9799
transformByQState.setTargetJDKVersion(toJDKVersion)
98100
}
99101

100102
export async function processSQLConversionTransformFormInput(pathToProject: string, schema: string) {
103+
transformByQState.setTransformationType(TransformationType.SQL_CONVERSION)
101104
transformByQState.setProjectName(path.basename(pathToProject))
102105
transformByQState.setProjectPath(pathToProject)
103106
transformByQState.setSchema(schema)
@@ -782,7 +785,7 @@ export async function postTransformationJob() {
782785
const durationInMs = calculateTotalLatency(CodeTransformTelemetryState.instance.getStartTime())
783786
const resultStatusMessage = transformByQState.getStatus()
784787

785-
if (!transformByQState.getSchema()) {
788+
if (transformByQState.getTransformationType() !== TransformationType.SQL_CONVERSION) {
786789
// the below is only applicable when user is doing a Java 8/11 language upgrade
787790
const versionInfo = await getVersionData()
788791
const mavenVersionInfoMessage = `${versionInfo[0]} (${transformByQState.getMavenName()})`

packages/core/src/codewhisperer/models/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ export const newCustomizationMessage = 'You have access to new Amazon Q customiz
352352
// Start of QCT Strings
353353

354354
// feature flag for SQL transformations
355-
export const isSQLTransformReady = false
355+
export const isSQLTransformReady = true
356356

357357
export const uploadZipSizeLimitInBytes = 2000000000 // 2GB
358358

packages/core/src/codewhisperer/models/model.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ export enum TransformByQStatus {
284284
PartiallySucceeded = 'Partially Succeeded',
285285
}
286286

287+
export enum TransformationType {
288+
LANGUAGE_UPGRADE = 'Language Upgrade',
289+
SQL_CONVERSION = 'SQL Conversion',
290+
}
291+
287292
export enum TransformByQReviewStatus {
288293
NotStarted = 'NotStarted',
289294
PreparingReview = 'PreparingReview',
@@ -383,6 +388,8 @@ export let sessionJobHistory: {
383388
export class TransformByQState {
384389
private transformByQState: TransformByQStatus = TransformByQStatus.NotStarted
385390

391+
private transformationType: TransformationType | undefined = undefined
392+
386393
private projectName: string = ''
387394
private projectPath: string = ''
388395

@@ -464,6 +471,10 @@ export class TransformByQState {
464471
return this.transformByQState === TransformByQStatus.PartiallySucceeded
465472
}
466473

474+
public getTransformationType() {
475+
return this.transformationType
476+
}
477+
467478
public getProjectName() {
468479
return this.projectName
469480
}
@@ -620,6 +631,10 @@ export class TransformByQState {
620631
this.transformByQState = TransformByQStatus.PartiallySucceeded
621632
}
622633

634+
public setTransformationType(type: TransformationType) {
635+
this.transformationType = type
636+
}
637+
623638
public setProjectName(name: string) {
624639
this.projectName = name
625640
}
@@ -761,6 +776,7 @@ export class TransformByQState {
761776
this.targetDB = undefined
762777
this.sourceServerName = ''
763778
this.schemaOptions.clear()
779+
this.schema = ''
764780
this.errorLog = ''
765781
this.customBuildCommand = ''
766782
this.intervalId = undefined

packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
jobPlanProgress,
1717
sessionJobHistory,
1818
StepProgress,
19+
TransformationType,
1920
transformByQState,
2021
TransformByQStatus,
2122
TransformByQStoppedError,
@@ -212,7 +213,7 @@ export async function uploadPayload(payloadFileName: string, uploadContext?: Upl
212213
transformByQState.setJobId(encodeHTML(response.uploadId))
213214
}
214215
jobPlanProgress['uploadCode'] = StepProgress.Succeeded
215-
if (transformByQState.getSchema()) {
216+
if (transformByQState.getTransformationType() === TransformationType.SQL_CONVERSION) {
216217
// if doing a SQL conversion, we don't build the code, so mark this step as succeeded immediately so that next step renders
217218
jobPlanProgress['buildCode'] = StepProgress.Succeeded
218219
}

packages/core/src/codewhisperer/service/transformByQ/transformationHubViewProvider.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
import * as vscode from 'vscode'
77
import globals from '../../../shared/extensionGlobals'
88
import * as CodeWhispererConstants from '../../models/constants'
9-
import { StepProgress, jobPlanProgress, sessionJobHistory, transformByQState } from '../../models/model'
9+
import {
10+
StepProgress,
11+
TransformationType,
12+
jobPlanProgress,
13+
sessionJobHistory,
14+
transformByQState,
15+
} from '../../models/model'
1016
import { convertToTimeString } from '../../../shared/utilities/textUtilities'
1117
import { getLogger } from '../../../shared/logger'
1218
import { getTransformationSteps } from './transformApiHandler'
@@ -264,7 +270,7 @@ export class TransformationHubViewProvider implements vscode.WebviewViewProvider
264270
case 'PREPARING':
265271
case 'PREPARED':
266272
// for SQL conversions, skip to planningMessage since we don't build the code
267-
return transformByQState.getSchema()
273+
return transformByQState.getTransformationType() === TransformationType.SQL_CONVERSION
268274
? CodeWhispererConstants.planningMessage
269275
: CodeWhispererConstants.buildingCodeMessage.replace(
270276
'JAVA_VERSION_HERE',
@@ -334,7 +340,7 @@ export class TransformationHubViewProvider implements vscode.WebviewViewProvider
334340
activeStepId === 0
335341
)
336342
const buildMarkup =
337-
activeStepId >= 1 && !transformByQState.getSchema() // for SQL conversions, don't show buildCode step
343+
activeStepId >= 1 && transformByQState.getTransformationType() !== TransformationType.SQL_CONVERSION // for SQL conversions, don't show buildCode step
338344
? simpleStep(
339345
this.getProgressIconMarkup(jobPlanProgress['buildCode']),
340346
CodeWhispererConstants.buildCodeStepMessage,

0 commit comments

Comments
 (0)