Skip to content

Commit 075f9a5

Browse files
Merge master into feature/emr
2 parents a2a4ec5 + 914bf73 commit 075f9a5

File tree

11 files changed

+80
-44
lines changed

11 files changed

+80
-44
lines changed

buildspec/linuxE2ETests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ phases:
3737
commands:
3838
- export HOME=/home/codebuild-user
3939
# Ignore failure until throttling issues are fixed.
40-
- xvfb-run npm run testE2E || true
40+
- xvfb-run npm run testE2E
4141
- VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
4242
- CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g')
4343
- CI_BUILD_ID="${CODEBUILD_BUILD_ID}"
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": "Fix(Amazon Q Code Transformation): show correct diff when running consecutive transformations"
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": "Improve when the welcome page is shown in amazon q chat"
4+
}

packages/core/src/amazonq/webview/generators/webViewContent.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class WebViewContentGenerator {
2323
return JSON.stringify(Array.from(featureConfigs.entries()))
2424
}
2525

26-
public async generate(extensionURI: Uri, webView: Webview, showWelcomePage: boolean): Promise<string> {
26+
public async generate(extensionURI: Uri, webView: Webview): Promise<string> {
2727
const entrypoint = process.env.WEBPACK_DEVELOPER_SERVER
2828
? 'http: localhost'
2929
: 'https: file+.vscode-resources.vscode-cdn.net'
@@ -47,14 +47,14 @@ export class WebViewContentGenerator {
4747
<head>
4848
<meta http-equiv="Content-Security-Policy" content="${contentPolicy}">
4949
<title>Amazon Q (Preview)</title>
50-
${await this.generateJS(extensionURI, webView, showWelcomePage)}
50+
${await this.generateJS(extensionURI, webView)}
5151
</head>
5252
<body ${featureDataAttributes}>
5353
</body>
5454
</html>`
5555
}
5656

57-
private async generateJS(extensionURI: Uri, webView: Webview, showWelcomePage: boolean): Promise<string> {
57+
private async generateJS(extensionURI: Uri, webView: Webview): Promise<string> {
5858
const source = path.join('vue', 'src', 'amazonq', 'webview', 'ui', 'amazonq-ui.js') // Sent to dist/vue folder in webpack.
5959
const assetsPath = Uri.joinPath(extensionURI)
6060
const javascriptUri = Uri.joinPath(assetsPath, 'dist', source)
@@ -80,14 +80,16 @@ export class WebViewContentGenerator {
8080
const disabledCommandsString = isSageMaker() ? `['/dev', '/transform']` : '[]'
8181
const disclaimerAcknowledged = globals.globalState.tryGet('aws.amazonq.disclaimerAcknowledged', Boolean, false)
8282

83+
const welcomeLoadCount = globals.globalState.tryGet('aws.amazonq.welcomeChatShowCount', Number, 0)
84+
8385
return `
8486
<script type="text/javascript" src="${javascriptEntrypoint.toString()}" defer onload="init()"></script>
8587
${cssLinks}
8688
<script type="text/javascript">
8789
const init = () => {
8890
createMynahUI(acquireVsCodeApi(), ${
8991
(await AuthUtil.instance.getChatAuthState()).amazonQ === 'connected'
90-
},${featureConfigsString},${showWelcomePage},${disclaimerAcknowledged},${disabledCommandsString});
92+
},${featureConfigsString},${welcomeLoadCount},${disclaimerAcknowledged},${disabledCommandsString});
9193
}
9294
</script>
9395
`

packages/core/src/amazonq/webview/messages/messageDispatcher.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ export function dispatchWebViewMessagesToApps(
7474
globals.globalState.tryUpdate('aws.amazonq.disclaimerAcknowledged', true)
7575
return
7676
}
77+
case 'update-welcome-count': {
78+
const currentLoadCount = globals.globalState.tryGet('aws.amazonq.welcomeChatShowCount', Number, 0)
79+
void globals.globalState.tryUpdate('aws.amazonq.welcomeChatShowCount', currentLoadCount + 1)
80+
return
81+
}
7782
}
7883

7984
if (msg.type === 'error') {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ type MessageCommand =
4141
| 'review'
4242
| 'open-user-guide'
4343
| 'send-telemetry'
44+
| 'update-welcome-count'
4445

4546
export type ExtensionMessage = Record<string, any> & { command: MessageCommand }

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

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,17 @@ import { agentWalkthroughDataModel } from './walkthrough/agent'
3333
import { createClickTelemetry, createOpenAgentTelemetry } from './telemetry/actions'
3434
import { disclaimerAcknowledgeButtonId, disclaimerCard } from './texts/disclaimer'
3535

36+
/**
37+
* The number of welcome chat tabs that can be opened before the NEXT one will become
38+
* a regular chat tab.
39+
*/
40+
const welcomeCountThreshold = 3
41+
3642
export const createMynahUI = (
3743
ideApi: any,
3844
amazonQEnabled: boolean,
3945
featureConfigsSerialized: [string, FeatureContext][],
40-
showWelcomePage: boolean,
46+
welcomeCount: number,
4147
disclaimerAcknowledged: boolean,
4248
disabledCommands?: string[]
4349
) => {
@@ -70,11 +76,23 @@ export const createMynahUI = (
7076
})
7177
},
7278
})
79+
80+
const showWelcomePage = () => {
81+
return welcomeCount < welcomeCountThreshold
82+
}
83+
84+
const updateWelcomeCount = () => {
85+
ideApi.postMessage({
86+
command: 'update-welcome-count',
87+
})
88+
welcomeCount += 1
89+
}
90+
7391
// Adding the first tab as CWC tab
7492
tabsStorage.addTab({
7593
id: 'tab-1',
7694
status: 'free',
77-
type: showWelcomePage ? 'welcome' : 'cwc',
95+
type: showWelcomePage() ? 'welcome' : 'cwc',
7896
isSelected: true,
7997
})
8098

@@ -541,6 +559,25 @@ export const createMynahUI = (
541559
mynahUI = new MynahUI({
542560
onReady: connector.uiReady,
543561
onTabAdd: (tabID: string) => {
562+
/**
563+
* If the next tab opening will cross the welcome count threshold then
564+
* update the next tabs defaults
565+
*/
566+
if (welcomeCount + 1 >= welcomeCountThreshold) {
567+
tabsStorage.updateTabTypeFromUnknown(tabID, 'cwc')
568+
mynahUI?.updateTabDefaults({
569+
store: {
570+
...tabDataGenerator.getTabData('cwc', true),
571+
tabHeaderDetails: void 0,
572+
compactMode: false,
573+
tabBackground: false,
574+
},
575+
})
576+
} else {
577+
// we haven't reached the welcome count limit yet
578+
updateWelcomeCount()
579+
}
580+
544581
// If featureDev has changed availability inbetween the default store settings and now
545582
// make sure to show/hide it accordingly
546583
mynahUI.updateStore(tabID, {
@@ -812,15 +849,17 @@ export const createMynahUI = (
812849
'tab-1': {
813850
isSelected: true,
814851
store: {
815-
...(showWelcomePage
852+
...(showWelcomePage()
816853
? welcomeScreenTabData(tabDataGenerator).store
817854
: tabDataGenerator.getTabData('cwc', true)),
818855
...(disclaimerCardActive ? { promptInputStickyCard: disclaimerCard } : {}),
819856
},
820857
},
821858
},
822859
defaults: {
823-
store: tabDataGenerator.getTabData('cwc', true),
860+
store: showWelcomePage()
861+
? welcomeScreenTabData(tabDataGenerator).store
862+
: tabDataGenerator.getTabData('cwc', true),
824863
},
825864
config: {
826865
maxTabs: 10,
@@ -829,6 +868,14 @@ export const createMynahUI = (
829868
},
830869
})
831870

871+
/**
872+
* Update the welcome count if we've initially shown
873+
* the welcome page
874+
*/
875+
if (showWelcomePage()) {
876+
updateWelcomeCount()
877+
}
878+
832879
followUpsInteractionHandler = new FollowUpInteractionHandler({
833880
mynahUI,
834881
connector,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class QuickActionGenerator {
8686
? [
8787
{
8888
command: '/transform',
89-
description: 'Transform your Java 8, 11, or 17 Maven projects',
89+
description: 'Transform your Java project',
9090
icon: MynahIcons.TRANSFORM,
9191
},
9292
]

packages/core/src/amazonq/webview/webView.ts

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ import { TabType } from './ui/storages/tabsStorage'
2222
import { deactivateInitialViewBadge, shouldShowBadge } from '../util/viewBadgeHandler'
2323
import { telemetry } from '../../shared/telemetry/telemetry'
2424
import { amazonqMark } from '../../shared/performance/marks'
25-
import { globals } from '../../shared'
26-
import { AuthUtil } from '../../codewhisperer/util/authUtil'
27-
28-
// The max number of times we should show the welcome to q chat panel before moving them to the regular one
29-
const maxWelcomeWebviewLoads = 3
3025

3126
export class AmazonQChatViewProvider implements WebviewViewProvider {
3227
public static readonly viewType = 'aws.AmazonQChatView'
@@ -65,33 +60,10 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
6560

6661
dispatchAppsMessagesToWebView(webviewView.webview, this.appsMessagesListener)
6762

68-
/**
69-
* Show the welcome to q chat ${maxWelcomeWebviewLoads} times before showing the normal panel
70-
*/
71-
const welcomeLoadCount = globals.globalState.tryGet('aws.amazonq.welcomeChatShowCount', Number, 0)
72-
if (welcomeLoadCount < maxWelcomeWebviewLoads) {
73-
webviewView.webview.html = await this.webViewContentGenerator.generate(
74-
this.extensionContext.extensionUri,
75-
webviewView.webview,
76-
true
77-
)
78-
79-
/**
80-
* resolveWebviewView gets called even when the user isn't logged in and the auth page is showing.
81-
* We don't want to incremenent the show count until the user has fully logged in and resolveWebviewView
82-
* gets called again
83-
*/
84-
const authenticated = (await AuthUtil.instance.getChatAuthState()).amazonQ === 'connected'
85-
if (authenticated) {
86-
await globals.globalState.update('aws.amazonq.welcomeChatShowCount', welcomeLoadCount + 1)
87-
}
88-
} else {
89-
webviewView.webview.html = await this.webViewContentGenerator.generate(
90-
this.extensionContext.extensionUri,
91-
webviewView.webview,
92-
false
93-
)
94-
}
63+
webviewView.webview.html = await this.webViewContentGenerator.generate(
64+
this.extensionContext.extensionUri,
65+
webviewView.webview
66+
)
9567

9668
performance.mark(amazonqMark.open)
9769

packages/core/src/codewhisperer/models/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ export const absolutePathDetectedMessage = (numPaths: number, buildFile: string,
579579
`I detected ${numPaths} potential absolute file path(s) in your ${buildFile} file: **${listOfPaths}**. Absolute file paths might cause issues when I build your code. Any errors will show up in the build log.`
580580

581581
export const selectSQLMetadataFileHelpMessage =
582-
'Okay, I can convert the embedded SQL code for your Oracle to PostgreSQL transformation. To get started, upload the zipped metadata file from your schema conversion in AWS Data Migration Service (DMS). To retrieve the metadata file:\n1. Open your database migration project in the AWS DMS console.\n2. Open the schema conversion and choose **Convert the embedded SQL in your application**.\n3. Choose the link to Amazon S3 console.\n\nYou can download the metadata file from the {schema-conversion-project}/ directory. For more info, refer to the [documentation](https://docs.aws.amazon.com/dms/latest/userguide/schema-conversion-save-apply.html#schema-conversion-save).'
582+
'Okay, I can convert the embedded SQL code for your Oracle to PostgreSQL transformation. To get started, upload the zipped metadata file from your schema conversion in AWS Data Migration Service (DMS). To retrieve the metadata file:\n1. Open your database migration project in the AWS DMS console.\n2. Open the schema conversion and choose **Convert the embedded SQL in your application**.\n3. Once you complete the conversion, close the project and go to the S3 bucket where your project is stored.\n4. Open the folder and find the project folder ("sct-project").\n5. Download the object inside the project folder. This will be a zip file.\n\nFor more info, refer to the [documentation](https://docs.aws.amazon.com/dms/latest/userguide/schema-conversion-save-apply.html#schema-conversion-save).'
583583

584584
export const invalidMetadataFileUnsupportedSourceDB =
585585
'I can only convert SQL for migrations from an Oracle source database. The provided .sct file indicates another source database for this migration.'

0 commit comments

Comments
 (0)