Skip to content

Commit

Permalink
Add view with Gitpod Flex instructions (#118)
Browse files Browse the repository at this point in the history
* Add view with Gitpod Flex instructions

* Feedback

* 🆙 bump version
  • Loading branch information
jeanp413 authored Dec 5, 2024
1 parent 2bd32f8 commit c7ad882
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Gitpod",
"description": "Required to connect to Classic workspaces",
"publisher": "gitpod",
"version": "0.0.180",
"version": "0.0.181",
"license": "MIT",
"icon": "resources/gitpod.png",
"repository": {
Expand Down Expand Up @@ -379,6 +379,12 @@
"name": "Workspace",
"icon": "$(squirrel)",
"when": "false"
},
{
"id": "gitpod-flex-help",
"name": "Looking for Gitpod Flex?",
"icon": "$(squirrel)",
"when": "gitpod.host === 'https://gitpod.io'"
}
]
},
Expand All @@ -387,6 +393,10 @@
"view": "gitpod-login",
"when": "gitpod.authenticated != true && !gitpod.inGitpodFlexRemoteWindow",
"contents": "You have not yet signed in with Gitpod\n[Sign in](command:gitpod.signIn)"
},
{
"view": "gitpod-flex-help",
"contents": "Connecting to Gitpod Flex environments requires installing the [Gitpod Flex extension](https://marketplace.visualstudio.com/items?itemName=gitpod.gitpod-flex) and opening them through the [Gitpod Flex](https://app.gitpod.io/).\nThis view is only to manage [Gitpod Classic](https://gitpod.io/workspaces) workspaces."
}
]
},
Expand Down
11 changes: 11 additions & 0 deletions src/services/hostService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class HostService extends Disposable implements IHostService {
super();

this._gitpodHost = Configuration.getGitpodHost();
this.updateGitpodHostContextKey();

this._register(vscode.workspace.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('gitpod.host')) {
Expand All @@ -50,12 +51,22 @@ export class HostService extends Disposable implements IHostService {
const newGitpodHost = Configuration.getGitpodHost();
if (new URL(this._gitpodHost).host !== new URL(newGitpodHost).host) {
this._gitpodHost = newGitpodHost;
this.updateGitpodHostContextKey();
this._onDidChangeHost.fire();
}
}
}));
}

private updateGitpodHostContextKey() {
try {
const origin = new URL(this.gitpodHost).origin;
vscode.commands.executeCommand('setContext', 'gitpod.host', origin);
} catch (e) {
vscode.commands.executeCommand('setContext', 'gitpod.host', undefined);
}
}

async changeHost(newHost: string, skipRemoteWindowCheck: boolean = false) {
if (new URL(this._gitpodHost).host !== new URL(newHost).host) {
const flow: UserFlowTelemetryProperties = { flow: 'changeHost', gitpodHost: newHost };
Expand Down

0 comments on commit c7ad882

Please sign in to comment.