Skip to content

Commit 214e594

Browse files
feat: Show custom resource icons in the UI (#4020)
1 parent 83c35bb commit 214e594

File tree

60 files changed

+282
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+282
-220
lines changed

coderd/database/databasefake/databasefake.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,6 +1801,7 @@ func (q *fakeQuerier) InsertWorkspaceResource(_ context.Context, arg database.In
18011801
Type: arg.Type,
18021802
Name: arg.Name,
18031803
Hide: arg.Hide,
1804+
Icon: arg.Icon,
18041805
}
18051806
q.provisionerJobResources = append(q.provisionerJobResources, resource)
18061807
return resource, nil

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE workspace_resources
2+
DROP COLUMN icon;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE workspace_resources
2+
ADD COLUMN icon VARCHAR(256) NOT NULL DEFAULT ''

coderd/database/models.go

Lines changed: 1 addition & 0 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: 11 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaceresources.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ SELECT * FROM workspace_resources WHERE created_at > $1;
1919

2020
-- name: InsertWorkspaceResource :one
2121
INSERT INTO
22-
workspace_resources (id, created_at, job_id, transition, type, name, hide)
22+
workspace_resources (id, created_at, job_id, transition, type, name, hide, icon)
2323
VALUES
24-
($1, $2, $3, $4, $5, $6, $7) RETURNING *;
24+
($1, $2, $3, $4, $5, $6, $7, $8) RETURNING *;
2525

2626
-- name: GetWorkspaceResourceMetadataByResourceID :many
2727
SELECT

coderd/provisionerdaemons.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ func insertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
753753
Type: protoResource.Type,
754754
Name: protoResource.Name,
755755
Hide: protoResource.Hide,
756+
Icon: protoResource.Icon,
756757
})
757758
if err != nil {
758759
return xerrors.Errorf("insert provisioner job resource %q: %w", protoResource.Name, err)

coderd/workspacebuilds.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ func convertWorkspaceResource(resource database.WorkspaceResource, agents []code
707707
Type: resource.Type,
708708
Name: resource.Name,
709709
Hide: resource.Hide,
710+
Icon: resource.Icon,
710711
Agents: agents,
711712
Metadata: convertedMetadata,
712713
}

coderd/workspaceresources_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func TestWorkspaceResource(t *testing.T) {
2727
Resources: []*proto.Resource{{
2828
Name: "beta",
2929
Type: "example",
30+
Icon: "/icon/server.svg",
3031
Agents: []*proto.Agent{{
3132
Id: "something",
3233
Name: "b",
@@ -60,9 +61,11 @@ func TestWorkspaceResource(t *testing.T) {
6061
resource, err := client.WorkspaceResource(ctx, resources[1].ID)
6162
require.NoError(t, err)
6263
require.Len(t, resource.Agents, 2)
63-
// Ensure it's sorted alphabetically!
64+
// Ensure agents are sorted alphabetically!
6465
require.Equal(t, "a", resource.Agents[0].Name)
6566
require.Equal(t, "b", resource.Agents[1].Name)
67+
// Ensure Icon is present
68+
require.Equal(t, "/icon/server.svg", resources[1].Icon)
6669
})
6770

6871
t.Run("Apps", func(t *testing.T) {

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