Skip to content

Commit f3ed7e4

Browse files
akosyakovroboquat
authored andcommitted
[ide] desktop client installation steps
1 parent b571eef commit f3ed7e4

35 files changed

+524
-279
lines changed

chart/templates/server-ide-configmap.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,24 @@ defaultIde: "code"
106106
defaultDesktopIde: "code-desktop"
107107

108108
clients:
109+
vscode:
110+
defaultDesktopIDE: "code-desktop"
111+
desktopIDEs: ["code-desktop"]
112+
installationSteps: [
113+
"If you don't see an open dialog by the browser, make sure you have <a target='_blank' class='gp-link' href='https://code.visualstudio.com/download'>VS Code</a> installed on your machine, and then click <b>${OPEN_LINK_LABEL}</b> below.",
114+
]
115+
vscode-insiders:
116+
defaultDesktopIDE: "code-desktop-insiders"
117+
desktopIDEs: ["code-desktop-insiders"]
118+
installationSteps: [
119+
"If you don't see an open dialog by the browser, make sure you have <a target='_blank' class='gp-link' href='https://code.visualstudio.com/insiders'>VS Code Insiders</a> installed on your machine, and then click <b>${OPEN_LINK_LABEL}</b> below.",
120+
]
109121
jetbrains-gateway:
110122
defaultDesktopIDE: "intellij"
111123
desktopIDEs: ["intellij", "goland", "pycharm", "phpstorm"]
124+
installationSteps: [
125+
"If you don't see an open dialog by the browser, make sure you have <a target='_blank' class='gp-link' href='https://www.jetbrains.com/remote-development/gateway'>JetBrains Gateway</a> with <a target='_blank' class='gp-link' href='https://plugins.jetbrains.com/plugin/download?rel=true&updateId=154074'>Gitpod Plugin</a> installed on your machine, and then click <b>${OPEN_LINK_LABEL}</b> below.",
126+
]
112127
{{ end }}
113128

114129
{{- if $comp.serverIdeConfigDeploy.enabled }}

components/dashboard/src/start/StartPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function getPhaseTitle(phase?: StartPhase, error?: StartWorkspaceError) {
3434
case StartPhase.Running:
3535
return "Starting";
3636
case StartPhase.IdeReady:
37-
return "Your Workspace is Ready!";
37+
return "Running";
3838
case StartPhase.Stopping:
3939
return "Stopping";
4040
case StartPhase.Stopped:

components/dashboard/src/start/StartWorkspace.tsx

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import { ContextURL, DisposableCollection, WithPrebuild, Workspace, WorkspaceImageBuild, WorkspaceInstance } from "@gitpod/gitpod-protocol";
8+
import { IDEOptions } from "@gitpod/gitpod-protocol/lib/ide-protocol";
89
import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
910
import EventEmitter from "events";
1011
import React, { Suspense, useEffect } from "react";
@@ -32,7 +33,9 @@ export interface StartWorkspaceState {
3233
desktopIde?: {
3334
link: string
3435
label: string
36+
clientID?: string
3537
}
38+
ideOptions?: IDEOptions
3639
}
3740

3841
export default class StartWorkspace extends React.Component<StartWorkspaceProps, StartWorkspaceState> {
@@ -54,7 +57,8 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
5457
}
5558
if (event.data.state.desktopIdeLink) {
5659
const label = event.data.state.desktopIdeLabel || "Open Desktop IDE";
57-
this.setState({ desktopIde: { link: event.data.state.desktopIdeLink, label } });
60+
const clientID = event.data.state.desktopIdeClientID;
61+
this.setState({ desktopIde: { link: event.data.state.desktopIdeLink, label, clientID } });
5862
}
5963
}
6064
}
@@ -72,6 +76,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
7276
}
7377

7478
this.startWorkspace();
79+
getGitpodService().server.getIDEOptions().then(ideOptions => this.setState({ ideOptions }))
7580
}
7681

