From 29e7509b4d8e3eeea316e77a81a58abaa6f7b2d7 Mon Sep 17 00:00:00 2001 From: Randall-Jiang Date: Thu, 16 Jan 2025 13:20:23 -0800 Subject: [PATCH 1/4] fixing fileclick work not as expected issue --- .../webview/ui/apps/testChatConnector.ts | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts b/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts index cefc2b8818f..f84f40b0a36 100644 --- a/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts +++ b/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts @@ -13,6 +13,7 @@ import { TabsStorage, TabType } from '../storages/tabsStorage' import { TestMessageType } from '../../../../amazonqTest/chat/views/connector/connector' import { ChatPayload } from '../connector' import { BaseConnector, BaseConnectorProps } from './baseConnector' +import { FollowUpTypes } from '../../../commons/types' export interface ConnectorProps extends BaseConnectorProps { sendMessageToExtension: (message: ExtensionMessage) => void @@ -35,6 +36,7 @@ export interface MessageData { } // TODO: Refactor testChatConnector, scanChatConnector and other apps connector files post RIV export class Connector extends BaseConnector { + connector: any override getTabType(): TabType { return 'testgen' } @@ -107,15 +109,40 @@ export class Connector extends BaseConnector { } onFileDiff = (tabID: string, filePath: string, deleted: boolean, messageId?: string): void => { - // TODO: add this back once we can advance flow from here - // this.sendMessageToExtension({ - // command: 'open-diff', - // tabID, - // filePath, - // deleted, - // messageId, - // tabType: 'testgen', - // }) + // Open diff view + this.sendMessageToExtension({ + command: 'open-diff', + tabID, + filePath, + deleted, + messageId, + tabType: 'testgen', + }) + this.onChatAnswerReceived?.( + tabID, + { + type: ChatItemType.ANSWER, + messageId: messageId, + followUp: { + text: ' ', + options: [ + { + type: FollowUpTypes.AcceptCode, + pillText: 'Accept', + status: 'success', + icon: MynahIcons.OK, + }, + { + type: FollowUpTypes.RejectCode, + pillText: 'Reject', + status: 'error', + icon: MynahIcons.REVERT, + }, + ], + }, + }, + {} + ) } private processChatMessage = async (messageData: any): Promise => { From 77abd415bfd5b4a7a339d17c86bdff9fe4f412f4 Mon Sep 17 00:00:00 2001 From: Randall-Jiang Date: Thu, 16 Jan 2025 14:24:52 -0800 Subject: [PATCH 2/4] addressed comment --- .../core/src/amazonq/webview/ui/apps/testChatConnector.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts b/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts index f84f40b0a36..ae179fd6c41 100644 --- a/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts +++ b/packages/core/src/amazonq/webview/ui/apps/testChatConnector.ts @@ -36,7 +36,6 @@ export interface MessageData { } // TODO: Refactor testChatConnector, scanChatConnector and other apps connector files post RIV export class Connector extends BaseConnector { - connector: any override getTabType(): TabType { return 'testgen' } @@ -109,6 +108,9 @@ export class Connector extends BaseConnector { } onFileDiff = (tabID: string, filePath: string, deleted: boolean, messageId?: string): void => { + if (this.onChatAnswerReceived === undefined) { + return + } // Open diff view this.sendMessageToExtension({ command: 'open-diff', @@ -118,7 +120,7 @@ export class Connector extends BaseConnector { messageId, tabType: 'testgen', }) - this.onChatAnswerReceived?.( + this.onChatAnswerReceived( tabID, { type: ChatItemType.ANSWER, From b3d06622150486bcafd42decca9ff9f92c909f07 Mon Sep 17 00:00:00 2001 From: Randall-Jiang Date: Thu, 16 Jan 2025 16:50:42 -0800 Subject: [PATCH 3/4] add changelog --- .../Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json diff --git a/packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json b/packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json new file mode 100644 index 00000000000..88a764744d6 --- /dev/null +++ b/packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json @@ -0,0 +1,4 @@ +{ + "type": "Bug Fix", + "description": "Enabled users to view diffs by clicking files in the file tree, aligning the behavior with the 'View Diff' button." +} From 07ae50ccd78d77b3a100d7e4ddf75f9ce15a1a12 Mon Sep 17 00:00:00 2001 From: Randall-Jiang Date: Fri, 17 Jan 2025 10:57:35 -0800 Subject: [PATCH 4/4] Update packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json update Changelog to mention the particular command Co-authored-by: Justin M. Keyes --- .../Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json b/packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json index 88a764744d6..ed66cf8d22d 100644 --- a/packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json +++ b/packages/amazonq/.changes/next-release/Bug Fix-34e877a1-d2ca-4c93-9dee-5dd2019769fe.json @@ -1,4 +1,4 @@ { "type": "Bug Fix", - "description": "Enabled users to view diffs by clicking files in the file tree, aligning the behavior with the 'View Diff' button." + "description": "`/test`: view diffs by clicking files in the file tree, aligning the behavior with the 'View Diff' button." }