Skip to content

Commit

Permalink
tunnels: add preview dialog for turning on tunnel access
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Dec 2, 2022
1 parent 392aa77 commit 25cfb20
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/src/commands/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ pub enum TunnelSubcommand {
#[clap(subcommand)]
User(TunnelUserSubCommands),

/// Manages the tunnel when installed as a system service,
/// (Preview) Manages the tunnel when installed as a system service,
#[clap(subcommand)]
Service(TunnelServiceSubCommands),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const REMOTE_TUNNEL_CONNECTION_STATE = new RawContextKey<CONTEXT_KEY_STAT
const SESSION_ID_STORAGE_KEY = 'remoteTunnelAccountPreference';

const REMOTE_TUNNEL_USED_STORAGE_KEY = 'remoteTunnelServiceUsed';
const REMOTE_TUNNEL_PROMPTED_PREVIEW_STORAGE_KEY = 'remoteTunnelServicePromptedPreview';
const REMOTE_TUNNEL_EXTENSION_RECOMMENDED_KEY = 'remoteTunnelExtensionRecommended';

type ExistingSessionItem = { session: AuthenticationSession; providerId: string; label: string; description: string };
Expand Down Expand Up @@ -487,6 +488,21 @@ export class RemoteTunnelWorkbenchContribution extends Disposable implements IWo
const clipboardService = accessor.get(IClipboardService);
const commandService = accessor.get(ICommandService);
const storageService = accessor.get(IStorageService);
const dialogService = accessor.get(IDialogService);

const didNotifyPreview = storageService.getBoolean(REMOTE_TUNNEL_PROMPTED_PREVIEW_STORAGE_KEY, StorageScope.APPLICATION, false);
if (!didNotifyPreview) {
const result = await dialogService.confirm({
message: localize('tunnel.preview', 'Remote Tunnels is currently in preview. Please report any problems using the "Help: Report Issue" command, or on Github.'),
primaryButton: localize('ok', 'OK'),
secondaryButton: localize('cancel', 'Cancel'),
});
if (!result.confirmed) {
return;
}

storageService.store(REMOTE_TUNNEL_PROMPTED_PREVIEW_STORAGE_KEY, true, StorageScope.APPLICATION, StorageTarget.USER);
}

const connectionInfo = await that.startTunnel(false);
if (connectionInfo) {
Expand Down Expand Up @@ -548,7 +564,7 @@ export class RemoteTunnelWorkbenchContribution extends Disposable implements IWo
constructor() {
super({
id: RemoteTunnelCommandIds.connecting,
title: localize('remoteTunnel.actions.manage.connecting', 'Remote Tunnel Access in Connecting'),
title: localize('remoteTunnel.actions.manage.connecting', 'Remote Tunnel Access is Connecting'),
category: REMOTE_TUNNEL_CATEGORY,
menu: [{
id: MenuId.AccountsContext,
Expand Down

0 comments on commit 25cfb20

Please sign in to comment.