Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/core/src/amazonqGumby/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Messenger } from './chat/controller/messenger/messenger'
import { UIMessageListener } from './chat/views/actions/uiMessageListener'
import { debounce } from 'lodash'
import { AuthUtil } from '../codewhisperer/util/authUtil'
import { showTransformationHub } from './commands'
import { showTransformationHub, showTransformationSummary } from './commands'
import { transformByQState } from '../codewhisperer/models/model'
import { ChatSessionManager } from './chat/storages/chatSession'

Expand Down Expand Up @@ -69,6 +69,7 @@ export function init(appContext: AmazonQAppInitContext) {
})

showTransformationHub.register()
showTransformationSummary.register()

transformByQState.setChatControllers(gumbyChatControllerEventEmitters)
transformByQState.setChatMessenger(messenger)
Expand Down
11 changes: 11 additions & 0 deletions packages/core/src/amazonqGumby/chat/controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,17 @@ export class GumbyController {
this.messenger.sendCommandMessage({ ...message, command: GumbyCommands.CLEAR_CHAT })
await this.transformInitiated(message)
break
case ButtonActions.CONFIRM_VIEW_TRANSFORMATION_SUMMARY:
await vscode.commands.executeCommand(
GumbyCommands.SHOW_TRANSFORMATION_SUMMARY,
CancelActionPositions.Chat
)
this.messenger.sendJobFinishedMessage(
message.tabID,
CodeWhispererConstants.viewProposedChangesChatMessage
)
telemetry.ui_click.emit({ elementId: 'transformationHub_viewSummary' })
break
case ButtonActions.CONFIRM_DEPENDENCY_FORM:
await this.continueJobWithSelectedDependency(message)
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,14 @@ export class Messenger {

public sendJobFinishedMessage(tabID: string, message: string, includeStartNewTransformationButton: boolean = true) {
const buttons: ChatItemButton[] = []
// We only want to show this button when the proposed changes were downloaded (ie the summary is available)
if (transformByQState.getSummaryFilePath() !== '') {
buttons.push({
keepCardAfterClick: false,
text: CodeWhispererConstants.viewTransformationSummaryButtonText,
id: ButtonActions.CONFIRM_VIEW_TRANSFORMATION_SUMMARY,
})
}
if (includeStartNewTransformationButton) {
buttons.push({
keepCardAfterClick: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export enum ButtonActions {
CONFIRM_JAVA_HOME_FORM = 'gumbyJavaHomeFormConfirm',
CANCEL_JAVA_HOME_FORM = 'gumbyJavaHomeFormCancel',
CONFIRM_START_TRANSFORMATION_FLOW = 'gumbyStartTransformation',
CONFIRM_VIEW_TRANSFORMATION_SUMMARY = 'gumbyViewSummary',
OPEN_FILE = 'gumbyOpenFile',
OPEN_BUILD_LOG = 'gumbyOpenBuildLog',
}
Expand All @@ -34,6 +35,7 @@ export enum GumbyCommands {
CLEAR_CHAT = 'aws.awsq.clearchat',
START_TRANSFORMATION_FLOW = 'aws.awsq.transform',
FOCUS_TRANSFORMATION_HUB = 'aws.amazonq.showTransformationHub',
SHOW_TRANSFORMATION_SUMMARY = 'aws.amazonq.transformationHub.summary.reveal',
}

export default class MessengerUtils {
Expand Down
13 changes: 13 additions & 0 deletions packages/core/src/amazonqGumby/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,23 @@

import * as vscode from 'vscode'
import { Commands } from '../shared/vscode/commands2'
import { transformByQState } from '../codewhisperer'

export const showTransformationHub = Commands.declare(
{ id: 'aws.amazonq.showTransformationHub', compositeKey: { 0: 'source' } },
() => async (source: string) => {
await vscode.commands.executeCommand('workbench.view.extension.aws-codewhisperer-transformation-hub')
}
)

export const showTransformationSummary = Commands.declare(
{ id: 'aws.amazonq.transformationHub.summary.reveal', compositeKey: { 0: 'source' } },
() => async (source: string) => {
if (transformByQState.getSummaryFilePath() !== '') {
await vscode.commands.executeCommand(
'markdown.showPreview',
vscode.Uri.file(String(transformByQState.getSummaryFilePath()))
)
}
}
)
2 changes: 2 additions & 0 deletions packages/core/src/codewhisperer/models/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ export const openTransformationHubButtonText = 'Open Transformation Hub'

export const startTransformationButtonText = 'Start a new transformation'

export const viewTransformationSummaryButtonText = 'View transformation summary'

export const stopTransformationButtonText = 'Stop transformation'

export const checkingForProjectsChatMessage = 'Checking for eligible projects...'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,15 @@ export class ProposedTransformationExplorer {
}
})

vscode.commands.registerCommand('aws.amazonq.transformationHub.summary.reveal', async () => {
if (transformByQState.getSummaryFilePath() !== '') {
await vscode.commands.executeCommand(
'markdown.showPreview',
vscode.Uri.file(transformByQState.getSummaryFilePath())
)
telemetry.ui_click.emit({ elementId: 'transformationHub_viewSummary' })
}
})
// vscode.commands.registerCommand('aws.amazonq.transformationHub.summary.reveal', async () => {
// if (transformByQState.getSummaryFilePath() !== '') {
// await vscode.commands.executeCommand(
// 'markdown.showPreview',
// vscode.Uri.file(transformByQState.getSummaryFilePath())
// )
// telemetry.ui_click.emit({ elementId: 'transformationHub_viewSummary' })
// }
// })

vscode.commands.registerCommand('aws.amazonq.transformationHub.reviewChanges.startReview', async () => {
await setContext('gumby.reviewState', TransformByQReviewStatus.PreparingReview)
Expand Down Expand Up @@ -491,7 +491,7 @@ export class ProposedTransformationExplorer {
message: CodeWhispererConstants.viewProposedChangesChatMessage,
tabID: ChatSessionManager.Instance.getSession().tabID,
})
await vscode.commands.executeCommand('aws.amazonq.transformationHub.summary.reveal')
// await vscode.commands.executeCommand('aws.amazonq.transformationHub.summary.reveal')
} catch (e: any) {
deserializeErrorMessage = (e as Error).message
getLogger().error(`CodeTransformation: ParseDiff error = ${deserializeErrorMessage}`)
Expand Down
Loading