@@ -35,6 +35,9 @@ export type StaticTextResponseType =
35
35
| 'start-transformation-confirmed'
36
36
| 'job-transmitted'
37
37
| 'end-HIL-early'
38
+ | 'choose-transformation-objective'
39
+ | 'language-upgrade-selected'
40
+ | 'sql-conversion-selected'
38
41
39
42
export type UnrecoverableErrorType =
40
43
| 'no-project-found'
@@ -45,6 +48,10 @@ export type UnrecoverableErrorType =
45
48
| 'unsupported-source-jdk-version'
46
49
| 'upload-to-s3-failed'
47
50
| 'job-start-failed'
51
+ | 'unsupported-source-db'
52
+ | 'unsupported-target-db'
53
+ | 'error-parsing-sct-file'
54
+ | 'invalid-zip-no-sct-file'
48
55
49
56
export enum GumbyNamedMessages {
50
57
COMPILATION_PROGRESS_MESSAGE = 'gumbyProjectCompilationMessage' ,
@@ -148,7 +155,7 @@ export class Messenger {
148
155
)
149
156
}
150
157
151
- public async sendProjectPrompt ( projects : TransformationCandidateProject [ ] , tabID : string ) {
158
+ public async sendLanguageUpgradeProjectPrompt ( projects : TransformationCandidateProject [ ] , tabID : string ) {
152
159
const projectFormOptions : { value : any ; label : string } [ ] = [ ]
153
160
const detectedJavaVersions = new Array < JDKVersion | undefined > ( )
154
161
@@ -162,7 +169,7 @@ export class Messenger {
162
169
163
170
const formItems : ChatItemFormItem [ ] = [ ]
164
171
formItems . push ( {
165
- id : 'GumbyTransformProjectForm ' ,
172
+ id : 'GumbyTransformLanguageUpgradeProjectForm ' ,
166
173
type : 'select' ,
167
174
title : CodeWhispererConstants . chooseProjectFormTitle ,
168
175
mandatory : true ,
@@ -178,11 +185,11 @@ export class Messenger {
178
185
options : [
179
186
{
180
187
value : JDKVersion . JDK8 ,
181
- label : JDKVersion . JDK8 . toString ( ) ,
188
+ label : JDKVersion . JDK8 ,
182
189
} ,
183
190
{
184
191
value : JDKVersion . JDK11 ,
185
- label : JDKVersion . JDK11 . toString ( ) ,
192
+ label : JDKVersion . JDK11 ,
186
193
} ,
187
194
{
188
195
value : JDKVersion . UNSUPPORTED ,
@@ -207,7 +214,7 @@ export class Messenger {
207
214
this . dispatcher . sendAsyncEventProgress (
208
215
new AsyncEventProgressMessage ( tabID , {
209
216
inProgress : true ,
210
- message : MessengerUtils . createTransformationConfirmationPrompt ( detectedJavaVersions ) ,
217
+ message : MessengerUtils . createLanguageUpgradeConfirmationPrompt ( detectedJavaVersions ) ,
211
218
} )
212
219
)
213
220
@@ -224,7 +231,64 @@ export class Messenger {
224
231
message : 'Q Code Transformation' ,
225
232
formItems : formItems ,
226
233
} ,
227
- 'TransformForm' ,
234
+ 'LanguageUpgradeTransformForm' ,
235
+ tabID ,
236
+ false
237
+ )
238
+ )
239
+ }
240
+
241
+ public async sendSQLConversionProjectPrompt ( projects : TransformationCandidateProject [ ] , tabID : string ) {
242
+ const projectFormOptions : { value : any ; label : string } [ ] = [ ]
243
+
244
+ projects . forEach ( ( candidateProject ) => {
245
+ projectFormOptions . push ( {
246
+ value : candidateProject . path ,
247
+ label : candidateProject . name ,
248
+ } )
249
+ } )
250
+
251
+ const formItems : ChatItemFormItem [ ] = [ ]
252
+ formItems . push ( {
253
+ id : 'GumbyTransformSQLConversionProjectForm' ,
254
+ type : 'select' ,
255
+ title : 'Choose a project to transform' ,
256
+ mandatory : true ,
257
+ options : projectFormOptions ,
258
+ } )
259
+
260
+ formItems . push ( {
261
+ id : 'GumbyTransformSQLSchemaForm' ,
262
+ type : 'select' ,
263
+ title : 'Choose the schema of the database' ,
264
+ mandatory : true ,
265
+ options : Array . from ( transformByQState . getSchemaOptions ( ) ) . map ( ( schema ) => ( {
266
+ value : schema ,
267
+ label : schema ,
268
+ } ) ) ,
269
+ } )
270
+
271
+ this . dispatcher . sendAsyncEventProgress (
272
+ new AsyncEventProgressMessage ( tabID , {
273
+ inProgress : true ,
274
+ message : 'I can convert your embedded SQL, but I need some more info from you first.' ,
275
+ } )
276
+ )
277
+
278
+ this . dispatcher . sendAsyncEventProgress (
279
+ new AsyncEventProgressMessage ( tabID , {
280
+ inProgress : false ,
281
+ message : undefined ,
282
+ } )
283
+ )
284
+
285
+ this . dispatcher . sendChatPrompt (
286
+ new ChatPrompt (
287
+ {
288
+ message : 'Q Code Transformation' ,
289
+ formItems : formItems ,
290
+ } ,
291
+ 'SQLConversionTransformForm' ,
228
292
tabID ,
229
293
false
230
294
)
@@ -315,15 +379,18 @@ export class Messenger {
315
379
)
316
380
}
317
381
318
- public sendStaticTextResponse ( type : StaticTextResponseType , tabID : string ) {
382
+ public sendStaticTextResponse ( messageType : StaticTextResponseType , tabID : string ) {
319
383
let message = '...'
320
384
321
- switch ( type ) {
385
+ switch ( messageType ) {
322
386
case 'java-home-not-set' :
323
387
message = MessengerUtils . createJavaHomePrompt ( )
324
388
break
325
389
case 'end-HIL-early' :
326
- message = `I will continue transforming your code without upgrading this dependency.`
390
+ message = 'I will continue transforming your code without upgrading this dependency.'
391
+ break
392
+ case 'choose-transformation-objective' :
393
+ message = 'Choose your transformation objective.'
327
394
break
328
395
}
329
396
@@ -366,6 +433,18 @@ export class Messenger {
366
433
case 'unsupported-source-jdk-version' :
367
434
message = CodeWhispererConstants . unsupportedJavaVersionChatMessage
368
435
break
436
+ case 'unsupported-source-db' :
437
+ message = CodeWhispererConstants . invalidMetadataFileUnsupportedSourceDB
438
+ break
439
+ case 'unsupported-target-db' :
440
+ message = CodeWhispererConstants . invalidMetadataFileUnsupportedTargetDB
441
+ break
442
+ case 'error-parsing-sct-file' :
443
+ message = CodeWhispererConstants . invalidMetadataFileErrorParsing
444
+ break
445
+ case 'invalid-zip-no-sct-file' :
446
+ message = CodeWhispererConstants . invalidMetadataFileNoSctFile
447
+ break
369
448
}
370
449
371
450
const buttons : ChatItemButton [ ] = [ ]
@@ -442,7 +521,7 @@ export class Messenger {
442
521
)
443
522
}
444
523
445
- public sendProjectSelectionMessage (
524
+ public sendLanguageUpgradeProjectChoiceMessage (
446
525
projectName : string ,
447
526
fromJDKVersion : JDKVersion ,
448
527
toJDKVersion : JDKVersion ,
@@ -460,6 +539,35 @@ export class Messenger {
460
539
this . dispatcher . sendChatMessage ( new ChatMessage ( { message, messageType : 'prompt' } , tabID ) )
461
540
}
462
541
542
+ public sendSQLConversionProjectSelectionMessage ( projectName : string , schema : string , tabID : string ) {
543
+ const message = `### Transformation details
544
+ -------------
545
+ | | |
546
+ | :------------------- | -------: |
547
+ | **Project** | ${ projectName } |
548
+ | **Schema** | ${ schema } |
549
+ `
550
+ this . dispatcher . sendChatMessage ( new ChatMessage ( { message, messageType : 'prompt' } , tabID ) )
551
+ }
552
+
553
+ public sendSQLConversionMetadataReceivedMessage ( tabID : any ) {
554
+ const message = `### Transformation details
555
+ -------------
556
+ | | |
557
+ | :------------------- | -------: |
558
+ | **Source DB** | ${ transformByQState . getSourceDB ( ) } |
559
+ | **Target DB** | ${ transformByQState . getTargetDB ( ) } |
560
+ | **Host** | ${ transformByQState . getSourceServerName ( ) } |
561
+ `
562
+ this . dispatcher . sendChatMessage (
563
+ new ChatMessage (
564
+ { message : CodeWhispererConstants . sqlMetadataFileReceived , messageType : 'ai-prompt' } ,
565
+ tabID
566
+ )
567
+ )
568
+ this . dispatcher . sendChatMessage ( new ChatMessage ( { message, messageType : 'ai-prompt' } , tabID ) )
569
+ }
570
+
463
571
public sendSkipTestsSelectionMessage ( skipTestsSelection : string , tabID : string ) {
464
572
const message = `Okay, I will ${ skipTestsSelection . toLowerCase ( ) } when building your project.`
465
573
this . dispatcher . sendChatMessage ( new ChatMessage ( { message, messageType : 'ai-prompt' } , tabID ) )
@@ -612,4 +720,32 @@ ${codeSnippet}
612
720
)
613
721
)
614
722
}
723
+
724
+ public async sendSelectSQLMetadataFileMessage ( tabID : string ) {
725
+ const message = CodeWhispererConstants . selectSQLMetadataFileHelpMessage
726
+ const buttons : ChatItemButton [ ] = [ ]
727
+
728
+ buttons . push ( {
729
+ keepCardAfterClick : true ,
730
+ text : 'Select metadata file' ,
731
+ id : ButtonActions . SELECT_SQL_CONVERSION_METADATA_FILE ,
732
+ } )
733
+
734
+ buttons . push ( {
735
+ keepCardAfterClick : false ,
736
+ text : 'Cancel' ,
737
+ id : ButtonActions . CANCEL_TRANSFORMATION_FORM ,
738
+ } )
739
+
740
+ this . dispatcher . sendChatMessage (
741
+ new ChatMessage (
742
+ {
743
+ message,
744
+ messageType : 'ai-prompt' ,
745
+ buttons,
746
+ } ,
747
+ tabID
748
+ )
749
+ )
750
+ }
615
751
}
0 commit comments