mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add OpenIn option to coder_app (#15743)
This PR is the coder/coder part of [the open_in parameter issue](https://github.com/coder/terraform-provider-coder/issues/297) aiming to add a new optional parameter to choose how to open modules. This PR is heavily linked [to this PR](https://github.com/coder/terraform-provider-coder/pull/321). ℹ️ For now, some integrations tests can not be pushed as it requires a release on the terraform-provider repo.
This commit is contained in:
@@ -1509,6 +1509,7 @@ func (s *server) CompleteJob(ctx context.Context, completed *proto.CompletedJob)
|
||||
dur := time.Duration(protoAgent.GetConnectionTimeoutSeconds()) * time.Second
|
||||
agentTimeouts[dur] = true
|
||||
}
|
||||
|
||||
err = InsertWorkspaceResource(ctx, db, job.ID, workspaceBuild.Transition, protoResource, telemetrySnapshot)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("insert provisioner job: %w", err)
|
||||
@@ -2012,6 +2013,14 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
|
||||
sharingLevel = database.AppSharingLevelPublic
|
||||
}
|
||||
|
||||
openIn := database.WorkspaceAppOpenInSlimWindow
|
||||
switch app.OpenIn {
|
||||
case sdkproto.AppOpenIn_TAB:
|
||||
openIn = database.WorkspaceAppOpenInTab
|
||||
case sdkproto.AppOpenIn_WINDOW:
|
||||
openIn = database.WorkspaceAppOpenInWindow
|
||||
}
|
||||
|
||||
dbApp, err := db.InsertWorkspaceApp(ctx, database.InsertWorkspaceAppParams{
|
||||
ID: uuid.New(),
|
||||
CreatedAt: dbtime.Now(),
|
||||
@@ -2036,6 +2045,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
|
||||
Health: health,
|
||||
DisplayOrder: int32(app.Order),
|
||||
Hidden: app.Hidden,
|
||||
OpenIn: openIn,
|
||||
})
|
||||
if err != nil {
|
||||
return xerrors.Errorf("insert app: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user