Skip to content

Commit

Permalink
Fix missing stopCurrentWorkspace command
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanp413 committed Sep 4, 2023
1 parent e314e17 commit 480acb8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,17 @@
"icon": "$(primitive-square)"
},
{
"command": "gitpod.workspaces.stopCurrentWorkspace",
"command": "gitpod.workspaces.stopCurrentWorkspace_inline",
"category": "Gitpod",
"title": "Disconnect and Stop",
"icon": "$(primitive-square)"
},
{
"command": "gitpod.workspaces.stopCurrentWorkspace",
"category": "Gitpod",
"title": "Stop Current Workspace",
"icon": "$(primitive-square)"
},
{
"command": "gitpod.workspaces.openInBrowser",
"category": "Gitpod",
Expand Down Expand Up @@ -224,7 +230,7 @@
"group": "inline@3"
},
{
"command": "gitpod.workspaces.stopCurrentWorkspace",
"command": "gitpod.workspaces.stopCurrentWorkspace_inline",
"when": "viewItem =~ /^gitpod-workspaces.workspace.+connected$/",
"group": "inline@4"
},
Expand Down Expand Up @@ -314,9 +320,13 @@
"when": "false"
},
{
"command": "gitpod.workspaces.stopCurrentWorkspace",
"command": "gitpod.workspaces.stopCurrentWorkspace_inline",
"when": "false"
},
{
"command": "gitpod.workspaces.stopCurrentWorkspace",
"when": "gitpod.authenticated == true && gitpod.inWorkspace == true"
},
{
"command": "gitpod.workspaces.openInBrowser",
"when": "gitpod.authenticated == true && gitpod.inWorkspace == true"
Expand Down
17 changes: 15 additions & 2 deletions src/commands/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ export class StopWorkspaceCommandInline extends StopWorkspaceCommand {
}

export class StopCurrentWorkspaceCommand implements Command {
readonly id = 'gitpod.workspaces.stopCurrentWorkspace';
readonly id: string = 'gitpod.workspaces.stopCurrentWorkspace';

constructor(
private readonly workspaceId: string | undefined,
Expand All @@ -516,6 +516,19 @@ export class StopCurrentWorkspaceCommand implements Command {
}
}

export class StopCurrentWorkspaceCommandInline extends StopCurrentWorkspaceCommand {
override readonly id = 'gitpod.workspaces.stopCurrentWorkspace_inline';

constructor(
workspaceId: string | undefined,
sessionService: ISessionService,
hostService: IHostService,
telemetryService: ITelemetryService,
) {
super(workspaceId, sessionService, hostService, telemetryService);
}
}

export class OpenInBrowserCommand implements Command {
readonly id = 'gitpod.workspaces.openInBrowser';

Expand Down Expand Up @@ -613,7 +626,7 @@ export class OpenWorkspaceContextCommand implements Command {
return;
}

const rawWsData = await this.sessionService.getAPI().getWorkspace(treeItem.id)
const rawWsData = await this.sessionService.getAPI().getWorkspace(treeItem.id);
const wsData = rawWorkspaceToWorkspaceData(await this.sessionService.getAPI().getWorkspace(treeItem.id));

// Report if we couldn't parse contextUrl
Expand Down
3 changes: 2 additions & 1 deletion src/workspacesExplorerView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { getGitpodRemoteWindowConnectionInfo } from './remote';
import { Barrier } from './common/async';
import { ITelemetryService } from './common/telemetry';
import { ILogService } from './services/logService';
import { ConnectInCurrentWindowCommand, ConnectInNewWindowCommand, DeleteWorkspaceCommand, OpenWorkspaceContextCommand, OpenInBrowserCommand, StopCurrentWorkspaceCommand, StopWorkspaceCommand, DisconnectWorkspaceCommand, ConnectInCurrentWindowCommandInline, StopWorkspaceCommandInline, DeleteWorkspaceCommandContext, StopWorkspaceCommandContext, ConnectInCurrentWindowCommandContext, ConnectInNewWindowCommandContext, ConnectInCurrentWindowCommandContext_1, ConnectInCurrentWindowCommandInline_1 } from './commands/workspaces';
import { ConnectInCurrentWindowCommand, ConnectInNewWindowCommand, DeleteWorkspaceCommand, OpenWorkspaceContextCommand, OpenInBrowserCommand, StopCurrentWorkspaceCommand, StopWorkspaceCommand, DisconnectWorkspaceCommand, ConnectInCurrentWindowCommandInline, StopWorkspaceCommandInline, DeleteWorkspaceCommandContext, StopWorkspaceCommandContext, ConnectInCurrentWindowCommandContext, ConnectInNewWindowCommandContext, ConnectInCurrentWindowCommandContext_1, ConnectInCurrentWindowCommandInline_1, StopCurrentWorkspaceCommandInline } from './commands/workspaces';
import { IRemoteService } from './services/remoteService';
import { IExperimentsService } from './experiments';

Expand Down Expand Up @@ -114,6 +114,7 @@ export class WorkspacesExplorerView extends Disposable implements vscode.TreeDat
commandManager.register(new StopWorkspaceCommandContext(sessionService, hostService, telemetryService));
commandManager.register(new StopWorkspaceCommandInline(sessionService, hostService, telemetryService));
commandManager.register(new StopCurrentWorkspaceCommand(this.connectedWorkspaceId, sessionService, hostService, telemetryService));
commandManager.register(new StopCurrentWorkspaceCommandInline(this.connectedWorkspaceId, sessionService, hostService, telemetryService));
commandManager.register(new OpenInBrowserCommand(sessionService, hostService, telemetryService));
commandManager.register(new DeleteWorkspaceCommand(sessionService, hostService, telemetryService));
commandManager.register(new DeleteWorkspaceCommandContext(sessionService, hostService, telemetryService));
Expand Down

0 comments on commit 480acb8

Please sign in to comment.