Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add view with Gitpod Flex instructions #118

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading