Skip to content

Commit bd9d40b

Browse files
committed
add open_in logic
1 parent 0e69ff4 commit bd9d40b

File tree

9 files changed

+38
-10
lines changed

9 files changed

+38
-10
lines changed

coderd/database/dump.sql

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE workspace_apps DROP COLUMN open_in;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE workspace_apps ADD COLUMN open_in character varying(64) NOT NULL DEFAULT 'slim-window';

coderd/database/models.go

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

+14-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaceapps.sql

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ INSERT INTO
2929
healthcheck_threshold,
3030
health,
3131
display_order,
32-
hidden
32+
hidden,
33+
open_in
3334
)
3435
VALUES
35-
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17) RETURNING *;
36+
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18) RETURNING *;
3637

3738
-- name: UpdateWorkspaceAppHealthByID :exec
3839
UPDATE

coderd/provisionerdserver/provisionerdserver.go

+2
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,7 @@ func (s *server) CompleteJob(ctx context.Context, completed *proto.CompletedJob)
15091509
dur := time.Duration(protoAgent.GetConnectionTimeoutSeconds()) * time.Second
15101510
agentTimeouts[dur] = true
15111511
}
1512+
15121513
err = InsertWorkspaceResource(ctx, db, job.ID, workspaceBuild.Transition, protoResource, telemetrySnapshot)
15131514
if err != nil {
15141515
return xerrors.Errorf("insert provisioner job: %w", err)
@@ -2036,6 +2037,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
20362037
Health: health,
20372038
DisplayOrder: int32(app.Order),
20382039
Hidden: app.Hidden,
2040+
OpenIn: app.OpenIn,
20392041
})
20402042
if err != nil {
20412043
return xerrors.Errorf("insert app: %w", err)

coderd/workspacebuilds.go

+2
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ func (api *API) workspaceBuildsData(ctx context.Context, workspaceBuilds []datab
750750
return workspaceBuildsData{}, err
751751
}
752752

753+
api.Logger.Warn(ctx, "fetched apps", slog.F("apps", apps))
754+
753755
return workspaceBuildsData{
754756
jobs: jobs,
755757
templateVersions: templateVersions,

provisioner/terraform/resources.go

+11
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ type agentAppAttributes struct {
8484
Healthcheck []appHealthcheckAttributes `mapstructure:"healthcheck"`
8585
Order int64 `mapstructure:"order"`
8686
Hidden bool `mapstructure:"hidden"`
87+
<<<<<<< Updated upstream
8788
OpenIn string `mapstructure:"open_in"`
89+
=======
90+
OpenIn string `mapstructure:"open_in"`
91+
>>>>>>> Stashed changes
8892
}
8993

9094
type agentEnvAttributes struct {
@@ -386,12 +390,15 @@ func ConvertState(ctx context.Context, modules []*tfjson.StateModule, rawGraph s
386390
continue
387391
}
388392

393+
389394
var attrs agentAppAttributes
390395
err = mapstructure.Decode(resource.AttributeValues, &attrs)
391396
if err != nil {
392397
return nil, xerrors.Errorf("decode app attributes: %w", err)
393398
}
394399

400+
logger.Warn(ctx, "RESOUUUUURCE : ", slog.F("resource", attrs))
401+
395402
// Default to the resource name if none is set!
396403
if attrs.Slug == "" {
397404
attrs.Slug = resource.Name
@@ -453,7 +460,11 @@ func ConvertState(ctx context.Context, modules []*tfjson.StateModule, rawGraph s
453460
Healthcheck: healthcheck,
454461
Order: attrs.Order,
455462
Hidden: attrs.Hidden,
463+
<<<<<<< Updated upstream
456464
OpenIn: attrs.OpenIn,
465+
=======
466+
OpenIn: attrs.OpenIn,
467+
>>>>>>> Stashed changes
457468
})
458469
}
459470
}

0 commit comments

Comments
 (0)