Skip to content

Commit

Permalink
[papi] add editor info to experimental.v1 (#20405)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
mustard-mh and iQQBot authored Nov 29, 2024
1 parent 55540b3 commit 83bfa20
Show file tree
Hide file tree
Showing 6 changed files with 1,679 additions and 451 deletions.
12 changes: 10 additions & 2 deletions components/gitpod-protocol/go/gitpod-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1765,8 +1765,16 @@ type WorkspaceInstanceConditions struct {

// WorkspaceInstanceConfiguration is the WorkspaceInstanceConfiguration message type
type WorkspaceInstanceConfiguration struct {
FeatureFlags []string `json:"featureFlags,omitempty"`
TheiaVersion string `json:"theiaVersion,omitempty"`
FeatureFlags []string `json:"featureFlags,omitempty"`
TheiaVersion string `json:"theiaVersion,omitempty"`
IDEConfig *WorkspaceInstanceIDEConfig `json:"ideConfig,omitempty"`
}

// WorkspaceInstanceIDEConfig is the ide config information of a workspace instance
type WorkspaceInstanceIDEConfig struct {
UseLatest bool `json:"useLatest,omitempty"`
IDE string `json:"ide,omitempty"`
PreferToolbox bool `json:"preferToolbox,omitempty"`
}

// WorkspaceInstanceRepoStatus is the WorkspaceInstanceRepoStatus message type
Expand Down
16 changes: 16 additions & 0 deletions components/public-api-server/pkg/apiv1/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,21 @@ func convertWorkspaceInfo(input *protocol.WorkspaceInfo) (*v1.Workspace, error)
}, nil
}

func convertIdeConfig(ideConfig *protocol.WorkspaceInstanceIDEConfig) *v1.WorkspaceInstanceStatus_EditorReference {
if ideConfig == nil {
return nil
}
ideVersion := "stable"
if ideConfig.UseLatest {
ideVersion = "latest"
}
return &v1.WorkspaceInstanceStatus_EditorReference{
Name: ideConfig.IDE,
Version: ideVersion,
PreferToolbox: ideConfig.PreferToolbox,
}
}

func convertWorkspaceInstance(wsi *protocol.WorkspaceInstance, wsCtx *protocol.WorkspaceContext, config *protocol.WorkspaceConfig, shareable bool) (*v1.WorkspaceInstance, error) {
if wsi == nil {
return nil, nil
Expand Down Expand Up @@ -539,6 +554,7 @@ func convertWorkspaceInstance(wsi *protocol.WorkspaceInstance, wsCtx *protocol.W
Ports: ports,
RecentFolders: recentFolders,
GitStatus: gitStatus,
Editor: convertIdeConfig(wsi.Configuration.IDEConfig),
},
}, nil
}
Expand Down
12 changes: 12 additions & 0 deletions components/public-api/gitpod/experimental/v1/workspaces.proto
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ message WorkspaceInstanceStatus {
optional bool stopped_by_request = 11;
}

message EditorReference {
string name = 1;
string version = 2;

// prefer_toolbox indicates whether the editor should be launched with the
// JetBrains Toolbox instead of JetBrains Gateway
bool prefer_toolbox = 3;
}

// version of the status update. Workspace instances themselves are unversioned,
// but their statuus has different versions.
// The value of this field has no semantic meaning (e.g. don't interpret it as
Expand Down Expand Up @@ -322,6 +331,9 @@ message WorkspaceInstanceStatus {
// Note: this is a best-effort field and more often than not will not be present. Its absence does not
// indicate the absence of a working copy.
GitStatus git_status = 9;

// editor is the editor to be used in this workspace
EditorReference editor = 10;
}

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

0 comments on commit 83bfa20

Please sign in to comment.