Skip to content

Commit

Permalink
fix(amazonq): ux modifications in utg feedback mechanism #6763
Browse files Browse the repository at this point in the history
## Problem
- This PR is continuation of
#6748.
- Modifying UX to align with JetBrains IDE.

## Solution
- Modified UX to align with JetBrains IDE.
- This change will effect only Internal  users.
  • Loading branch information
laileni-aws authored Mar 11, 2025
1 parent cc53d2d commit 890bfe8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
28 changes: 28 additions & 0 deletions packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class Connector extends BaseConnector {

onCustomFormAction(
tabId: string,
messageId: string,
action: {
id: string
text?: string | undefined
Expand All @@ -105,6 +106,33 @@ export class Connector extends BaseConnector {
tabID: tabId,
description: action.description,
})

if (this.onChatAnswerUpdated === undefined) {
return
}
const answer: ChatItem = {
type: ChatItemType.ANSWER,
messageId: messageId,
buttons: [],
}
// TODO: Add more cases for Accept/Reject/viewDiff.
switch (action.id) {
case 'Provide-Feedback':
answer.buttons = [
{
keepCardAfterClick: true,
text: 'Thanks for providing feedback.',
id: 'utg_provided_feedback',
status: 'success',
position: 'outside',
disabled: true,
},
]
break
default:
break
}
this.onChatAnswerUpdated(tabId, answer)
}

onFileDiff = (tabID: string, filePath: string, deleted: boolean, messageId?: string): void => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/amazonq/webview/ui/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ export class Connector {
this.gumbyChatConnector.onCustomFormAction(tabId, action)
break
case 'testgen':
this.testChatConnector.onCustomFormAction(tabId, action)
this.testChatConnector.onCustomFormAction(tabId, messageId ?? '', action)
break
case 'review':
this.scanChatConnector.onCustomFormAction(tabId, action)
Expand Down
7 changes: 1 addition & 6 deletions packages/core/src/amazonqTest/chat/controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,6 @@ export class TestController {
getFeedbackCommentData = `Q Test Generation: RequestId: ${this.sessionStorage.getSession().startTestGenerationRequestId}, TestGenerationJobId: ${this.sessionStorage.getSession().testGenerationJob?.testGenerationJobId}`
void submitFeedback(placeholder, 'Amazon Q', getFeedbackCommentData)
telemetry.ui_click.emit({ elementId: 'unitTestGeneration_provideFeedback' })
this.messenger.sendMessage(
'Unit test generation completed. Thanks for providing feedback.',
data.tabID,
'answer'
)
break
}
}
Expand Down Expand Up @@ -435,7 +430,7 @@ export class TestController {
const buttons: ChatItemButton[] = []
if (Auth.instance.isInternalAmazonUser()) {
buttons.push({
keepCardAfterClick: false,
keepCardAfterClick: true,
text: 'How can we make /test better?',
id: ButtonActions.PROVIDE_FEEDBACK,
disabled: false, // allow button to be re-clicked
Expand Down

0 comments on commit 890bfe8

Please sign in to comment.