Skip to content

Commit

Permalink
feat: Add Eclipse Che: Stop Workspace and Redirect to Dashboard command
Browse files Browse the repository at this point in the history
  • Loading branch information
SkorikSergey authored Sep 28, 2023
1 parent 19f9d88 commit 8ab4cf9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ The following example shows all of the properties that you can customize by usin
"openDashboardCommand": "Branded IDE: Open Dashboard",
"openOpenShiftConsoleCommand": "Branded IDE: Open OpenShift Console",
"stopWorkspaceCommand": "Branded IDE: Stop Workspace",
"stopWorkspaceAndRedirectToDashboard": "Branded IDE: Stop Workspace and Redirect to Dashboard",
"restartWorkspaceCommand": "Branded IDE: Restart Workspace",
"restartWorkspaceFromLocalDevfileCommand": "Branded IDE: Restart Workspace from Local Devfile"
},
Expand Down
10 changes: 10 additions & 0 deletions code/extensions/che-remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
"title": "%stopWorkspaceCommand%",
"enablement": "che-remote.workspace-enabled"
},
{
"command": "che-remote.command.stopWorkspaceAndRedirectToDashboard",
"title": "%stopWorkspaceAndRedirectToDashboard%",
"enablement": "che-remote.workspace-enabled"
},
{
"command": "che-remote.command.restartWorkspace",
"title": "%restartWorkspaceCommand%",
Expand Down Expand Up @@ -85,6 +90,11 @@
"group": "remote_40_che_navigation@10",
"when": "che-remote.workspace-enabled"
},
{
"command": "che-remote.command.stopWorkspaceAndRedirectToDashboard",
"group": "remote_40_che_navigation@11",
"when": "che-remote.workspace-enabled"
},
{
"command": "che-remote.command.restartWorkspace",
"group": "remote_40_che_navigation@15",
Expand Down
1 change: 1 addition & 0 deletions code/extensions/che-remote/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"openDashboardCommand": "Eclipse Che: Open Dashboard",
"openOpenShiftConsoleCommand": "Eclipse Che: Open OpenShift Console",
"stopWorkspaceCommand": "Eclipse Che: Stop Workspace",
"stopWorkspaceAndRedirectToDashboard": "Eclipse Che: Stop Workspace and Redirect to Dashboard",
"restartWorkspaceCommand": "Eclipse Che: Restart Workspace",
"restartWorkspaceFromLocalDevfileCommand": "Eclipse Che: Restart Workspace from Local Devfile"
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export class DevWorkspaceAssistant {
CommandsRegistry.registerCommand('che-remote.command.restartWorkspace', () => {
this.restartWorkspace();
});
CommandsRegistry.registerCommand('che-remote.command.stopWorkspaceAndRedirectToDashboard', () => {
this.stopWorkspaceAndRedirectToDashboard();
});
}

async getDevWorkspace(): Promise<DevWorkspaceLike> {
Expand Down Expand Up @@ -120,6 +123,11 @@ export class DevWorkspaceAssistant {
this.startWorkspace();
}

async stopWorkspaceAndRedirectToDashboard(): Promise<void> {
await this.commandService.executeCommand('che-remote.command.stopWorkspace');
this.goToDashboard();
}

startWorkspace(): void {
const startingDevWorkspaceUrl = this.getStartingWorkspaceUrl();
window.location.href = startingDevWorkspaceUrl;
Expand Down

0 comments on commit 8ab4cf9

Please sign in to comment.