Skip to content

Commit 25f1ddb

Browse files
feat: add 'hidden' option to 'coder_app' to hide app from UI (#14570)
Add 'hidden' property to 'coder_app' resource to allow hiding apps from the UI.
1 parent 918bea1 commit 25f1ddb

36 files changed

+846
-694
lines changed

agent/proto/agent.pb.go

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

agent/proto/agent.proto

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ message WorkspaceApp {
4141
UNHEALTHY = 4;
4242
}
4343
Health health = 12;
44+
bool hidden = 13;
4445
}
4546

4647
message WorkspaceAgentScript {

coderd/agentapi/manifest.go

+1
Original file line numberDiff line numberDiff line change
@@ -229,5 +229,6 @@ func dbAppToProto(dbApp database.WorkspaceApp, agent database.WorkspaceAgent, ow
229229
Threshold: dbApp.HealthcheckThreshold,
230230
},
231231
Health: agentproto.WorkspaceApp_Health(healthRaw),
232+
Hidden: dbApp.Hidden,
232233
}, nil
233234
}

coderd/agentapi/manifest_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func TestGetManifest(t *testing.T) {
8787
Subdomain: false,
8888
SharingLevel: database.AppSharingLevelPublic,
8989
Health: database.WorkspaceAppHealthDisabled,
90+
Hidden: false,
9091
},
9192
{
9293
ID: uuid.New(),
@@ -102,6 +103,7 @@ func TestGetManifest(t *testing.T) {
102103
HealthcheckUrl: "http://localhost:4321/health",
103104
HealthcheckInterval: 20,
104105
HealthcheckThreshold: 5,
106+
Hidden: true,
105107
},
106108
}
107109
scripts = []database.WorkspaceAgentScript{
@@ -182,6 +184,7 @@ func TestGetManifest(t *testing.T) {
182184
Threshold: apps[0].HealthcheckThreshold,
183185
},
184186
Health: agentproto.WorkspaceApp_HEALTHY,
187+
Hidden: false,
185188
},
186189
{
187190
Id: apps[1].ID[:],
@@ -200,6 +203,7 @@ func TestGetManifest(t *testing.T) {
200203
Threshold: 0,
201204
},
202205
Health: agentproto.WorkspaceApp_DISABLED,
206+
Hidden: false,
203207
},
204208
{
205209
Id: apps[2].ID[:],
@@ -218,6 +222,7 @@ func TestGetManifest(t *testing.T) {
218222
Threshold: apps[2].HealthcheckThreshold,
219223
},
220224
Health: agentproto.WorkspaceApp_UNHEALTHY,
225+
Hidden: true,
221226
},
222227
}
223228
protoScripts = []*agentproto.WorkspaceAgentScript{

coderd/apidoc/docs.go

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

coderd/apidoc/swagger.json

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

coderd/database/db2sdk/db2sdk.go

+1
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ func Apps(dbApps []database.WorkspaceApp, agent database.WorkspaceAgent, ownerNa
517517
Threshold: dbApp.HealthcheckThreshold,
518518
},
519519
Health: codersdk.WorkspaceAppHealth(dbApp.Health),
520+
Hidden: dbApp.Hidden,
520521
})
521522
}
522523
return apps

coderd/database/dbgen/dbgen.go

+1
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ func WorkspaceApp(t testing.TB, db database.Store, orig database.WorkspaceApp) d
547547
HealthcheckThreshold: takeFirst(orig.HealthcheckThreshold, 60),
548548
Health: takeFirst(orig.Health, database.WorkspaceAppHealthHealthy),
549549
DisplayOrder: takeFirst(orig.DisplayOrder, 1),
550+
Hidden: orig.Hidden,
550551
})
551552
require.NoError(t, err, "insert app")
552553
return resource

coderd/database/dbmem/dbmem.go

+1
Original file line numberDiff line numberDiff line change
@@ -7291,6 +7291,7 @@ func (q *FakeQuerier) InsertWorkspaceApp(_ context.Context, arg database.InsertW
72917291
HealthcheckInterval: arg.HealthcheckInterval,
72927292
HealthcheckThreshold: arg.HealthcheckThreshold,
72937293
Health: arg.Health,
7294+
Hidden: arg.Hidden,
72947295
DisplayOrder: arg.DisplayOrder,
72957296
}
72967297
q.workspaceApps = append(q.workspaceApps, workspaceApp)

coderd/database/dump.sql

+4-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 hidden;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER TABLE workspace_apps ADD COLUMN hidden boolean NOT NULL DEFAULT false;
2+
3+
COMMENT ON COLUMN workspace_apps.hidden
4+
IS 'Determines if the app is not shown in user interfaces.'

coderd/database/models.go

+2
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
@@ -28,10 +28,11 @@ INSERT INTO
2828
healthcheck_interval,
2929
healthcheck_threshold,
3030
health,
31-
display_order
31+
display_order,
32+
hidden
3233
)
3334
VALUES
34-
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16) RETURNING *;
35+
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17) RETURNING *;
3536

3637
-- name: UpdateWorkspaceAppHealthByID :exec
3738
UPDATE

coderd/provisionerdserver/provisionerdserver.go

+1
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
19181918
HealthcheckThreshold: app.Healthcheck.Threshold,
19191919
Health: health,
19201920
DisplayOrder: int32(app.Order),
1921+
Hidden: app.Hidden,
19211922
})
19221923
if err != nil {
19231924
return xerrors.Errorf("insert app: %w", err)

codersdk/agentsdk/convert.go

+2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ func AppFromProto(protoApp *proto.WorkspaceApp) (codersdk.WorkspaceApp, error) {
245245
Threshold: protoApp.Healthcheck.Threshold,
246246
},
247247
Health: health,
248+
Hidden: protoApp.Hidden,
248249
}, nil
249250
}
250251

@@ -274,6 +275,7 @@ func ProtoFromApp(a codersdk.WorkspaceApp) (*proto.WorkspaceApp, error) {
274275
Threshold: a.Healthcheck.Threshold,
275276
},
276277
Health: proto.WorkspaceApp_Health(health),
278+
Hidden: a.Hidden,
277279
}, nil
278280
}
279281

codersdk/agentsdk/convert_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func TestManifest(t *testing.T) {
4444
Threshold: 55555666,
4545
},
4646
Health: codersdk.WorkspaceAppHealthHealthy,
47+
Hidden: false,
4748
},
4849
{
4950
ID: uuid.New(),
@@ -62,6 +63,7 @@ func TestManifest(t *testing.T) {
6263
Threshold: 22555666,
6364
},
6465
Health: codersdk.WorkspaceAppHealthInitializing,
66+
Hidden: true,
6567
},
6668
},
6769
DERPMap: &tailcfg.DERPMap{

codersdk/workspaceapps.go

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type WorkspaceApp struct {
6161
// Healthcheck specifies the configuration for checking app health.
6262
Healthcheck Healthcheck `json:"healthcheck"`
6363
Health WorkspaceAppHealth `json:"health"`
64+
Hidden bool `json:"hidden"`
6465
}
6566

6667
type Healthcheck struct {

docs/reference/api/agents.md

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

docs/reference/api/builds.md

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

0 commit comments

Comments
 (0)