Skip to content

Commit ee48889

Browse files
mustard-mhjeanp413
authored andcommitted
Improve vscode_execute_command_gitpod_ports event
1 parent b5dc5f7 commit ee48889

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

extensions/gitpod-shared/src/analytics.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ export type GitpodAnalyticsEvent =
3838
action: 'share' | 'stop-sharing' | 'stop' | 'snapshot' | 'extend-timeout';
3939
}> |
4040
GAET<'vscode_execute_command_gitpod_ports', {
41-
action: 'private' | 'public' | 'preview' | 'openBrowser';
41+
action: 'private' | 'public' | 'preview' | 'openBrowser' | 'urlCopy';
4242
isWebview?: boolean;
43+
userOverride?: string; // 'true' | 'false'
4344
}> |
4445
GAET<'vscode_execute_command_gitpod_config', {
4546
action: 'remove' | 'add';

extensions/gitpod-web/portsview/src/porttable/PortLocalAddress.svelte

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
function onHoverCommand(command: string) {
3737
dispatch("command", { command: command as PortCommand, port });
3838
}
39+
function openAddr(e: Event) {
40+
e.preventDefault();
41+
if (port.status.exposed.url) {
42+
dispatch("command", { command: "openBrowser" as PortCommand, port });
43+
}
44+
}
3945
</script>
4046

4147
<HoverOptions
@@ -45,7 +51,7 @@
4551
onHoverCommand(e.detail);
4652
}}
4753
>
48-
<a href={port.status.exposed.url}>{port.status.exposed.url}</a>
54+
<a on:click={(e) => { openAddr(e) }} href={port.status.exposed.url}>{port.status.exposed.url}</a>
4955
</HoverOptions>
5056

5157
<style>

extensions/gitpod-web/src/extension.ts

+4
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,10 @@ class GitpodPortViewProvider implements vscode.WebviewViewProvider {
498498
if (!port) { return; }
499499
if (message.command === 'urlCopy' && port.status.exposed) {
500500
await vscode.env.clipboard.writeText(port.status.exposed.url);
501+
this.context.fireAnalyticsEvent({
502+
eventName: 'vscode_execute_command_gitpod_ports',
503+
properties: { action: 'urlCopy', isWebview: true, userOverride: String(isUserOverrideSetting('gitpod.experimental.portsView.enabled')) }
504+
});
501505
return;
502506
}
503507
vscode.commands.executeCommand('gitpod.ports.' + message.command, { port, isWebview: true });

0 commit comments

Comments
 (0)