Skip to content

Commit b0e62b4

Browse files
authWebview: Webview final release (#3630)
* update package.json telemetry module Signed-off-by: Nikolas Komonen <[email protected]> * metric: close webview metric This is the metric that gets emitted when the user closes the webview Signed-off-by: Nikolas Komonen <[email protected]> * feat: isInDevEnv() function Signed-off-by: Nikolas Komonen <[email protected]> * metric: first startup metric This is the metric that gets emitted when a new user first starts up the extension. It mainly includes information about if credentials existed prior to extension installation. Signed-off-by: Nikolas Komonen <[email protected]> * metric: initial UI click infra + use This sets up the initial ui click infra to call the metric from the UI and then uses it for a couple metrics. Additional: How the infra works, a component extends the TelemetryClient vue component and has access to methods that directly call the ui click backend command. We can add more over time to this component. Signed-off-by: Nikolas Komonen <[email protected]> * metric: identity center info button ui click Signed-off-by: Nikolas Komonen <[email protected]> * metric: learn more codewhisperer ui click Signed-off-by: Nikolas Komonen <[email protected]> * metric: learn more code catalyst ui click Signed-off-by: Nikolas Komonen <[email protected]> * metric: explorer expand identity center ui click Signed-off-by: Nikolas Komonen <[email protected]> * metric: expand identity center in explorer ui click Signed-off-by: Nikolas Komonen <[email protected]> * metric: expand identity center in codewhisperer ui click Signed-off-by: Nikolas Komonen <[email protected]> * metric: open feature/service ui click metric This is the success metric Signed-off-by: Nikolas Komonen <[email protected]> * metric: edit credentials in credentials form ui click Signed-off-by: Nikolas Komonen <[email protected]> * metric: signout button ui click Signed-off-by: Nikolas Komonen <[email protected]> * fix: resourceExplorer -> awsExplorer + credentials form - Change uses of 'resourceExplorer' to 'awsExplorer' - The credentials form did not clear previous data from the state on submission. Additionally, if there was a formatting error the user could still submit. Signed-off-by: Nikolas Komonen <[email protected]> * error message object for Builder ID + IC Before we sent a string as the error message. But we realized that for metrics we will probably want to know the actual type of error. The issue is if we use the message as an identifier we cannot change the message. Solution: Send an error object with an id that will remain static but also a message which can be dynamic Signed-off-by: Nikolas Komonen <[email protected]> * error object Credentials Now just pass the whole error object instead of just the error message Signed-off-by: Nikolas Komonen <[email protected]> * builder id form submit metric - Emit if failed/success/cancelled once a user starts interacting with a builder id form Signed-off-by: Nikolas Komonen <[email protected]> * metric: identity center submission - Emit metric on success or fail for IC - Set invalid input field for start url Signed-off-by: Nikolas Komonen <[email protected]> * metric: credentials submission Signed-off-by: Nikolas Komonen <[email protected]> * fix: startup metrics were failing since telemetry client not initialized Signed-off-by: Nikolas Komonen <[email protected]> * minor fixes Signed-off-by: Nikolas Komonen <[email protected]> * metric: open/close webview metric Takes a beginning and end snapshot of the current state Signed-off-by: Nikolas Komonen <[email protected]> * docs: Add docstrings for telemetry functions/properties Signed-off-by: Nikolas Komonen <[email protected]> * fix: input forms did not update backed when they had errors Signed-off-by: Nikolas Komonen <[email protected]> * fix: margins + status bar credential message Signed-off-by: Nikolas Komonen <[email protected]> * fix: gif links Signed-off-by: Nikolas Komonen <[email protected]> * fix: have window wrap later This should retain the landscape mode for longer before it switched to portrait mode Signed-off-by: Nikolas Komonen <[email protected]> * remove dev mode check Signed-off-by: Nikolas Komonen <[email protected]> * remove initial walkthrough Signed-off-by: Nikolas Komonen <[email protected]> * fix: status bar not updating Fields in the computed section do not always update. I moved the function to the methods section instead and it will get the latest info. Signed-off-by: Nikolas Komonen <[email protected]> * minor metric change Signed-off-by: Nikolas Komonen <[email protected]> * logging: Update logging messages Signed-off-by: Nikolas Komonen <[email protected]> * refactor: dont have default region for identity center - Also show inline errors for region - Do some metrics interaction calls when we update the region Signed-off-by: Nikolas Komonen <[email protected]> * metric: open connection quickpick from status bar ui click Signed-off-by: Nikolas Komonen <[email protected]> * final metrics work Signed-off-by: Nikolas Komonen <[email protected]> * move professional tier hyperlink Signed-off-by: Nikolas Komonen <[email protected]> * rename title of add connection Signed-off-by: Nikolas Komonen <[email protected]> * change identity center region selector Signed-off-by: Nikolas Komonen <[email protected]> * metric: professional tier ui click cw Signed-off-by: Nikolas Komonen <[email protected]> * badStartUrl error message fix Signed-off-by: Nikolas Komonen <[email protected]> * pr: Some fixes from comments Signed-off-by: Nikolas Komonen <[email protected]> * remove choose default region prompt on startup Previously users would see a quickpick of if they wanted to add the region that was associated with their current credentials if it was not already added. The issue is we don't want to show this quickpick. Solution: Don't show the quickpick anymore, just add the region and if they want they can unadd it in the explorer Signed-off-by: Nikolas Komonen <[email protected]> * remove startup metrics We do not need these metrics anymore. The other metrics will provide this information Signed-off-by: Nikolas Komonen <[email protected]> * auth forms propogate their id up to the root Signed-off-by: Nikolas Komonen <[email protected]> * forward each successful auth form to backend Signed-off-by: Nikolas Komonen <[email protected]> * New Telemetry Implementation Signed-off-by: Nikolas Komonen <[email protected]> * changelog Signed-off-by: Nikolas Komonen <[email protected]> * remove quickstart prompt on new install Signed-off-by: Nikolas Komonen <[email protected]> * remove quickstart prompt + switch CC dev env gif Signed-off-by: Nikolas Komonen <[email protected]> --------- Signed-off-by: Nikolas Komonen <[email protected]>
1 parent 4535bf3 commit b0e62b4

31 files changed

+917
-350
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "New Add Connection workflow"
4+
}
-1.77 MB
Loading

