Thanks to visit codestin.com
Credit goes to github.com

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

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

agent/proto/agent.proto

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 5 additions & 0 deletions
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

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
@@ -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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)