Skip to content

Commit 9fc3329

Browse files
authored
feat: persist app groups in the database (#17977)
1 parent 513a468 commit 9fc3329

File tree

27 files changed

+398
-322
lines changed

27 files changed

+398
-322
lines changed

coderd/apidoc/docs.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/db2sdk/db2sdk.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ func Apps(dbApps []database.WorkspaceApp, statuses []database.WorkspaceAppStatus
525525
Threshold: dbApp.HealthcheckThreshold,
526526
},
527527
Health: codersdk.WorkspaceAppHealth(dbApp.Health),
528+
Group: dbApp.DisplayGroup.String,
528529
Hidden: dbApp.Hidden,
529530
OpenIn: codersdk.WorkspaceAppOpenIn(dbApp.OpenIn),
530531
Statuses: WorkspaceAppStatuses(statuses),

coderd/database/dbgen/dbgen.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ func WorkspaceApp(t testing.TB, db database.Store, orig database.WorkspaceApp) d
748748
HealthcheckThreshold: takeFirst(orig.HealthcheckThreshold, 60),
749749
Health: takeFirst(orig.Health, database.WorkspaceAppHealthHealthy),
750750
DisplayOrder: takeFirst(orig.DisplayOrder, 1),
751+
DisplayGroup: orig.DisplayGroup,
751752
Hidden: orig.Hidden,
752753
OpenIn: takeFirst(orig.OpenIn, database.WorkspaceAppOpenInSlimWindow),
753754
})

coderd/database/dump.sql

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alter table workspace_apps drop column display_group;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alter table workspace_apps add column display_group text;

coderd/database/models.go

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 14 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaceapps.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ INSERT INTO
3030
health,
3131
display_order,
3232
hidden,
33-
open_in
33+
open_in,
34+
display_group
3435
)
3536
VALUES
36-
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18) RETURNING *;
37+
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19) RETURNING *;
3738

3839
-- name: UpdateWorkspaceAppHealthByID :exec
3940
UPDATE

coderd/provisionerdserver/provisionerdserver.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,6 +2419,11 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
24192419
sharingLevel = database.AppSharingLevelPublic
24202420
}
24212421

2422+
displayGroup := sql.NullString{
2423+
Valid: app.Group != "",
2424+
String: app.Group,
2425+
}
2426+
24222427
openIn := database.WorkspaceAppOpenInSlimWindow
24232428
switch app.OpenIn {
24242429
case sdkproto.AppOpenIn_TAB:
@@ -2451,6 +2456,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
24512456
Health: health,
24522457
// #nosec G115 - Order represents a display order value that's always small and fits in int32
24532458
DisplayOrder: int32(app.Order),
2459+
DisplayGroup: displayGroup,
24542460
Hidden: app.Hidden,
24552461
OpenIn: openIn,
24562462
})

codersdk/workspaceapps.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ type WorkspaceApp struct {
8383
// Healthcheck specifies the configuration for checking app health.
8484
Healthcheck Healthcheck `json:"healthcheck,omitempty"`
8585
Health WorkspaceAppHealth `json:"health"`
86+
Group string `json:"group,omitempty"`
8687
Hidden bool `json:"hidden"`
8788
OpenIn WorkspaceAppOpenIn `json:"open_in"`
8889

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy