Skip to content

Commit 79fca29

Browse files
author
David Hasani
committed
feat(amazonq): add view summary button in chat
1 parent 04a5b68 commit 79fca29

File tree

7 files changed

+28
-9
lines changed

7 files changed

+28
-9
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Amazon Q Code Transformation: add view summary button in chat"
4+
}

packages/core/src/amazonqGumby/chat/controller/controller.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,14 @@ export class GumbyController {
385385
await vscode.commands.executeCommand(GumbyCommands.FOCUS_TRANSFORMATION_HUB, CancelActionPositions.Chat)
386386
this.messenger.sendJobSubmittedMessage(message.tabID)
387387
break
388+
case ButtonActions.VIEW_SUMMARY:
389+
await vscode.commands.executeCommand('aws.amazonq.transformationHub.summary.reveal')
390+
this.transformationFinished({
391+
message: CodeWhispererConstants.viewProposedChangesChatMessage,
392+
tabID: message.tabID,
393+
includeStartNewTransformationButton: true,
394+
})
395+
break
388396
case ButtonActions.STOP_TRANSFORMATION_JOB:
389397
await stopTransformByQ(transformByQState.getJobId())
390398
await postTransformationJob()

packages/core/src/amazonqGumby/chat/controller/messenger/messenger.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ export class Messenger {
243243
mandatory: true,
244244
options: [
245245
{
246-
value: JDKVersion.JDK17.toString(),
247-
label: JDKVersion.JDK17.toString(),
246+
value: JDKVersion.JDK17,
247+
label: JDKVersion.JDK17,
248248
},
249249
],
250250
})
@@ -517,6 +517,14 @@ export class Messenger {
517517
})
518518
}
519519

520+
if (transformByQState.getSummaryFilePath()) {
521+
buttons.push({
522+
keepCardAfterClick: true,
523+
text: CodeWhispererConstants.viewSummaryButtonText,
524+
id: ButtonActions.VIEW_SUMMARY,
525+
})
526+
}
527+
520528
this.dispatcher.sendChatMessage(
521529
new ChatMessage(
522530
{

packages/core/src/amazonqGumby/chat/controller/messenger/messengerUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import DependencyVersions from '../../../models/dependencies'
1313
export enum ButtonActions {
1414
STOP_TRANSFORMATION_JOB = 'gumbyStopTransformationJob',
1515
VIEW_TRANSFORMATION_HUB = 'gumbyViewTransformationHub',
16+
VIEW_SUMMARY = 'gumbyViewSummary',
1617
CONFIRM_LANGUAGE_UPGRADE_TRANSFORMATION_FORM = 'gumbyLanguageUpgradeTransformFormConfirm',
1718
CONFIRM_SQL_CONVERSION_TRANSFORMATION_FORM = 'gumbySQLConversionTransformFormConfirm',
1819
CANCEL_TRANSFORMATION_FORM = 'gumbyTransformFormCancel', // shared between Language Upgrade & SQL Conversion

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as fs from 'fs' // eslint-disable-line no-restricted-imports
88
import path from 'path'
99
import { getLogger } from '../../shared/logger'
1010
import * as CodeWhispererConstants from '../models/constants'
11+
import * as localizedText from '../../shared/localizedText'
1112
import {
1213
transformByQState,
1314
StepProgress,
@@ -233,7 +234,7 @@ export async function preTransformationUploadCode() {
233234
await vscode.commands.executeCommand('aws.amazonq.transformationHub.focus')
234235

235236
void vscode.window.showInformationMessage(CodeWhispererConstants.jobStartedNotification, {
236-
title: CodeWhispererConstants.jobStartedTitle,
237+
title: localizedText.ok,
237238
})
238239

239240
let uploadId = ''
@@ -750,7 +751,7 @@ export async function postTransformationJob() {
750751

751752
if (transformByQState.isSucceeded()) {
752753
void vscode.window.showInformationMessage(CodeWhispererConstants.jobCompletedNotification(diffMessage), {
753-
title: CodeWhispererConstants.transformationCompletedTitle,
754+
title: localizedText.ok,
754755
})
755756
} else if (transformByQState.isPartiallySucceeded()) {
756757
void vscode.window

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,15 +554,15 @@ export const noOngoingJobMessage = 'No ongoing job.'
554554

555555
export const nothingToShowMessage = 'Nothing to show'
556556

557-
export const jobStartedTitle = 'Transformation started'
558-
559557
export const jobStartedNotification =
560558
'Amazon Q is transforming your code. It can take 10 to 30 minutes to upgrade your code, depending on the size of your project. To monitor progress, go to the Transformation Hub.'
561559

562560
export const openTransformationHubButtonText = 'Open Transformation Hub'
563561

564562
export const startTransformationButtonText = 'Start a new transformation'
565563

564+
export const viewSummaryButtonText = 'View summary'
565+
566566
export const stopTransformationButtonText = 'Stop transformation'
567567

568568
export const checkingForProjectsChatMessage = 'Checking for eligible projects...'
@@ -638,8 +638,6 @@ export const jobCancelledChatMessage =
638638

639639
export const jobCancelledNotification = 'You cancelled the transformation.'
640640

641-
export const transformationCompletedTitle = 'Transformation complete'
642-
643641
export const diffMessage = (multipleDiffs: boolean) => {
644642
return multipleDiffs
645643
? 'You can review the diffs to see my proposed changes and accept or reject them. You will be able to accept changes from one diff at a time. If you reject changes in one diff, you will not be able to view or accept changes in the other diffs.'

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ export class ProposedTransformationExplorer {
370370
'markdown.showPreview',
371371
vscode.Uri.file(transformByQState.getSummaryFilePath())
372372
)
373-
telemetry.ui_click.emit({ elementId: 'transformationHub_viewSummary' })
374373
}
375374
})
376375

0 commit comments

Comments
 (0)