Skip to content

Commit 83bfa20

Browse files
mustard-mhiQQBot
andauthored
[papi] add editor info to experimental.v1 (#20405)
* Update proto * proto gen * protocol update * convert ide config * proto def +1 * proto gen +1 * papi impl +1 * impl + 2 * Update components/public-api-server/pkg/apiv1/workspace.go Co-authored-by: iQQBot <[email protected]> --------- Co-authored-by: iQQBot <[email protected]>
1 parent 55540b3 commit 83bfa20

File tree

6 files changed

+1679
-451
lines changed

6 files changed

+1679
-451
lines changed

components/gitpod-protocol/go/gitpod-service.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,8 +1765,16 @@ type WorkspaceInstanceConditions struct {
17651765

17661766
// WorkspaceInstanceConfiguration is the WorkspaceInstanceConfiguration message type
17671767
type WorkspaceInstanceConfiguration struct {
1768-
FeatureFlags []string `json:"featureFlags,omitempty"`
1769-
TheiaVersion string `json:"theiaVersion,omitempty"`
1768+
FeatureFlags []string `json:"featureFlags,omitempty"`
1769+
TheiaVersion string `json:"theiaVersion,omitempty"`
1770+
IDEConfig *WorkspaceInstanceIDEConfig `json:"ideConfig,omitempty"`
1771+
}
1772+
1773+
// WorkspaceInstanceIDEConfig is the ide config information of a workspace instance
1774+
type WorkspaceInstanceIDEConfig struct {
1775+
UseLatest bool `json:"useLatest,omitempty"`
1776+
IDE string `json:"ide,omitempty"`
1777+
PreferToolbox bool `json:"preferToolbox,omitempty"`
17701778
}
17711779

17721780
// WorkspaceInstanceRepoStatus is the WorkspaceInstanceRepoStatus message type

components/public-api-server/pkg/apiv1/workspace.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,21 @@ func convertWorkspaceInfo(input *protocol.WorkspaceInfo) (*v1.Workspace, error)
434434
}, nil
435435
}
436436

437+
func convertIdeConfig(ideConfig *protocol.WorkspaceInstanceIDEConfig) *v1.WorkspaceInstanceStatus_EditorReference {
438+
if ideConfig == nil {
439+
return nil
440+
}
441+
ideVersion := "stable"
442+
if ideConfig.UseLatest {
443+
ideVersion = "latest"
444+
}
445+
return &v1.WorkspaceInstanceStatus_EditorReference{
446+
Name: ideConfig.IDE,
447+
Version: ideVersion,
448+
PreferToolbox: ideConfig.PreferToolbox,
449+
}
450+
}
451+
437452
func convertWorkspaceInstance(wsi *protocol.WorkspaceInstance, wsCtx *protocol.WorkspaceContext, config *protocol.WorkspaceConfig, shareable bool) (*v1.WorkspaceInstance, error) {
438453
if wsi == nil {
439454
return nil, nil
@@ -539,6 +554,7 @@ func convertWorkspaceInstance(wsi *protocol.WorkspaceInstance, wsCtx *protocol.W
539554
Ports: ports,
540555
RecentFolders: recentFolders,
541556
GitStatus: gitStatus,
557+
Editor: convertIdeConfig(wsi.Configuration.IDEConfig),
542558
},
543559
}, nil
544560
}

components/public-api/gitpod/experimental/v1/workspaces.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,15 @@ message WorkspaceInstanceStatus {
290290
optional bool stopped_by_request = 11;
291291
}
292292

293+
message EditorReference {
294+
string name = 1;
295+
string version = 2;
296+
297+
// prefer_toolbox indicates whether the editor should be launched with the
298+
// JetBrains Toolbox instead of JetBrains Gateway
299+
bool prefer_toolbox = 3;
300+
}
301+
293302
// version of the status update. Workspace instances themselves are unversioned,
294303
// but their statuus has different versions.
295304
// The value of this field has no semantic meaning (e.g. don't interpret it as
@@ -322,6 +331,9 @@ message WorkspaceInstanceStatus {
322331
// Note: this is a best-effort field and more often than not will not be present. Its absence does not
323332
// indicate the absence of a working copy.
324333
GitStatus git_status = 9;
334+
335+
// editor is the editor to be used in this workspace
336+
EditorReference editor = 10;
325337
}
326338

327339
// PortPolicy defines the accssbility policy of a workspace port is guarded by an authentication in the proxy

0 commit comments

Comments
 (0)