7782
componentWillUnmount() {
@@ -238,6 +243,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
238243
let phase = StartPhase.Preparing;
239244
let title = undefined;
240245
let statusMessage = !!error ? undefined : <p className="text-base text-gray-400">Preparing workspace …</p>;
246+
const contextURL = this.state.workspace?.context.normalizedContextURL || ContextURL.parseToURL(this.state.workspace?.contextURL)?.toString();
241247

242248
switch (this.state?.workspaceInstance?.status.phase) {
243249
// unknown indicates an issue within the system in that it cannot determine the actual phase of
@@ -281,17 +287,26 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
281287
}
282288
if (!this.state.desktopIde) {
283289
phase = StartPhase.Running;
284-
statusMessage = <p className="text-base text-gray-400">Opening IDE</p>;
290+
statusMessage = <p className="text-base text-gray-400">Opening Workspace</p>;
285291
} else {
286292
phase = StartPhase.IdeReady;
293+
const openLink = this.state.desktopIde.link;
294+
const openLinkLabel = this.state.desktopIde.label;
295+
const clientID = this.state.desktopIde.clientID
296+
const client = clientID ? this.state.ideOptions?.clients?.[clientID] : undefined;
297+
const installationSteps = client?.installationSteps?.length && <div className="flex flex-col text-center m-auto text-sm w-72 text-gray-400">
298+
{client.installationSteps.map(step => <div dangerouslySetInnerHTML={{__html: step.replaceAll('${OPEN_LINK_LABEL}', openLinkLabel)}} />)}
299+
</div>
287300
statusMessage = <div>
301+
<p className="text-base text-gray-400">Opening Workspace …</p>
288302
<div className="flex space-x-3 items-center text-left rounded-xl m-auto px-4 h-16 w-72 mt-4 mb-2 bg-gray-100 dark:bg-gray-800">
289303
<div className="rounded-full w-3 h-3 text-sm bg-green-500">&nbsp;</div>
290304
<div>
291-
<p className="text-gray-700 dark:text-gray-200 font-semibold">{this.state.workspaceInstance.workspaceId}</p>
292-
<a target="_parent" href={this.state.workspace?.contextURL}><p className="w-56 truncate hover:text-blue-600 dark:hover:text-blue-400" >{this.state.workspace?.contextURL}</p></a>
305+
<p className="text-gray-700 dark:text-gray-200 font-semibold w-56 truncate">{this.state.workspaceInstance.workspaceId}</p>
306+
<a target="_parent" href={contextURL}><p className="w-56 truncate hover:text-blue-600 dark:hover:text-blue-400" >{contextURL}</p></a>
293307
</div>
294308
</div>
309+
{installationSteps}
295310
<div className="mt-10 justify-center flex space-x-2">
296311
<ContextMenu menuEntries={[
297312
{
@@ -310,7 +325,18 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
310325
]} >
311326
<button className="secondary">More Actions...<Arrow up={false} /></button>
312327
</ContextMenu>
313-
<a target="_blank" href={this.state.desktopIde.link}><button>{this.state.desktopIde.label}</button></a>
328+
<button onClick={() => {
329+
let redirect = false;
330+
try {
331+
const desktopLink = new URL(openLink);
332+
redirect = desktopLink.protocol != 'http:' && desktopLink.protocol != 'https:';
333+
} catch {}
334+
if (redirect) {
335+
window.location.href = openLink;
336+
} else {
337+
window.open(openLink, '_blank', 'noopener');
338+
}
339+
}}>{openLinkLabel}</button>
314340
</div>
315341
<div className="text-sm text-gray-400 dark:text-gray-500 mt-5">These IDE options are based on <a className="gp-link" href={gitpodHostUrl.asPreferences().toString()} target="_parent">your user preferences</a>.</div>
316342
</div>;
@@ -336,7 +362,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
336362
<div className="rounded-full w-3 h-3 text-sm bg-gitpod-kumquat">&nbsp;</div>
337363
<div>
338364
<p className="text-gray-700 dark:text-gray-200 font-semibold">{this.state.workspaceInstance.workspaceId}</p>
339-
<a target="_parent" href={ContextURL.parseToURL(this.state.workspace?.contextURL)?.toString()}><p className="w-56 truncate hover:text-blue-600 dark:hover:text-blue-400" >{this.state.workspace?.contextURL}</p></a>
365+
<a target="_parent" href={contextURL}><p className="w-56 truncate hover:text-blue-600 dark:hover:text-blue-400" >{contextURL}</p></a>
340366
</div>
341367
</div>
342368
<div className="mt-10 flex justify-center">
@@ -363,7 +389,7 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
363389
<div className="rounded-full w-3 h-3 text-sm bg-gray-300">&nbsp;</div>
364390
<div>
365391
<p className="text-gray-700 dark:text-gray-200 font-semibold">{this.state.workspaceInstance.workspaceId}</p>
366-
<a target="_parent" href={ContextURL.parseToURL(this.state.workspace?.contextURL)?.toString()}><p className="w-56 truncate hover:text-blue-600 dark:hover:text-blue-400" >{this.state.workspace?.contextURL}</p></a>
392+
<a target="_parent" href={contextURL}><p className="w-56 truncate hover:text-blue-600 dark:hover:text-blue-400" >{contextURL}</p></a>
367393
</div>
368394
</div>
369395
<PendingChangesDropdown workspaceInstance={this.state.workspaceInstance} />

components/gitpod-protocol/src/ide-protocol.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ export interface IDEClient {
4646
* Desktop IDEs supported by the client.
4747
*/
4848
desktopIDEs?: string[]
49+
50+
/**
51+
* Steps to install the client on user machine.
52+
*/
53+
installationSteps?: string[]
4954
}
5055

5156
export interface IDEOption {

components/ide/code-desktop/status/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func main() {
7272
response := make(map[string]string)
7373
response["link"] = link.String()
7474
response["label"] = label
75+
response["clientID"] = schema
7576
w.Header().Set("Content-Type", "application/json")
7677
json.NewEncoder(w).Encode(response)
7778
})

components/supervisor-api/go/info.pb.gw.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/supervisor-api/go/info_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/supervisor-api/go/notification.pb.gw.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/supervisor-api/go/notification_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/supervisor-api/go/port.pb.gw.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)