Skip to content

Commit 7b9597b

Browse files
committed
feat: add backend support for workspace_apps
- Add database migration for workspace_apps column - Update SQL queries to include workspace_apps - Update provisioner server to pass workspace_apps from terraform - Still needs: database code regeneration and API updates
1 parent c74817b commit 7b9597b

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Remove workspace_apps column from workspace_agents table
2+
ALTER TABLE workspace_agents DROP COLUMN workspace_apps;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Add workspace_apps column to workspace_agents table
2+
ALTER TABLE workspace_agents ADD COLUMN workspace_apps text[] DEFAULT NULL;
3+
4+
COMMENT ON COLUMN workspace_agents.workspace_apps IS 'List of app IDs to display in the workspace table, configured via terraform';

coderd/database/queries/workspaceagents.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ INSERT INTO
5858
troubleshooting_url,
5959
motd_file,
6060
display_apps,
61+
workspace_apps,
6162
display_order,
6263
api_key_scope
6364
)
6465
VALUES
65-
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20) RETURNING *;
66+
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21) RETURNING *;
6667

6768
-- name: UpdateWorkspaceAgentConnectionByID :exec
6869
UPDATE

coderd/provisionerdserver/provisionerdserver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,6 +2428,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
24282428
TroubleshootingURL: prAgent.GetTroubleshootingUrl(),
24292429
MOTDFile: prAgent.GetMotdFile(),
24302430
DisplayApps: convertDisplayApps(prAgent.GetDisplayApps()),
2431+
WorkspaceApps: prAgent.GetWorkspaceApps(),
24312432
InstanceMetadata: pqtype.NullRawMessage{},
24322433
ResourceMetadata: pqtype.NullRawMessage{},
24332434
// #nosec G115 - Order represents a display order value that's always small and fits in int32

site/src/pages/WorkspacesPage/WorkspacesTable.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,10 +718,12 @@ const WorkspaceApps: FC<WorkspaceAppsProps> = ({ workspace }) => {
718718
return null;
719719
}
720720

721-
// If workspace_apps is configured, use that list instead of display_apps
721+
// Check if workspace_apps is configured via terraform
722+
// Note: This field is only available if the template uses the workspace_apps configuration
722723
const configuredApps = (agent as any).workspace_apps as string[] | undefined;
723724
const buttons: ReactNode[] = [];
724725

726+
// Use configured apps if available, otherwise fall back to default behavior
725727
if (configuredApps && configuredApps.length > 0) {
726728
// Use the configured apps list
727729
for (const appId of configuredApps.slice(0, WORKSPACE_APPS_SLOTS)) {

0 commit comments

Comments
 (0)