@@ -10,6 +10,7 @@ import * as fs from 'fs';
10
10
import * as os from 'os' ;
11
11
import * as uuid from 'uuid' ;
12
12
import { GitpodPluginModel , GitpodExtensionContext , setupGitpodContext , registerTasks , registerIpcHookCli } from 'gitpod-shared' ;
13
+ import { TEAM_IDS_ATTRIBUTE } from '@gitpod/gitpod-protocol/lib/experiments/configcat' ;
13
14
import { GetTokenRequest } from '@gitpod/supervisor-api-grpc/lib/token_pb' ;
14
15
import { PortsStatus , ExposedPortInfo , PortsStatusRequest , PortsStatusResponse , PortVisibility , OnPortExposedAction } from '@gitpod/supervisor-api-grpc/lib/status_pb' ;
15
16
import { TunnelVisiblity , TunnelPortRequest , RetryAutoExposeRequest , CloseTunnelRequest } from '@gitpod/supervisor-api-grpc/lib/port_pb' ;
@@ -498,6 +499,10 @@ class GitpodPortViewProvider implements vscode.WebviewViewProvider {
498
499
if ( ! port ) { return ; }
499
500
if ( message . command === 'urlCopy' && port . status . exposed ) {
500
501
await vscode . env . clipboard . writeText ( port . status . exposed . url ) ;
502
+ this . context . fireAnalyticsEvent ( {
503
+ eventName : 'vscode_execute_command_gitpod_ports' ,
504
+ properties : { action : 'urlCopy' , isWebview : true , userOverride : isUserOverrideSetting ( 'gitpod.experimental.portsView.enabled' ) ? 'on' : 'off' }
505
+ } ) ;
501
506
return ;
502
507
}
503
508
vscode . commands . executeCommand ( 'gitpod.ports.' + message . command , { port, isWebview : true } ) ;
@@ -585,18 +590,12 @@ async function registerPorts(context: GitpodExtensionContext): Promise<void> {
585
590
586
591
const isSaaSGitpod = context . info . getGitpodHost ( ) === 'https://gitpod.io' ;
587
592
async function getPortsViewExperimentEnable ( ) : Promise < boolean > {
588
- const isEnabled = isSaaSGitpod
589
- ? ( await experiments . get < boolean > ( 'gitpod.experimental.portsView.enabled' , ( await context . user ) . id ) ) !
593
+
594
+ return isSaaSGitpod
595
+ ? ( await experiments . get < boolean > ( 'gitpod.experimental.portsView.enabled' , ( await context . user ) . id , {
596
+ [ TEAM_IDS_ATTRIBUTE ] : ( await context . userTeams ) . map ( e => e . id ) . join ( ',' ) ,
597
+ } ) ) !
590
598
: vscode . workspace . getConfiguration ( 'gitpod' ) . get < boolean > ( 'experimental.portsView.enabled' ) ! ;
591
- const userOverride = isUserOverrideSetting ( 'gitpod.remote.useLocalApp' ) ;
592
- context . fireAnalyticsEvent ( {
593
- eventName : 'vscode_experimental_ports_view' ,
594
- properties : {
595
- enabled : isEnabled ,
596
- userOverride,
597
- }
598
- } ) ;
599
- return isEnabled ;
600
599
}
601
600
602
601
context . subscriptions . push ( observePortsStatus ( ) ) ;
@@ -638,14 +637,14 @@ async function registerPorts(context: GitpodExtensionContext): Promise<void> {
638
637
context . subscriptions . push ( vscode . commands . registerCommand ( 'gitpod.ports.makePrivate' , ( { port, isWebview } : PortItem ) => {
639
638
context . fireAnalyticsEvent ( {
640
639
eventName : 'vscode_execute_command_gitpod_ports' ,
641
- properties : { action : 'private' , isWebview : ! ! isWebview }
640
+ properties : { action : 'private' , isWebview : ! ! isWebview , userOverride : isUserOverrideSetting ( 'gitpod.experimental.portsView.enabled' ) ? 'on' : 'off' }
642
641
} ) ;
643
642
return port . setPortVisibility ( 'private' ) ;
644
643
} ) ) ;
645
644
context . subscriptions . push ( vscode . commands . registerCommand ( 'gitpod.ports.makePublic' , ( { port, isWebview } : PortItem ) => {
646
645
context . fireAnalyticsEvent ( {
647
646
eventName : 'vscode_execute_command_gitpod_ports' ,
648
- properties : { action : 'public' , isWebview : ! ! isWebview }
647
+ properties : { action : 'public' , isWebview : ! ! isWebview , userOverride : isUserOverrideSetting ( 'gitpod.experimental.portsView.enabled' ) ? 'on' : 'off' }
649
648
} ) ;
650
649
return port . setPortVisibility ( 'public' ) ;
651
650
} ) ) ;
@@ -658,14 +657,14 @@ async function registerPorts(context: GitpodExtensionContext): Promise<void> {
658
657
context . subscriptions . push ( vscode . commands . registerCommand ( 'gitpod.ports.preview' , ( { port, isWebview } : PortItem ) => {
659
658
context . fireAnalyticsEvent ( {
660
659
eventName : 'vscode_execute_command_gitpod_ports' ,
661
- properties : { action : 'preview' , isWebview : ! ! isWebview }
660
+ properties : { action : 'preview' , isWebview : ! ! isWebview , userOverride : isUserOverrideSetting ( 'gitpod.experimental.portsView.enabled' ) ? 'on' : 'off' }
662
661
} ) ;
663
662
return openPreview ( port ) ;
664
663
} ) ) ;
665
664
context . subscriptions . push ( vscode . commands . registerCommand ( 'gitpod.ports.openBrowser' , ( { port, isWebview } : PortItem ) => {
666
665
context . fireAnalyticsEvent ( {
667
666
eventName : 'vscode_execute_command_gitpod_ports' ,
668
- properties : { action : 'openBrowser' , isWebview : ! ! isWebview }
667
+ properties : { action : 'openBrowser' , isWebview : ! ! isWebview , userOverride : isUserOverrideSetting ( 'gitpod.experimental.portsView.enabled' ) ? 'on' : 'off' }
669
668
} ) ;
670
669
return openExternal ( port ) ;
671
670
} ) ) ;
0 commit comments