Skip to content

Commit

Permalink
feat(amazonq): add view summary button in chat
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hasani committed Dec 17, 2024
1 parent 04a5b68 commit 79fca29
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"description": "Amazon Q Code Transformation: add view summary button in chat"
}
8 changes: 8 additions & 0 deletions packages/core/src/amazonqGumby/chat/controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,14 @@ export class GumbyController {
await vscode.commands.executeCommand(GumbyCommands.FOCUS_TRANSFORMATION_HUB, CancelActionPositions.Chat)
this.messenger.sendJobSubmittedMessage(message.tabID)
break
case ButtonActions.VIEW_SUMMARY:
await vscode.commands.executeCommand('aws.amazonq.transformationHub.summary.reveal')
this.transformationFinished({
message: CodeWhispererConstants.viewProposedChangesChatMessage,
tabID: message.tabID,
includeStartNewTransformationButton: true,
})
break
case ButtonActions.STOP_TRANSFORMATION_JOB:
await stopTransformByQ(transformByQState.getJobId())
await postTransformationJob()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ export class Messenger {
mandatory: true,
options: [
{
value: JDKVersion.JDK17.toString(),
label: JDKVersion.JDK17.toString(),
value: JDKVersion.JDK17,
label: JDKVersion.JDK17,
},
],
})
Expand Down Expand Up @@ -517,6 +517,14 @@ export class Messenger {
})
}

if (transformByQState.getSummaryFilePath()) {
buttons.push({
keepCardAfterClick: true,
text: CodeWhispererConstants.viewSummaryButtonText,
id: ButtonActions.VIEW_SUMMARY,
})
}

this.dispatcher.sendChatMessage(
new ChatMessage(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import DependencyVersions from '../../../models/dependencies'
export enum ButtonActions {
STOP_TRANSFORMATION_JOB = 'gumbyStopTransformationJob',
VIEW_TRANSFORMATION_HUB = 'gumbyViewTransformationHub',
VIEW_SUMMARY = 'gumbyViewSummary',
CONFIRM_LANGUAGE_UPGRADE_TRANSFORMATION_FORM = 'gumbyLanguageUpgradeTransformFormConfirm',
CONFIRM_SQL_CONVERSION_TRANSFORMATION_FORM = 'gumbySQLConversionTransformFormConfirm',
CANCEL_TRANSFORMATION_FORM = 'gumbyTransformFormCancel', // shared between Language Upgrade & SQL Conversion
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/codewhisperer/commands/startTransformByQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as fs from 'fs' // eslint-disable-line no-restricted-imports
import path from 'path'
import { getLogger } from '../../shared/logger'
import * as CodeWhispererConstants from '../models/constants'
import * as localizedText from '../../shared/localizedText'
import {
transformByQState,
StepProgress,
Expand Down Expand Up @@ -233,7 +234,7 @@ export async function preTransformationUploadCode() {
await vscode.commands.executeCommand('aws.amazonq.transformationHub.focus')

void vscode.window.showInformationMessage(CodeWhispererConstants.jobStartedNotification, {
title: CodeWhispererConstants.jobStartedTitle,
title: localizedText.ok,
})

let uploadId = ''
Expand Down Expand Up @@ -750,7 +751,7 @@ export async function postTransformationJob() {

if (transformByQState.isSucceeded()) {
void vscode.window.showInformationMessage(CodeWhispererConstants.jobCompletedNotification(diffMessage), {
title: CodeWhispererConstants.transformationCompletedTitle,
title: localizedText.ok,
})
} else if (transformByQState.isPartiallySucceeded()) {
void vscode.window
Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/codewhisperer/models/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,15 +554,15 @@ export const noOngoingJobMessage = 'No ongoing job.'

export const nothingToShowMessage = 'Nothing to show'

export const jobStartedTitle = 'Transformation started'

export const jobStartedNotification =
'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.'

export const openTransformationHubButtonText = 'Open Transformation Hub'

export const startTransformationButtonText = 'Start a new transformation'

export const viewSummaryButtonText = 'View summary'

export const stopTransformationButtonText = 'Stop transformation'

export const checkingForProjectsChatMessage = 'Checking for eligible projects...'
Expand Down Expand Up @@ -638,8 +638,6 @@ export const jobCancelledChatMessage =

export const jobCancelledNotification = 'You cancelled the transformation.'

export const transformationCompletedTitle = 'Transformation complete'

export const diffMessage = (multipleDiffs: boolean) => {
return multipleDiffs
? '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.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ export class ProposedTransformationExplorer {
'markdown.showPreview',
vscode.Uri.file(transformByQState.getSummaryFilePath())
)
telemetry.ui_click.emit({ elementId: 'transformationHub_viewSummary' })
}
})

Expand Down

0 comments on commit 79fca29

Please sign in to comment.