Skip to content

Commit 7d7d9bb

Browse files
authored
fix(amazonq): inconsistent Quick Actions, prompt input not focused after code sent #4680
Problem: - Quick action commands are inconsistent between Q tabs (`/dev`, `/transform` and q chat) - Prompt input doesn't get focus when user sends code to Q chat - No indication when all tabs closed. Solution: - All quick action commands are now visible in all Q tab types. But depending on the tab type, some of them are disabled with description messages. - Prompt input now gets auto focus after code is sent to Q chat. It is solved with [mynah-ui update](aws/mynah-ui@402425c) which is available from version [4.5.4](https://github.com/aws/mynah-ui/releases/tag/v4.5.4) - Added indication and open new tab button when all tabs are closed with a [mynah-ui update](aws/mynah-ui@02785da) which is available from [4.5.3](https://github.com/aws/mynah-ui/releases/tag/v4.5.3)
1 parent 501168d commit 7d7d9bb

File tree

5 files changed

+91
-45
lines changed

5 files changed

+91
-45
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Amazon Q: Fixed quick action command list inconsistency between Q tabs"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Amazon Q: Fixed cursor not focuses to prompt input when code is sent to Q Chat"
4+
}

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4308,7 +4308,7 @@
43084308
"@aws-sdk/property-provider": "3.46.0",
43094309
"@aws-sdk/smithy-client": "^3.46.0",
43104310
"@aws-sdk/util-arn-parser": "^3.46.0",
4311-
"@aws/mynah-ui": "4.4.3",
4311+
"@aws/mynah-ui": "4.5.4",
43124312
"@gerhobbelt/gitignore-parser": "^0.2.0-9",
43134313
"@iarna/toml": "^2.2.5",
43144314
"@smithy/shared-ini-file-loader": "^2.2.8",

packages/core/src/amazonq/webview/ui/quickActions/generator.ts

Lines changed: 78 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { QuickActionCommandGroup } from '@aws/mynah-ui/dist/static'
6+
import { QuickActionCommand, QuickActionCommandGroup } from '@aws/mynah-ui/dist/static'
77
import { TabType } from '../storages/tabsStorage'
88

99
export interface QuickActionGeneratorProps {
@@ -21,51 +21,89 @@ export class QuickActionGenerator {
2121
}
2222

2323
public generateForTab(tabType: TabType): QuickActionCommandGroup[] {
24-
switch (tabType) {
25-
case 'featuredev':
26-
return []
27-
default:
28-
return [
29-
...(this.isFeatureDevEnabled
30-
? [
24+
const quickActionCommands = [
25+
...(this.isFeatureDevEnabled
26+
? [
27+
{
28+
groupName: 'Application Development',
29+
commands: [
3130
{
32-
groupName: 'Application Development',
33-
commands: [
34-
{
35-
command: '/dev',
36-
placeholder: 'Briefly describe a task or issue',
37-
description:
38-
'Use all project files as context for code suggestions (increases latency).',
39-
},
40-
],
31+
command: '/dev',
32+
placeholder: 'Briefly describe a task or issue',
33+
description:
34+
'Use all project files as context for code suggestions (increases latency).',
4135
},
42-
]
43-
: []),
44-
...(this.isGumbyEnabled
45-
? [
36+
],
37+
},
38+
]
39+
: []),
40+
...(this.isGumbyEnabled
41+
? [
42+
{
43+
commands: [
4644
{
47-
commands: [
48-
{
49-
command: '/transform',
50-
description: 'Transform your Java 8 or 11 Maven project to Java 17',
51-
},
52-
],
45+
command: '/transform',
46+
description: 'Transform your Java 8 or 11 Maven project to Java 17',
5347
},
54-
]
55-
: []),
48+
],
49+
},
50+
]
51+
: []),
52+
{
53+
commands: [
5654
{
57-
commands: [
58-
{
59-
command: '/help',
60-
description: 'Learn more about Amazon Q',
61-
},
62-
{
63-
command: '/clear',
64-
description: 'Clear this session',
65-
},
66-
],
55+
command: '/help',
56+
description: 'Learn more about Amazon Q',
6757
},
68-
]
58+
{
59+
command: '/clear',
60+
description: 'Clear this session',
61+
},
62+
],
63+
},
64+
]
65+
66+
const commandUnavailability: Record<
67+
TabType,
68+
{
69+
description: string
70+
unavailableItems: string[]
71+
}
72+
> = {
73+
cwc: {
74+
description: '',
75+
unavailableItems: [],
76+
},
77+
featuredev: {
78+
description: "This command isn't available in /dev",
79+
unavailableItems: ['/dev', '/transform', '/help', '/clear'],
80+
},
81+
gumby: {
82+
description: "This command isn't available in /transform",
83+
unavailableItems: ['/dev', '/transform'],
84+
},
85+
unknown: {
86+
description: "This command isn't available",
87+
unavailableItems: ['/dev', '/transform', '/help', '/clear'],
88+
},
6989
}
90+
91+
return quickActionCommands.map(commandGroup => {
92+
return {
93+
groupName: commandGroup.groupName,
94+
commands: commandGroup.commands.map((commandItem: QuickActionCommand) => {
95+
const commandNotAvailable = commandUnavailability[tabType].unavailableItems.includes(
96+
commandItem.command
97+
)
98+
return {
99+
...commandItem,
100+
disabled: commandNotAvailable,
101+
description: commandNotAvailable
102+
? commandUnavailability[tabType].description
103+
: commandItem.description,
104+
}
105+
}) as QuickActionCommand[],
106+
}
107+
}) as QuickActionCommandGroup[]
70108
}
71109
}

0 commit comments

Comments
 (0)