Skip to content

Commit 890bfe8

Browse files
authored
fix(amazonq): ux modifications in utg feedback mechanism #6763
## 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.
1 parent cc53d2d commit 890bfe8

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export class Connector extends BaseConnector {
8686

8787
onCustomFormAction(
8888
tabId: string,
89+
messageId: string,
8990
action: {
9091
id: string
9192
text?: string | undefined
@@ -105,6 +106,33 @@ export class Connector extends BaseConnector {
105106
tabID: tabId,
106107
description: action.description,
107108
})
109+
110+
if (this.onChatAnswerUpdated === undefined) {
111+
return
112+
}
113+
const answer: ChatItem = {
114+
type: ChatItemType.ANSWER,
115+
messageId: messageId,
116+
buttons: [],
117+
}
118+
// TODO: Add more cases for Accept/Reject/viewDiff.
119+
switch (action.id) {
120+
case 'Provide-Feedback':
121+
answer.buttons = [
122+
{
123+
keepCardAfterClick: true,
124+
text: 'Thanks for providing feedback.',
125+
id: 'utg_provided_feedback',
126+
status: 'success',
127+
position: 'outside',
128+
disabled: true,
129+
},
130+
]
131+
break
132+
default:
133+
break
134+
}
135+
this.onChatAnswerUpdated(tabId, answer)
108136
}
109137

110138
onFileDiff = (tabID: string, filePath: string, deleted: boolean, messageId?: string): void => {

packages/core/src/amazonq/webview/ui/connector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ export class Connector {
695695
this.gumbyChatConnector.onCustomFormAction(tabId, action)
696696
break
697697
case 'testgen':
698-
this.testChatConnector.onCustomFormAction(tabId, action)
698+
this.testChatConnector.onCustomFormAction(tabId, messageId ?? '', action)
699699
break
700700
case 'review':
701701
this.scanChatConnector.onCustomFormAction(tabId, action)

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,6 @@ export class TestController {
396396
getFeedbackCommentData = `Q Test Generation: RequestId: ${this.sessionStorage.getSession().startTestGenerationRequestId}, TestGenerationJobId: ${this.sessionStorage.getSession().testGenerationJob?.testGenerationJobId}`
397397
void submitFeedback(placeholder, 'Amazon Q', getFeedbackCommentData)
398398
telemetry.ui_click.emit({ elementId: 'unitTestGeneration_provideFeedback' })
399-
this.messenger.sendMessage(
400-
'Unit test generation completed. Thanks for providing feedback.',
401-
data.tabID,
402-
'answer'
403-
)
404399
break
405400
}
406401
}
@@ -435,7 +430,7 @@ export class TestController {
435430
const buttons: ChatItemButton[] = []
436431
if (Auth.instance.isInternalAmazonUser()) {
437432
buttons.push({
438-
keepCardAfterClick: false,
433+
keepCardAfterClick: true,
439434
text: 'How can we make /test better?',
440435
id: ButtonActions.PROVIDE_FEEDBACK,
441436
disabled: false, // allow button to be re-clicked

0 commit comments

Comments
 (0)