package-lock.json

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

package.json

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,8 +1108,7 @@
11081108
"when": "false"
11091109
},
11101110
{
1111-
"command": "aws.auth.manageConnections",
1112-
"when": "aws.isDevMode"
1111+
"command": "aws.auth.manageConnections"
11131112
},
11141113
{
11151114
"command": "aws.ec2.connectToInstance",
@@ -3288,48 +3287,7 @@
32883287
}
32893288
}
32903289
],
3291-
"walkthroughs": [
3292-
{
3293-
"id": "getStarted",
3294-
"title": "%AWS.walkthrough.gettingStarted.title%",
3295-
"description": "%AWS.walkthrough.gettingStarted.description%",
3296-
"cloud9": {
3297-
"cn": {
3298-
"description": "%AWS.walkthrough.gettingStarted.description.cn%"
3299-
}
3300-
},
3301-
"steps": [
3302-
{
3303-
"id": "connect",
3304-
"title": "%AWS.walkthrough.gettingStarted.connect%",
3305-
"media": {
3306-
"markdown": "resources/walkthrough/setup-connect.md"
3307-
},
3308-
"completionEvents": [
3309-
"onCommand:aws.login",
3310-
"onCommand:aws.credentials.profile.create"
3311-
]
3312-
},
3313-
{
3314-
"id": "changeRegions",
3315-
"title": "%AWS.walkthrough.gettingStarted.changeRegions%",
3316-
"media": {
3317-
"markdown": "resources/walkthrough/setup-region.md"
3318-
},
3319-
"completionEvents": [
3320-
"onCommand:aws.showRegion"
3321-
]
3322-
},
3323-
{
3324-
"id": "setupToolchain",
3325-
"title": "%AWS.walkthrough.gettingStarted.setupToolchain%",
3326-
"media": {
3327-
"markdown": "resources/walkthrough/setup-toolchain.md"
3328-
}
3329-
}
3330-
]
3331-
}
3332-
],
3290+
"walkthroughs": [],
33333291
"icons": {
33343292
"aws-apprunner-service": {
33353293
"description": "AWS Contributed Icon",
@@ -3496,7 +3454,7 @@
34963454
"report": "nyc report --reporter=html --reporter=json"
34973455
},
34983456
"devDependencies": {
3499-
"@aws-toolkits/telemetry": "^1.0.131",
3457+
"@aws-toolkits/telemetry": "^1.0.136",
35003458
"@cspotcode/source-map-support": "^0.8.1",
35013459
"@sinonjs/fake-timers": "^10.0.2",
35023460
"@types/adm-zip": "^0.4.34",

src/auth/activation.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import { LoginManager } from './deprecated/loginManager'
1010
import { fromString } from './providers/credentials'
1111
import { registerCommandsWithVSCode } from '../shared/vscode/commands2'
1212
import { AuthCommandBackend, AuthCommandDeclarations } from './commands'
13-
import { DevSettings } from '../shared/settings'
1413
import { ExtensionUse } from '../shared/utilities/vsCodeUtils'
14+
import { getLogger } from '../shared/logger'
15+
import { isInDevEnv } from '../codecatalyst/utils'
1516

1617
export async function initialize(
1718
extensionContext: vscode.ExtensionContext,
@@ -35,21 +36,26 @@ export async function initialize(
3536
new AuthCommandBackend(extensionContext)
3637
)
3738

38-
if (DevSettings.instance.isDevMode()) {
39-
showManageConnectionsOnStartup()
40-
}
39+
showManageConnectionsOnStartup()
4140
}
4241

4342
/**
44-
* Show the Manage Connections page when the extension starts up.
45-
*
46-
* Additionally, we provide an information message with a button for users to not show it
47-
* again on next startup.
43+
* Show the Manage Connections page when the extension starts up, if it should be shown.
4844
*/
4945
async function showManageConnectionsOnStartup() {
5046
if (!ExtensionUse.instance.isFirstUse()) {
47+
getLogger().debug(
48+
'firstStartup: This is not the users first use of the extension, skipping showing Add Connections page.'
49+
)
50+
return
51+
}
52+
53+
if (isInDevEnv()) {
54+
// A dev env will have an existing connection so this scenario is redundant. But keeping
55+
// for reference.
56+
getLogger().debug('firstStartup: Detected we are in Dev Env, skipping showing Add Connections page.')
5157
return
5258
}
5359

54-
AuthCommandDeclarations.instance.declared.showConnectionsPage.execute()
60+
AuthCommandDeclarations.instance.declared.showConnectionsPage.execute('firstStartup')
5561
}

src/auth/commands.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
import * as vscode from 'vscode'
66
import { CommandDeclarations, Commands } from '../shared/vscode/commands2'
7-
import { showAuthWebview } from './ui/vue/show'
7+
import { AuthSource, showAuthWebview } from './ui/vue/show'
88
import { ServiceItemId, isServiceItemId } from './ui/vue/types'
99
import { showConnectionsPageCommand } from './utils'
1010

@@ -14,13 +14,17 @@ import { showConnectionsPageCommand } from './utils'
1414
export class AuthCommandBackend {
1515
constructor(private readonly extContext: vscode.ExtensionContext) {}
1616

17-
public showConnectionsPage(serviceToShow?: ServiceItemId) {
17+
public showConnectionsPage(source: AuthSource, serviceToShow?: ServiceItemId) {
1818
// Edge case where called by vscode UI and non ServiceItemId object
1919
// is passed in.
20+
if (typeof source !== 'string') {
21+
source = 'unknown'
22+
}
23+
2024
if (!isServiceItemId(serviceToShow)) {
2125
serviceToShow = undefined
2226
}
23-
return showAuthWebview(this.extContext, serviceToShow)
27+
return showAuthWebview(this.extContext, source, serviceToShow)
2428
}
2529
}
2630

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
<script lang="ts">
22
import { defineComponent } from 'vue'
3-
import { AuthStatus } from './shared.vue'
43
import { AuthFormId } from './types'
4+
import TelemetryClient from '../telemetry.vue'
55
66
export type ConnectionUpdateCause = 'signIn' | 'signOut' | 'created'
77
export type ConnectionUpdateArgs = { id: AuthFormId; isConnected: boolean; cause?: ConnectionUpdateCause }
88
99
export default defineComponent({
1010
emits: ['auth-connection-updated'],
11+
extends: TelemetryClient,
1112
methods: {
1213
emitAuthConnectionUpdated(args: ConnectionUpdateArgs) {
1314
this.$emit('auth-connection-updated', args)
1415
},
1516
},
1617
})
17-
18-
export class UnimplementedAuthStatus implements AuthStatus {
19-
isAuthConnected(): Promise<boolean> {
20-
return Promise.resolve(false)
21-
}
22-
}
2318
</script>

0 commit comments

Comments
 (0)