From e61d3e9a36a5113a762225d776e68787f0280388 Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Mon, 12 Sep 2022 16:42:35 +0000 Subject: [PATCH 01/13] Update examples templateversion --- examples/templates/aws-linux/main.tf | 2 +- examples/templates/aws-windows/main.tf | 2 +- examples/templates/azure-linux/main.tf | 2 +- examples/templates/do-linux/main.tf | 2 +- examples/templates/docker-code-server/main.tf | 2 +- examples/templates/docker-image-builds/main.tf | 2 +- examples/templates/docker-with-dotfiles/main.tf | 2 +- examples/templates/docker/main.tf | 2 +- examples/templates/ecs-container/main.tf | 2 +- examples/templates/gcp-linux/main.tf | 2 +- examples/templates/gcp-vm-container/main.tf | 2 +- examples/templates/gcp-windows/main.tf | 2 +- examples/templates/kubernetes/main.tf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/templates/aws-linux/main.tf b/examples/templates/aws-linux/main.tf index a13b5fac877f9..6713498cce557 100644 --- a/examples/templates/aws-linux/main.tf +++ b/examples/templates/aws-linux/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } } } diff --git a/examples/templates/aws-windows/main.tf b/examples/templates/aws-windows/main.tf index 2a72693aa278f..965cb2573bd4a 100644 --- a/examples/templates/aws-windows/main.tf +++ b/examples/templates/aws-windows/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } } } diff --git a/examples/templates/azure-linux/main.tf b/examples/templates/azure-linux/main.tf index 8f8b847ee7d32..85b86a4296675 100644 --- a/examples/templates/azure-linux/main.tf +++ b/examples/templates/azure-linux/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } azurerm = { source = "hashicorp/azurerm" diff --git a/examples/templates/do-linux/main.tf b/examples/templates/do-linux/main.tf index 6af96c9e6ba79..0468c45c21e9a 100644 --- a/examples/templates/do-linux/main.tf +++ b/examples/templates/do-linux/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } digitalocean = { source = "digitalocean/digitalocean" diff --git a/examples/templates/docker-code-server/main.tf b/examples/templates/docker-code-server/main.tf index 5b443045a3793..16fcf07a49095 100644 --- a/examples/templates/docker-code-server/main.tf +++ b/examples/templates/docker-code-server/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } docker = { source = "kreuzwerker/docker" diff --git a/examples/templates/docker-image-builds/main.tf b/examples/templates/docker-image-builds/main.tf index 3a30ed612cfab..7a4f829b1eddc 100644 --- a/examples/templates/docker-image-builds/main.tf +++ b/examples/templates/docker-image-builds/main.tf @@ -3,7 +3,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } docker = { source = "kreuzwerker/docker" diff --git a/examples/templates/docker-with-dotfiles/main.tf b/examples/templates/docker-with-dotfiles/main.tf index f09cdc4a6fcb8..d7b540061b925 100644 --- a/examples/templates/docker-with-dotfiles/main.tf +++ b/examples/templates/docker-with-dotfiles/main.tf @@ -9,7 +9,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } docker = { source = "kreuzwerker/docker" diff --git a/examples/templates/docker/main.tf b/examples/templates/docker/main.tf index 1f494737c563e..63b8323e7abec 100644 --- a/examples/templates/docker/main.tf +++ b/examples/templates/docker/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } docker = { source = "kreuzwerker/docker" diff --git a/examples/templates/ecs-container/main.tf b/examples/templates/ecs-container/main.tf index 7c5a882ce4576..63dd2a1fb0b08 100644 --- a/examples/templates/ecs-container/main.tf +++ b/examples/templates/ecs-container/main.tf @@ -6,7 +6,7 @@ terraform { } coder = { source = "coder/coder" - version = "~> 0.4.9" + version = "0.4.11" } } } diff --git a/examples/templates/gcp-linux/main.tf b/examples/templates/gcp-linux/main.tf index f663a31004646..aaf9b6ddd0230 100644 --- a/examples/templates/gcp-linux/main.tf +++ b/examples/templates/gcp-linux/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } google = { source = "hashicorp/google" diff --git a/examples/templates/gcp-vm-container/main.tf b/examples/templates/gcp-vm-container/main.tf index 6a9751421b2f0..cdfe244a730b4 100644 --- a/examples/templates/gcp-vm-container/main.tf +++ b/examples/templates/gcp-vm-container/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } google = { source = "hashicorp/google" diff --git a/examples/templates/gcp-windows/main.tf b/examples/templates/gcp-windows/main.tf index 1421edc6f17ba..eaba792b94c87 100644 --- a/examples/templates/gcp-windows/main.tf +++ b/examples/templates/gcp-windows/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } google = { source = "hashicorp/google" diff --git a/examples/templates/kubernetes/main.tf b/examples/templates/kubernetes/main.tf index 4ad85572ef556..f2380b436cb5c 100644 --- a/examples/templates/kubernetes/main.tf +++ b/examples/templates/kubernetes/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.9" + version = "0.4.11" } kubernetes = { source = "hashicorp/kubernetes" From c764b2163c495f3d7ebd00568fefeb3b2ba0ac01 Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Mon, 12 Sep 2022 17:01:06 +0000 Subject: [PATCH 02/13] Updaate backend to accept icon --- coderd/database/databasefake/databasefake.go | 1 + coderd/database/dump.sql | 3 ++- .../000048_workspace_resource_icon.down.sql | 2 ++ .../000048_workspace_resource_icon.up.sql | 2 ++ coderd/database/models.go | 1 + coderd/database/queries.sql.go | 16 +++++++++++----- coderd/database/queries/workspaceresources.sql | 4 ++-- coderd/provisionerdaemons.go | 1 + coderd/workspacebuilds.go | 1 + coderd/workspaceresources_test.go | 5 ++++- codersdk/workspaceresources.go | 1 + provisioner/terraform/resources.go | 4 ++++ provisionersdk/proto/provisioner.pb.go | 1 + site/src/api/typesGenerated.ts | 1 + 14 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 coderd/database/migrations/000048_workspace_resource_icon.down.sql create mode 100644 coderd/database/migrations/000048_workspace_resource_icon.up.sql diff --git a/coderd/database/databasefake/databasefake.go b/coderd/database/databasefake/databasefake.go index b1ab38c600173..cdfd25ed06feb 100644 --- a/coderd/database/databasefake/databasefake.go +++ b/coderd/database/databasefake/databasefake.go @@ -1768,6 +1768,7 @@ func (q *fakeQuerier) InsertWorkspaceResource(_ context.Context, arg database.In Type: arg.Type, Name: arg.Name, Hide: arg.Hide, + Icon: arg.Icon, } q.provisionerJobResources = append(q.provisionerJobResources, resource) return resource, nil diff --git a/coderd/database/dump.sql b/coderd/database/dump.sql index cc371f34b1048..2f4ca9ff21b88 100644 --- a/coderd/database/dump.sql +++ b/coderd/database/dump.sql @@ -367,7 +367,8 @@ CREATE TABLE workspace_resources ( transition workspace_transition NOT NULL, type character varying(192) NOT NULL, name character varying(64) NOT NULL, - hide boolean DEFAULT false NOT NULL + hide boolean DEFAULT false NOT NULL, + icon character varying(256) DEFAULT ''::character varying NOT NULL ); CREATE TABLE workspaces ( diff --git a/coderd/database/migrations/000048_workspace_resource_icon.down.sql b/coderd/database/migrations/000048_workspace_resource_icon.down.sql new file mode 100644 index 0000000000000..b1bc2becb2b14 --- /dev/null +++ b/coderd/database/migrations/000048_workspace_resource_icon.down.sql @@ -0,0 +1,2 @@ +ALTER TABLE workspace_resources + DROP COLUMN icon; diff --git a/coderd/database/migrations/000048_workspace_resource_icon.up.sql b/coderd/database/migrations/000048_workspace_resource_icon.up.sql new file mode 100644 index 0000000000000..86071a3c4a1d9 --- /dev/null +++ b/coderd/database/migrations/000048_workspace_resource_icon.up.sql @@ -0,0 +1,2 @@ +ALTER TABLE workspace_resources + ADD COLUMN icon VARCHAR(256) NOT NULL DEFAULT '' diff --git a/coderd/database/models.go b/coderd/database/models.go index 5fbc3f9081e99..fd64667a78ba3 100644 --- a/coderd/database/models.go +++ b/coderd/database/models.go @@ -587,6 +587,7 @@ type WorkspaceResource struct { Type string `db:"type" json:"type"` Name string `db:"name" json:"name"` Hide bool `db:"hide" json:"hide"` + Icon string `db:"icon" json:"icon"` } type WorkspaceResourceMetadatum struct { diff --git a/coderd/database/queries.sql.go b/coderd/database/queries.sql.go index 456d0ccf83305..0a2e8b4b95919 100644 --- a/coderd/database/queries.sql.go +++ b/coderd/database/queries.sql.go @@ -4320,7 +4320,7 @@ func (q *sqlQuerier) UpdateWorkspaceBuildByID(ctx context.Context, arg UpdateWor const getWorkspaceResourceByID = `-- name: GetWorkspaceResourceByID :one SELECT - id, created_at, job_id, transition, type, name, hide + id, created_at, job_id, transition, type, name, hide, icon FROM workspace_resources WHERE @@ -4338,6 +4338,7 @@ func (q *sqlQuerier) GetWorkspaceResourceByID(ctx context.Context, id uuid.UUID) &i.Type, &i.Name, &i.Hide, + &i.Icon, ) return i, err } @@ -4452,7 +4453,7 @@ func (q *sqlQuerier) GetWorkspaceResourceMetadataCreatedAfter(ctx context.Contex const getWorkspaceResourcesByJobID = `-- name: GetWorkspaceResourcesByJobID :many SELECT - id, created_at, job_id, transition, type, name, hide + id, created_at, job_id, transition, type, name, hide, icon FROM workspace_resources WHERE @@ -4476,6 +4477,7 @@ func (q *sqlQuerier) GetWorkspaceResourcesByJobID(ctx context.Context, jobID uui &i.Type, &i.Name, &i.Hide, + &i.Icon, ); err != nil { return nil, err } @@ -4491,7 +4493,7 @@ func (q *sqlQuerier) GetWorkspaceResourcesByJobID(ctx context.Context, jobID uui } const getWorkspaceResourcesCreatedAfter = `-- name: GetWorkspaceResourcesCreatedAfter :many -SELECT id, created_at, job_id, transition, type, name, hide FROM workspace_resources WHERE created_at > $1 +SELECT id, created_at, job_id, transition, type, name, hide, icon FROM workspace_resources WHERE created_at > $1 ` func (q *sqlQuerier) GetWorkspaceResourcesCreatedAfter(ctx context.Context, createdAt time.Time) ([]WorkspaceResource, error) { @@ -4511,6 +4513,7 @@ func (q *sqlQuerier) GetWorkspaceResourcesCreatedAfter(ctx context.Context, crea &i.Type, &i.Name, &i.Hide, + &i.Icon, ); err != nil { return nil, err } @@ -4527,9 +4530,9 @@ func (q *sqlQuerier) GetWorkspaceResourcesCreatedAfter(ctx context.Context, crea const insertWorkspaceResource = `-- name: InsertWorkspaceResource :one INSERT INTO - workspace_resources (id, created_at, job_id, transition, type, name, hide) + workspace_resources (id, created_at, job_id, transition, type, name, hide, icon) VALUES - ($1, $2, $3, $4, $5, $6, $7) RETURNING id, created_at, job_id, transition, type, name, hide + ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id, created_at, job_id, transition, type, name, hide, icon ` type InsertWorkspaceResourceParams struct { @@ -4540,6 +4543,7 @@ type InsertWorkspaceResourceParams struct { Type string `db:"type" json:"type"` Name string `db:"name" json:"name"` Hide bool `db:"hide" json:"hide"` + Icon string `db:"icon" json:"icon"` } func (q *sqlQuerier) InsertWorkspaceResource(ctx context.Context, arg InsertWorkspaceResourceParams) (WorkspaceResource, error) { @@ -4551,6 +4555,7 @@ func (q *sqlQuerier) InsertWorkspaceResource(ctx context.Context, arg InsertWork arg.Type, arg.Name, arg.Hide, + arg.Icon, ) var i WorkspaceResource err := row.Scan( @@ -4561,6 +4566,7 @@ func (q *sqlQuerier) InsertWorkspaceResource(ctx context.Context, arg InsertWork &i.Type, &i.Name, &i.Hide, + &i.Icon, ) return i, err } diff --git a/coderd/database/queries/workspaceresources.sql b/coderd/database/queries/workspaceresources.sql index 5603a65ae09c7..8cb2219a7c42f 100644 --- a/coderd/database/queries/workspaceresources.sql +++ b/coderd/database/queries/workspaceresources.sql @@ -19,9 +19,9 @@ SELECT * FROM workspace_resources WHERE created_at > $1; -- name: InsertWorkspaceResource :one INSERT INTO - workspace_resources (id, created_at, job_id, transition, type, name, hide) + workspace_resources (id, created_at, job_id, transition, type, name, hide, icon) VALUES - ($1, $2, $3, $4, $5, $6, $7) RETURNING *; + ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING *; -- name: GetWorkspaceResourceMetadataByResourceID :many SELECT diff --git a/coderd/provisionerdaemons.go b/coderd/provisionerdaemons.go index df4197a70ae18..b3d68eca79f31 100644 --- a/coderd/provisionerdaemons.go +++ b/coderd/provisionerdaemons.go @@ -753,6 +753,7 @@ func insertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid. Type: protoResource.Type, Name: protoResource.Name, Hide: protoResource.Hide, + Icon: protoResource.Icon, }) if err != nil { return xerrors.Errorf("insert provisioner job resource %q: %w", protoResource.Name, err) diff --git a/coderd/workspacebuilds.go b/coderd/workspacebuilds.go index 3fadef1552f55..893e32569ab75 100644 --- a/coderd/workspacebuilds.go +++ b/coderd/workspacebuilds.go @@ -699,6 +699,7 @@ func convertWorkspaceResource(resource database.WorkspaceResource, agents []code Type: resource.Type, Name: resource.Name, Hide: resource.Hide, + Icon: resource.Icon, Agents: agents, Metadata: convertedMetadata, } diff --git a/coderd/workspaceresources_test.go b/coderd/workspaceresources_test.go index c106c3c4efc67..a017f4165102e 100644 --- a/coderd/workspaceresources_test.go +++ b/coderd/workspaceresources_test.go @@ -27,6 +27,7 @@ func TestWorkspaceResource(t *testing.T) { Resources: []*proto.Resource{{ Name: "beta", Type: "example", + Icon: "/icon/server.svg", Agents: []*proto.Agent{{ Id: "something", Name: "b", @@ -60,9 +61,11 @@ func TestWorkspaceResource(t *testing.T) { resource, err := client.WorkspaceResource(ctx, resources[1].ID) require.NoError(t, err) require.Len(t, resource.Agents, 2) - // Ensure it's sorted alphabetically! + // Ensure agents are sorted alphabetically! require.Equal(t, "a", resource.Agents[0].Name) require.Equal(t, "b", resource.Agents[1].Name) + // Ensure Icon is present + require.Equal(t, "/icon/server.svg", resources[1].Icon) }) t.Run("Apps", func(t *testing.T) { diff --git a/codersdk/workspaceresources.go b/codersdk/workspaceresources.go index 782e827092ce2..3f306312fec19 100644 --- a/codersdk/workspaceresources.go +++ b/codersdk/workspaceresources.go @@ -26,6 +26,7 @@ type WorkspaceResource struct { Type string `json:"type"` Name string `json:"name"` Hide bool `json:"hide"` + Icon string `json:"icon"` Agents []WorkspaceAgent `json:"agents,omitempty"` Metadata []WorkspaceResourceMetadata `json:"metadata,omitempty"` } diff --git a/provisioner/terraform/resources.go b/provisioner/terraform/resources.go index d6c68b0fdefa7..264cdad139899 100644 --- a/provisioner/terraform/resources.go +++ b/provisioner/terraform/resources.go @@ -37,6 +37,7 @@ type agentAppAttributes struct { type metadataAttributes struct { ResourceID string `mapstructure:"resource_id"` Hide bool `mapstructure:"hide"` + Icon string `mapstructure:"icon"` Items []metadataItem `mapstructure:"item"` } @@ -237,6 +238,7 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res // Associate metadata blocks with resources. resourceMetadata := map[string][]*proto.Resource_Metadata{} resourceHidden := map[string]bool{} + resourceIcon := map[string]string{} for _, resource := range tfResourceByLabel { if resource.Type != "coder_metadata" { continue @@ -295,6 +297,7 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res } resourceHidden[targetLabel] = attrs.Hide + resourceIcon[targetLabel] = attrs.Icon for _, item := range attrs.Items { resourceMetadata[targetLabel] = append(resourceMetadata[targetLabel], &proto.Resource_Metadata{ @@ -325,6 +328,7 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res Type: resource.Type, Agents: agents, Hide: resourceHidden[label], + Icon: resourceIcon[label], Metadata: resourceMetadata[label], }) } diff --git a/provisionersdk/proto/provisioner.pb.go b/provisionersdk/proto/provisioner.pb.go index 2efdbac5fabb4..2deaee125e8a4 100644 --- a/provisionersdk/proto/provisioner.pb.go +++ b/provisionersdk/proto/provisioner.pb.go @@ -935,6 +935,7 @@ type Resource struct { Agents []*Agent `protobuf:"bytes,3,rep,name=agents,proto3" json:"agents,omitempty"` Metadata []*Resource_Metadata `protobuf:"bytes,4,rep,name=metadata,proto3" json:"metadata,omitempty"` Hide bool `protobuf:"varint,5,opt,name=hide,proto3" json:"hide,omitempty"` + Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"` } func (x *Resource) Reset() { diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 9b4f4ad243e2d..c5a90816563a4 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -637,6 +637,7 @@ export interface WorkspaceResource { readonly type: string readonly name: string readonly hide: boolean + readonly icon: string readonly agents?: WorkspaceAgent[] readonly metadata?: WorkspaceResourceMetadata[] } From f9883c7b64a21845ee80bc552923419e4acfdec4 Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Mon, 12 Sep 2022 18:00:31 +0000 Subject: [PATCH 03/13] Fix entities --- site/src/testHelpers/entities.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/site/src/testHelpers/entities.ts b/site/src/testHelpers/entities.ts index 106036783571e..0192196a96e2e 100644 --- a/site/src/testHelpers/entities.ts +++ b/site/src/testHelpers/entities.ts @@ -394,6 +394,7 @@ export const MockWorkspaceResource: TypesGen.WorkspaceResource = { type: "google_compute_disk", workspace_transition: "start", hide: false, + icon: "", metadata: [ { key: "type", value: "a-workspace-resource", sensitive: false }, { key: "api_key", value: "12345678", sensitive: true }, @@ -409,6 +410,7 @@ export const MockWorkspaceResource2: TypesGen.WorkspaceResource = { type: "google_compute_disk", workspace_transition: "start", hide: false, + icon: "", metadata: [ { key: "type", value: "google_compute_disk", sensitive: false }, { key: "size", value: "32GB", sensitive: false }, @@ -424,6 +426,7 @@ export const MockWorkspaceResource3: TypesGen.WorkspaceResource = { type: "google_compute_disk", workspace_transition: "start", hide: true, + icon: "", metadata: [ { key: "type", value: "google_compute_disk", sensitive: false }, { key: "size", value: "32GB", sensitive: false }, From 1411f0564869bc002edd1250ac8ee5e5795f1800 Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Mon, 12 Sep 2022 18:07:07 +0000 Subject: [PATCH 04/13] Fix test --- provisioner/terraform/resources_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/provisioner/terraform/resources_test.go b/provisioner/terraform/resources_test.go index e378462c3cd3b..5e2cdbc7fc588 100644 --- a/provisioner/terraform/resources_test.go +++ b/provisioner/terraform/resources_test.go @@ -121,6 +121,7 @@ func TestConvertResources(t *testing.T) { Name: "about", Type: "null_resource", Hide: true, + Icon: "/icon/server.svg", Metadata: []*proto.Resource_Metadata{{ Key: "hello", Value: "world", From fc97c5a0f80af515d99fbdffda73a445af9bb97f Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Mon, 12 Sep 2022 18:38:16 +0000 Subject: [PATCH 05/13] Remove test --- coderd/workspaceresources_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/coderd/workspaceresources_test.go b/coderd/workspaceresources_test.go index a017f4165102e..15dae143df42e 100644 --- a/coderd/workspaceresources_test.go +++ b/coderd/workspaceresources_test.go @@ -27,7 +27,6 @@ func TestWorkspaceResource(t *testing.T) { Resources: []*proto.Resource{{ Name: "beta", Type: "example", - Icon: "/icon/server.svg", Agents: []*proto.Agent{{ Id: "something", Name: "b", @@ -64,8 +63,6 @@ func TestWorkspaceResource(t *testing.T) { // Ensure agents are sorted alphabetically! require.Equal(t, "a", resource.Agents[0].Name) require.Equal(t, "b", resource.Agents[1].Name) - // Ensure Icon is present - require.Equal(t, "/icon/server.svg", resources[1].Icon) }) t.Run("Apps", func(t *testing.T) { From a1ba92073cdf656e859df2370583bc1ae3c841be Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Mon, 12 Sep 2022 19:43:07 +0000 Subject: [PATCH 06/13] Fix proto and tests --- coderd/workspaceresources_test.go | 3 + provisionersdk/proto/provisioner.pb.go | 218 +++++++++++++------------ provisionersdk/proto/provisioner.proto | 1 + 3 files changed, 117 insertions(+), 105 deletions(-) diff --git a/coderd/workspaceresources_test.go b/coderd/workspaceresources_test.go index 15dae143df42e..a017f4165102e 100644 --- a/coderd/workspaceresources_test.go +++ b/coderd/workspaceresources_test.go @@ -27,6 +27,7 @@ func TestWorkspaceResource(t *testing.T) { Resources: []*proto.Resource{{ Name: "beta", Type: "example", + Icon: "/icon/server.svg", Agents: []*proto.Agent{{ Id: "something", Name: "b", @@ -63,6 +64,8 @@ func TestWorkspaceResource(t *testing.T) { // Ensure agents are sorted alphabetically! require.Equal(t, "a", resource.Agents[0].Name) require.Equal(t, "b", resource.Agents[1].Name) + // Ensure Icon is present + require.Equal(t, "/icon/server.svg", resources[1].Icon) }) t.Run("Apps", func(t *testing.T) { diff --git a/provisionersdk/proto/provisioner.pb.go b/provisionersdk/proto/provisioner.pb.go index 2deaee125e8a4..b977e00a42e36 100644 --- a/provisionersdk/proto/provisioner.pb.go +++ b/provisionersdk/proto/provisioner.pb.go @@ -1005,6 +1005,13 @@ func (x *Resource) GetHide() bool { return false } +func (x *Resource) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + // Parse consumes source-code from a directory to produce inputs. type Parse struct { state protoimpl.MessageState @@ -1881,7 +1888,7 @@ var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{ 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0c, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x22, 0x99, + 0x52, 0x0c, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x22, 0xad, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, @@ -1892,111 +1899,112 @@ var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{ 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x68, - 0x69, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x68, 0x69, 0x64, 0x65, 0x1a, - 0x69, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, - 0x65, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x4e, 0x75, 0x6c, 0x6c, 0x22, 0xfc, 0x01, 0x0a, 0x05, 0x50, - 0x61, 0x72, 0x73, 0x65, 0x1a, 0x27, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x1a, 0x55, 0x0a, - 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x49, 0x0a, 0x11, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x52, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x73, 0x1a, 0x73, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x24, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x48, - 0x00, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x39, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, - 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x43, 0x6f, 0x6d, - 0x70, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, - 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xae, 0x07, 0x0a, 0x09, 0x50, 0x72, - 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0xd1, 0x02, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x5f, 0x75, 0x72, - 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x55, 0x72, - 0x6c, 0x12, 0x53, 0x0a, 0x14, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, - 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x57, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, - 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, - 0x0f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x77, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x1a, 0xd9, 0x01, 0x0a, 0x05, - 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x79, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, - 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x17, - 0x0a, 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x06, 0x64, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, 0x08, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, - 0x6c, 0x1a, 0x80, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x12, 0x37, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, - 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x61, 0x6e, 0x63, - 0x65, 0x6c, 0x48, 0x00, 0x52, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x06, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x1a, 0x6b, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x33, 0x0a, 0x09, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x73, 0x1a, 0x77, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, - 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, - 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x48, 0x00, 0x52, 0x03, - 0x6c, 0x6f, 0x67, 0x12, 0x3d, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, - 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, - 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a, 0x3f, 0x0a, 0x08, 0x4c, 0x6f, - 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, - 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x41, 0x52, 0x4e, 0x10, 0x03, - 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x2a, 0x37, 0x0a, 0x13, 0x57, - 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x00, 0x12, 0x08, 0x0a, - 0x04, 0x53, 0x54, 0x4f, 0x50, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53, 0x54, 0x52, - 0x4f, 0x59, 0x10, 0x02, 0x32, 0xa3, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65, 0x12, 0x1a, 0x2e, + 0x69, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x68, 0x69, 0x64, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, + 0x63, 0x6f, 0x6e, 0x1a, 0x69, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, + 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x65, 0x6e, 0x73, + 0x69, 0x74, 0x69, 0x76, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x4e, 0x75, 0x6c, 0x6c, 0x22, 0xfc, + 0x01, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65, 0x1a, 0x27, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x79, 0x1a, 0x55, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x49, 0x0a, + 0x11, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x1a, 0x73, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, + 0x4c, 0x6f, 0x67, 0x48, 0x00, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x39, 0x0a, 0x08, 0x63, 0x6f, + 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, + 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, + 0x70, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xae, 0x07, + 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0xd1, 0x02, 0x0a, 0x08, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, + 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x64, + 0x65, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x53, 0x0a, 0x14, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, + 0x72, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x77, 0x6f, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x6f, + 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2c, 0x0a, + 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x77, + 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x1a, + 0xd9, 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x06, 0x64, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, 0x08, 0x0a, 0x06, 0x43, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x1a, 0x80, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, + 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x37, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, + 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x48, 0x00, 0x52, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, + 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x1a, 0x6b, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x70, + 0x6c, 0x65, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x12, 0x33, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, + 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x77, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x24, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, + 0x48, 0x00, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x3d, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, + 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, + 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a, 0x3f, + 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, + 0x41, 0x43, 0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x01, + 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x41, + 0x52, 0x4e, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x2a, + 0x37, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, + 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x54, 0x4f, 0x50, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, + 0x45, 0x53, 0x54, 0x52, 0x4f, 0x59, 0x10, 0x02, 0x32, 0xa3, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, + 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, + 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, - 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x50, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, - 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x63, - 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, - 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x50, 0x0a, 0x09, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2d, + 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x64, + 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x65, 0x72, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/provisionersdk/proto/provisioner.proto b/provisionersdk/proto/provisioner.proto index 3bf760d1dc5d8..57931f4524069 100644 --- a/provisionersdk/proto/provisioner.proto +++ b/provisionersdk/proto/provisioner.proto @@ -110,6 +110,7 @@ message Resource { } repeated Metadata metadata = 4; bool hide = 5; + string icon = 6; } // Parse consumes source-code from a directory to produce inputs. From d6082903857c92c3b3414c0b16ceb2ad40e4ea5f Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Mon, 12 Sep 2022 20:01:14 +0000 Subject: [PATCH 07/13] Update version --- .../testdata/calling-module/calling-module.tf | 2 +- .../calling-module/calling-module.tfplan.json | 31 ++++------------ .../chaining-resources/chaining-resources.tf | 2 +- .../chaining-resources.tfplan.json | 22 +++-------- .../conflicting-resources.tf | 2 +- .../conflicting-resources.tfplan.json | 22 +++-------- .../testdata/instance-id/instance-id.tf | 2 +- .../instance-id/instance-id.tfplan.json | 27 ++++---------- .../multiple-agents/multiple-agents.tf | 2 +- .../multiple-agents.tfplan.json | 18 +++------ .../testdata/multiple-apps/multiple-apps.tf | 2 +- .../multiple-apps/multiple-apps.tfplan.json | 36 +++++------------- .../resource-metadata/resource-metadata.tf | 12 +++--- .../resource-metadata.tfplan.json | 37 ++++--------------- 14 files changed, 61 insertions(+), 156 deletions(-) diff --git a/provisioner/terraform/testdata/calling-module/calling-module.tf b/provisioner/terraform/testdata/calling-module/calling-module.tf index 0da8a94a6ad79..14303795cff4c 100644 --- a/provisioner/terraform/testdata/calling-module/calling-module.tf +++ b/provisioner/terraform/testdata/calling-module/calling-module.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.10" + version = "0.4.11" } } } diff --git a/provisioner/terraform/testdata/calling-module/calling-module.tfplan.json b/provisioner/terraform/testdata/calling-module/calling-module.tfplan.json index 4fbb241c12479..bba03d2aa31fc 100644 --- a/provisioner/terraform/testdata/calling-module/calling-module.tfplan.json +++ b/provisioner/terraform/testdata/calling-module/calling-module.tfplan.json @@ -66,9 +66,7 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "arch": "amd64", @@ -95,9 +93,7 @@ "name": "script", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": [ - "read" - ], + "actions": ["read"], "before": null, "after": { "inputs": {} @@ -127,9 +123,7 @@ "name": "example", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "triggers": null @@ -147,7 +141,7 @@ "coder": { "name": "coder", "full_name": "registry.terraform.io/coder/coder", - "version_constraint": "0.4.10" + "version_constraint": "0.4.11" }, "module.module:null": { "name": "null", @@ -179,10 +173,7 @@ "source": "./module", "expressions": { "script": { - "references": [ - "coder_agent.main.init_script", - "coder_agent.main" - ] + "references": ["coder_agent.main.init_script", "coder_agent.main"] } }, "module": { @@ -194,9 +185,7 @@ "name": "example", "provider_config_key": "module.module:null", "schema_version": 0, - "depends_on": [ - "data.null_data_source.script" - ] + "depends_on": ["data.null_data_source.script"] }, { "address": "data.null_data_source.script", @@ -206,9 +195,7 @@ "provider_config_key": "module.module:null", "expressions": { "inputs": { - "references": [ - "var.script" - ] + "references": ["var.script"] } }, "schema_version": 0 @@ -225,9 +212,7 @@ "relevant_attributes": [ { "resource": "coder_agent.main", - "attribute": [ - "init_script" - ] + "attribute": ["init_script"] } ] } diff --git a/provisioner/terraform/testdata/chaining-resources/chaining-resources.tf b/provisioner/terraform/testdata/chaining-resources/chaining-resources.tf index 8133e91976bec..75347019d2247 100644 --- a/provisioner/terraform/testdata/chaining-resources/chaining-resources.tf +++ b/provisioner/terraform/testdata/chaining-resources/chaining-resources.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.10" + version = "0.4.11" } } } diff --git a/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfplan.json b/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfplan.json index feaa74b9ee0ff..473adc40a90d4 100644 --- a/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfplan.json +++ b/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfplan.json @@ -56,9 +56,7 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "arch": "amd64", @@ -84,9 +82,7 @@ "name": "a", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "triggers": null @@ -105,9 +101,7 @@ "name": "b", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "triggers": null @@ -125,7 +119,7 @@ "coder": { "name": "coder", "full_name": "registry.terraform.io/coder/coder", - "version_constraint": "0.4.10" + "version_constraint": "0.4.11" }, "null": { "name": "null", @@ -157,9 +151,7 @@ "name": "a", "provider_config_key": "null", "schema_version": 0, - "depends_on": [ - "null_resource.b" - ] + "depends_on": ["null_resource.b"] }, { "address": "null_resource.b", @@ -168,9 +160,7 @@ "name": "b", "provider_config_key": "null", "schema_version": 0, - "depends_on": [ - "coder_agent.main" - ] + "depends_on": ["coder_agent.main"] } ] } diff --git a/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tf b/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tf index 6a5a56a90a780..db0787b2dd550 100644 --- a/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tf +++ b/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.10" + version = "0.4.11" } } } diff --git a/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfplan.json b/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfplan.json index a2848e565b8e2..a16badc6e7c26 100644 --- a/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfplan.json +++ b/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfplan.json @@ -56,9 +56,7 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "arch": "amd64", @@ -84,9 +82,7 @@ "name": "first", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "triggers": null @@ -105,9 +101,7 @@ "name": "second", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "triggers": null @@ -125,7 +119,7 @@ "coder": { "name": "coder", "full_name": "registry.terraform.io/coder/coder", - "version_constraint": "0.4.10" + "version_constraint": "0.4.11" }, "null": { "name": "null", @@ -157,9 +151,7 @@ "name": "first", "provider_config_key": "null", "schema_version": 0, - "depends_on": [ - "coder_agent.main" - ] + "depends_on": ["coder_agent.main"] }, { "address": "null_resource.second", @@ -168,9 +160,7 @@ "name": "second", "provider_config_key": "null", "schema_version": 0, - "depends_on": [ - "coder_agent.main" - ] + "depends_on": ["coder_agent.main"] } ] } diff --git a/provisioner/terraform/testdata/instance-id/instance-id.tf b/provisioner/terraform/testdata/instance-id/instance-id.tf index c785b61cea5b9..a56988dcc1f81 100644 --- a/provisioner/terraform/testdata/instance-id/instance-id.tf +++ b/provisioner/terraform/testdata/instance-id/instance-id.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.10" + version = "0.4.11" } } } diff --git a/provisioner/terraform/testdata/instance-id/instance-id.tfplan.json b/provisioner/terraform/testdata/instance-id/instance-id.tfplan.json index 6a1f48a06fc1e..8d6e6df19721f 100644 --- a/provisioner/terraform/testdata/instance-id/instance-id.tfplan.json +++ b/provisioner/terraform/testdata/instance-id/instance-id.tfplan.json @@ -56,9 +56,7 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "arch": "amd64", @@ -84,9 +82,7 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "instance_id": "example" @@ -106,9 +102,7 @@ "name": "main", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "triggers": null @@ -126,7 +120,7 @@ "coder": { "name": "coder", "full_name": "registry.terraform.io/coder/coder", - "version_constraint": "0.4.10" + "version_constraint": "0.4.11" }, "null": { "name": "null", @@ -162,10 +156,7 @@ "provider_config_key": "coder", "expressions": { "agent_id": { - "references": [ - "coder_agent.main.id", - "coder_agent.main" - ] + "references": ["coder_agent.main.id", "coder_agent.main"] }, "instance_id": { "constant_value": "example" @@ -180,9 +171,7 @@ "name": "main", "provider_config_key": "null", "schema_version": 0, - "depends_on": [ - "coder_agent.main" - ] + "depends_on": ["coder_agent.main"] } ] } @@ -190,9 +179,7 @@ "relevant_attributes": [ { "resource": "coder_agent.main", - "attribute": [ - "id" - ] + "attribute": ["id"] } ] } diff --git a/provisioner/terraform/testdata/multiple-agents/multiple-agents.tf b/provisioner/terraform/testdata/multiple-agents/multiple-agents.tf index 2b99c01530b56..2aea125c0fec9 100644 --- a/provisioner/terraform/testdata/multiple-agents/multiple-agents.tf +++ b/provisioner/terraform/testdata/multiple-agents/multiple-agents.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.10" + version = "0.4.11" } } } diff --git a/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfplan.json b/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfplan.json index 5b2c6f0788a70..6bebb6d9ceab9 100644 --- a/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfplan.json +++ b/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfplan.json @@ -78,9 +78,7 @@ "name": "dev1", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "arch": "amd64", @@ -106,9 +104,7 @@ "name": "dev2", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "arch": "amd64", @@ -134,9 +130,7 @@ "name": "dev3", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "arch": "arm64", @@ -162,9 +156,7 @@ "name": "dev", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "triggers": null @@ -182,7 +174,7 @@ "coder": { "name": "coder", "full_name": "registry.terraform.io/coder/coder", - "version_constraint": "0.4.10" + "version_constraint": "0.4.11" }, "null": { "name": "null", diff --git a/provisioner/terraform/testdata/multiple-apps/multiple-apps.tf b/provisioner/terraform/testdata/multiple-apps/multiple-apps.tf index aec64fda3f288..456d00ec6abc1 100644 --- a/provisioner/terraform/testdata/multiple-apps/multiple-apps.tf +++ b/provisioner/terraform/testdata/multiple-apps/multiple-apps.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.10" + version = "0.4.11" } } } diff --git a/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfplan.json b/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfplan.json index 6dd8ddca4a8bb..a7005e2c32a72 100644 --- a/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfplan.json +++ b/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfplan.json @@ -76,9 +76,7 @@ "name": "dev1", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "arch": "amd64", @@ -104,9 +102,7 @@ "name": "app1", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "command": null, @@ -130,9 +126,7 @@ "name": "app2", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "command": null, @@ -156,9 +150,7 @@ "name": "dev", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "triggers": null @@ -176,7 +168,7 @@ "coder": { "name": "coder", "full_name": "registry.terraform.io/coder/coder", - "version_constraint": "0.4.10" + "version_constraint": "0.4.11" }, "null": { "name": "null", @@ -209,10 +201,7 @@ "provider_config_key": "coder", "expressions": { "agent_id": { - "references": [ - "coder_agent.dev1.id", - "coder_agent.dev1" - ] + "references": ["coder_agent.dev1.id", "coder_agent.dev1"] } }, "schema_version": 0 @@ -225,10 +214,7 @@ "provider_config_key": "coder", "expressions": { "agent_id": { - "references": [ - "coder_agent.dev1.id", - "coder_agent.dev1" - ] + "references": ["coder_agent.dev1.id", "coder_agent.dev1"] } }, "schema_version": 0 @@ -240,9 +226,7 @@ "name": "dev", "provider_config_key": "null", "schema_version": 0, - "depends_on": [ - "coder_agent.dev1" - ] + "depends_on": ["coder_agent.dev1"] } ] } @@ -250,9 +234,7 @@ "relevant_attributes": [ { "resource": "coder_agent.dev1", - "attribute": [ - "id" - ] + "attribute": ["id"] } ] } diff --git a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tf b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tf index 4af8b26953b8d..9000f2a3345d5 100644 --- a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tf +++ b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "0.4.10" + version = "0.4.11" } } } @@ -16,21 +16,21 @@ resource "null_resource" "about" {} resource "coder_metadata" "about_info" { resource_id = null_resource.about.id - hide = true + hide = true item { - key = "hello" + key = "hello" value = "world" } item { key = "null" } item { - key = "empty" + key = "empty" value = "" } item { - key = "secret" - value = "squirrel" + key = "secret" + value = "squirrel" sensitive = true } } diff --git a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json index 65052d5074ca2..ab34777014575 100644 --- a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json +++ b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json @@ -54,12 +54,7 @@ ] }, "sensitive_values": { - "item": [ - {}, - {}, - {}, - {} - ] + "item": [{}, {}, {}, {}] } }, { @@ -85,9 +80,7 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "arch": "amd64", @@ -113,9 +106,7 @@ "name": "about_info", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "hide": true, @@ -162,12 +153,7 @@ }, "before_sensitive": false, "after_sensitive": { - "item": [ - {}, - {}, - {}, - {} - ] + "item": [{}, {}, {}, {}] } } }, @@ -178,9 +164,7 @@ "name": "about", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": [ - "create" - ], + "actions": ["create"], "before": null, "after": { "triggers": null @@ -198,7 +182,7 @@ "coder": { "name": "coder", "full_name": "registry.terraform.io/coder/coder", - "version_constraint": "0.4.10" + "version_constraint": "0.4.11" }, "null": { "name": "null", @@ -268,10 +252,7 @@ } ], "resource_id": { - "references": [ - "null_resource.about.id", - "null_resource.about" - ] + "references": ["null_resource.about.id", "null_resource.about"] } }, "schema_version": 0 @@ -290,9 +271,7 @@ "relevant_attributes": [ { "resource": "null_resource.about", - "attribute": [ - "id" - ] + "attribute": ["id"] } ] } From 72bb2f0db42ac89300316b0c4827d090201ff9b1 Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Mon, 12 Sep 2022 20:05:02 +0000 Subject: [PATCH 08/13] Update tfplans --- .../resource-metadata/resource-metadata.tfplan.json | 2 ++ .../resource-metadata/resource-metadata.tfstate.json | 12 +++--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json index ab34777014575..f6340ab53a3d8 100644 --- a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json +++ b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json @@ -30,6 +30,7 @@ "schema_version": 0, "values": { "hide": true, + "icon": "/icon/server.svg", "item": [ { "key": "hello", @@ -110,6 +111,7 @@ "before": null, "after": { "hide": true, + "icon": "/icon/server.svg", "item": [ { "key": "hello", diff --git a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfstate.json b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfstate.json index 1a56c51f53d9b..72677f2fcf39a 100644 --- a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfstate.json +++ b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfstate.json @@ -33,6 +33,7 @@ "schema_version": 0, "values": { "hide": true, + "icon": "/icon/server.svg", "id": "6f981e35-73a3-4478-8227-fed4643afd71", "item": [ { @@ -63,16 +64,9 @@ "resource_id": "3184975245680216434" }, "sensitive_values": { - "item": [ - {}, - {}, - {}, - {} - ] + "item": [{}, {}, {}, {}] }, - "depends_on": [ - "null_resource.about" - ] + "depends_on": ["null_resource.about"] }, { "address": "null_resource.about", From e8b2d9d86b334316d9df01d5c97d87c3bdce3276 Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Mon, 12 Sep 2022 20:08:50 +0000 Subject: [PATCH 09/13] Generate provisioner data --- .../calling-module/calling-module.tfplan.json | 29 ++++++++++---- .../calling-module.tfstate.json | 8 ++-- .../chaining-resources.tfplan.json | 20 +++++++--- .../chaining-resources.tfstate.json | 8 ++-- .../conflicting-resources.tfplan.json | 20 +++++++--- .../conflicting-resources.tfstate.json | 8 ++-- .../instance-id/instance-id.tfplan.json | 25 +++++++++--- .../instance-id/instance-id.tfstate.json | 10 ++--- .../multiple-agents.tfplan.json | 16 ++++++-- .../multiple-agents.tfstate.json | 14 +++---- .../multiple-apps/multiple-apps.tfplan.json | 34 +++++++++++++---- .../multiple-apps/multiple-apps.tfstate.json | 14 +++---- .../resource-metadata/resource-metadata.tf | 1 + .../resource-metadata.tfplan.json | 38 +++++++++++++++---- .../resource-metadata.tfstate.json | 21 ++++++---- 15 files changed, 186 insertions(+), 80 deletions(-) diff --git a/provisioner/terraform/testdata/calling-module/calling-module.tfplan.json b/provisioner/terraform/testdata/calling-module/calling-module.tfplan.json index bba03d2aa31fc..9748cc53b9801 100644 --- a/provisioner/terraform/testdata/calling-module/calling-module.tfplan.json +++ b/provisioner/terraform/testdata/calling-module/calling-module.tfplan.json @@ -66,7 +66,9 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "arch": "amd64", @@ -93,7 +95,9 @@ "name": "script", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": ["read"], + "actions": [ + "read" + ], "before": null, "after": { "inputs": {} @@ -123,7 +127,9 @@ "name": "example", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "triggers": null @@ -173,7 +179,10 @@ "source": "./module", "expressions": { "script": { - "references": ["coder_agent.main.init_script", "coder_agent.main"] + "references": [ + "coder_agent.main.init_script", + "coder_agent.main" + ] } }, "module": { @@ -185,7 +194,9 @@ "name": "example", "provider_config_key": "module.module:null", "schema_version": 0, - "depends_on": ["data.null_data_source.script"] + "depends_on": [ + "data.null_data_source.script" + ] }, { "address": "data.null_data_source.script", @@ -195,7 +206,9 @@ "provider_config_key": "module.module:null", "expressions": { "inputs": { - "references": ["var.script"] + "references": [ + "var.script" + ] } }, "schema_version": 0 @@ -212,7 +225,9 @@ "relevant_attributes": [ { "resource": "coder_agent.main", - "attribute": ["init_script"] + "attribute": [ + "init_script" + ] } ] } diff --git a/provisioner/terraform/testdata/calling-module/calling-module.tfstate.json b/provisioner/terraform/testdata/calling-module/calling-module.tfstate.json index 8499a27dfe848..0518f8dbced64 100644 --- a/provisioner/terraform/testdata/calling-module/calling-module.tfstate.json +++ b/provisioner/terraform/testdata/calling-module/calling-module.tfstate.json @@ -16,11 +16,11 @@ "auth": "token", "dir": null, "env": null, - "id": "ee0b689a-9785-4d72-923f-e2acf88d709b", + "id": "f05ddf9e-106a-4669-bba8-5e2289bd891d", "init_script": "", "os": "linux", "startup_script": null, - "token": "a295c68a-27af-4dc8-92cd-db154084cf30" + "token": "ed4655b9-e917-44af-8706-a1215384a35f" }, "sensitive_values": {} } @@ -44,7 +44,7 @@ "outputs": { "script": "" }, - "random": "410687191584620713" + "random": "7640853885488752810" }, "sensitive_values": { "inputs": {}, @@ -59,7 +59,7 @@ "provider_name": "registry.terraform.io/hashicorp/null", "schema_version": 0, "values": { - "id": "7780508472225873711", + "id": "6481148597794195898", "triggers": null }, "sensitive_values": {}, diff --git a/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfplan.json b/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfplan.json index 473adc40a90d4..f82c9851aa283 100644 --- a/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfplan.json +++ b/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfplan.json @@ -56,7 +56,9 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "arch": "amd64", @@ -82,7 +84,9 @@ "name": "a", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "triggers": null @@ -101,7 +105,9 @@ "name": "b", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "triggers": null @@ -151,7 +157,9 @@ "name": "a", "provider_config_key": "null", "schema_version": 0, - "depends_on": ["null_resource.b"] + "depends_on": [ + "null_resource.b" + ] }, { "address": "null_resource.b", @@ -160,7 +168,9 @@ "name": "b", "provider_config_key": "null", "schema_version": 0, - "depends_on": ["coder_agent.main"] + "depends_on": [ + "coder_agent.main" + ] } ] } diff --git a/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfstate.json b/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfstate.json index 6109908119a33..95c62fe5cde09 100644 --- a/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfstate.json +++ b/provisioner/terraform/testdata/chaining-resources/chaining-resources.tfstate.json @@ -16,11 +16,11 @@ "auth": "token", "dir": null, "env": null, - "id": "97baf22d-c3fc-4570-a025-58dd5235366f", + "id": "fcd8018c-7e4a-4e92-855b-e02319ab051e", "init_script": "", "os": "linux", "startup_script": null, - "token": "ae325f47-8fe4-436c-9787-7295eef26604" + "token": "ad906408-0eb0-4844-83f7-0f5070427e1c" }, "sensitive_values": {} }, @@ -32,7 +32,7 @@ "provider_name": "registry.terraform.io/hashicorp/null", "schema_version": 0, "values": { - "id": "8957171845319631256", + "id": "2672857180605476162", "triggers": null }, "sensitive_values": {}, @@ -49,7 +49,7 @@ "provider_name": "registry.terraform.io/hashicorp/null", "schema_version": 0, "values": { - "id": "7521770950111838137", + "id": "264584188140644760", "triggers": null }, "sensitive_values": {}, diff --git a/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfplan.json b/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfplan.json index a16badc6e7c26..f0235d2f174c4 100644 --- a/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfplan.json +++ b/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfplan.json @@ -56,7 +56,9 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "arch": "amd64", @@ -82,7 +84,9 @@ "name": "first", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "triggers": null @@ -101,7 +105,9 @@ "name": "second", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "triggers": null @@ -151,7 +157,9 @@ "name": "first", "provider_config_key": "null", "schema_version": 0, - "depends_on": ["coder_agent.main"] + "depends_on": [ + "coder_agent.main" + ] }, { "address": "null_resource.second", @@ -160,7 +168,9 @@ "name": "second", "provider_config_key": "null", "schema_version": 0, - "depends_on": ["coder_agent.main"] + "depends_on": [ + "coder_agent.main" + ] } ] } diff --git a/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfstate.json b/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfstate.json index fc56ad8dd1a8c..58152817465d9 100644 --- a/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfstate.json +++ b/provisioner/terraform/testdata/conflicting-resources/conflicting-resources.tfstate.json @@ -16,11 +16,11 @@ "auth": "token", "dir": null, "env": null, - "id": "75c43b92-2812-4a6b-9a40-16c124c3c2ff", + "id": "e3df7d56-17ce-4d8a-9d4e-30ea41cc8a93", "init_script": "", "os": "linux", "startup_script": null, - "token": "bf14e82d-7e8f-49b5-8e2a-fb84da4b6afa" + "token": "1717f79d-2c72-440e-a5c6-e4b8c3fef084" }, "sensitive_values": {} }, @@ -32,7 +32,7 @@ "provider_name": "registry.terraform.io/hashicorp/null", "schema_version": 0, "values": { - "id": "5082348601033637104", + "id": "2957375211969224115", "triggers": null }, "sensitive_values": {}, @@ -48,7 +48,7 @@ "provider_name": "registry.terraform.io/hashicorp/null", "schema_version": 0, "values": { - "id": "135765900644760615", + "id": "6924176854496195292", "triggers": null }, "sensitive_values": {}, diff --git a/provisioner/terraform/testdata/instance-id/instance-id.tfplan.json b/provisioner/terraform/testdata/instance-id/instance-id.tfplan.json index 8d6e6df19721f..45462912024ea 100644 --- a/provisioner/terraform/testdata/instance-id/instance-id.tfplan.json +++ b/provisioner/terraform/testdata/instance-id/instance-id.tfplan.json @@ -56,7 +56,9 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "arch": "amd64", @@ -82,7 +84,9 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "instance_id": "example" @@ -102,7 +106,9 @@ "name": "main", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "triggers": null @@ -156,7 +162,10 @@ "provider_config_key": "coder", "expressions": { "agent_id": { - "references": ["coder_agent.main.id", "coder_agent.main"] + "references": [ + "coder_agent.main.id", + "coder_agent.main" + ] }, "instance_id": { "constant_value": "example" @@ -171,7 +180,9 @@ "name": "main", "provider_config_key": "null", "schema_version": 0, - "depends_on": ["coder_agent.main"] + "depends_on": [ + "coder_agent.main" + ] } ] } @@ -179,7 +190,9 @@ "relevant_attributes": [ { "resource": "coder_agent.main", - "attribute": ["id"] + "attribute": [ + "id" + ] } ] } diff --git a/provisioner/terraform/testdata/instance-id/instance-id.tfstate.json b/provisioner/terraform/testdata/instance-id/instance-id.tfstate.json index 24c7fdcc3ee70..c288ecbe3d770 100644 --- a/provisioner/terraform/testdata/instance-id/instance-id.tfstate.json +++ b/provisioner/terraform/testdata/instance-id/instance-id.tfstate.json @@ -16,11 +16,11 @@ "auth": "google-instance-identity", "dir": null, "env": null, - "id": "9112719f-1e11-41d0-8baf-7f92e94fb510", + "id": "9a37096a-7f01-42cd-93d8-9f4572c94489", "init_script": "", "os": "linux", "startup_script": null, - "token": "8d556c96-9010-4ae9-8993-69c01de97d24" + "token": "7784ea1f-7fe5-463f-af8d-255c32d12992" }, "sensitive_values": {} }, @@ -32,8 +32,8 @@ "provider_name": "registry.terraform.io/coder/coder", "schema_version": 0, "values": { - "agent_id": "9112719f-1e11-41d0-8baf-7f92e94fb510", - "id": "35efb5bc-da00-45e8-b38c-df4899417842", + "agent_id": "9a37096a-7f01-42cd-93d8-9f4572c94489", + "id": "8ed448e2-51d7-4cc7-9e26-a3a77f252b1d", "instance_id": "example" }, "sensitive_values": {}, @@ -49,7 +49,7 @@ "provider_name": "registry.terraform.io/hashicorp/null", "schema_version": 0, "values": { - "id": "6105197068461821872", + "id": "771742387122791362", "triggers": null }, "sensitive_values": {}, diff --git a/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfplan.json b/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfplan.json index 6bebb6d9ceab9..e859a094d8b24 100644 --- a/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfplan.json +++ b/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfplan.json @@ -78,7 +78,9 @@ "name": "dev1", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "arch": "amd64", @@ -104,7 +106,9 @@ "name": "dev2", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "arch": "amd64", @@ -130,7 +134,9 @@ "name": "dev3", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "arch": "arm64", @@ -156,7 +162,9 @@ "name": "dev", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "triggers": null diff --git a/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfstate.json b/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfstate.json index 4a55acc1c73f8..3755a14d44abd 100644 --- a/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfstate.json +++ b/provisioner/terraform/testdata/multiple-agents/multiple-agents.tfstate.json @@ -16,11 +16,11 @@ "auth": "token", "dir": null, "env": null, - "id": "0a714220-de27-4721-a6ab-d5c21c8e99b8", + "id": "0c3c20d8-8a1d-4fc9-bc73-ed45ddad9a9d", "init_script": "", "os": "linux", "startup_script": null, - "token": "d241aebd-6d75-4c06-a02e-74b41607345c" + "token": "48b3f4c4-4bb9-477c-8d32-d1e14188e5f8" }, "sensitive_values": {} }, @@ -36,11 +36,11 @@ "auth": "token", "dir": null, "env": null, - "id": "27567c6b-c52a-4c01-a6ad-368fddb36c9a", + "id": "08e8ebc8-4660-47f0-acb5-6ca46747919d", "init_script": "", "os": "darwin", "startup_script": null, - "token": "eb5f4e5e-eb57-434c-a444-274b811afa30" + "token": "827a1f01-a2d7-4794-ab73-8fd8442010d5" }, "sensitive_values": {} }, @@ -56,11 +56,11 @@ "auth": "token", "dir": null, "env": null, - "id": "b689c633-e666-43e1-ac77-9522f187a098", + "id": "50f52bd4-a52b-4c73-bf99-fe956913bca4", "init_script": "", "os": "windows", "startup_script": null, - "token": "90a9c42e-df1f-4656-ac4c-c7f4ab06a269" + "token": "159d6407-a913-4e05-8ba7-786d47a7e34b" }, "sensitive_values": {} }, @@ -72,7 +72,7 @@ "provider_name": "registry.terraform.io/hashicorp/null", "schema_version": 0, "values": { - "id": "7866048965316331550", + "id": "2529387636030139440", "triggers": null }, "sensitive_values": {}, diff --git a/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfplan.json b/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfplan.json index a7005e2c32a72..d728eb2c88c43 100644 --- a/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfplan.json +++ b/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfplan.json @@ -76,7 +76,9 @@ "name": "dev1", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "arch": "amd64", @@ -102,7 +104,9 @@ "name": "app1", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "command": null, @@ -126,7 +130,9 @@ "name": "app2", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "command": null, @@ -150,7 +156,9 @@ "name": "dev", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "triggers": null @@ -201,7 +209,10 @@ "provider_config_key": "coder", "expressions": { "agent_id": { - "references": ["coder_agent.dev1.id", "coder_agent.dev1"] + "references": [ + "coder_agent.dev1.id", + "coder_agent.dev1" + ] } }, "schema_version": 0 @@ -214,7 +225,10 @@ "provider_config_key": "coder", "expressions": { "agent_id": { - "references": ["coder_agent.dev1.id", "coder_agent.dev1"] + "references": [ + "coder_agent.dev1.id", + "coder_agent.dev1" + ] } }, "schema_version": 0 @@ -226,7 +240,9 @@ "name": "dev", "provider_config_key": "null", "schema_version": 0, - "depends_on": ["coder_agent.dev1"] + "depends_on": [ + "coder_agent.dev1" + ] } ] } @@ -234,7 +250,9 @@ "relevant_attributes": [ { "resource": "coder_agent.dev1", - "attribute": ["id"] + "attribute": [ + "id" + ] } ] } diff --git a/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfstate.json b/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfstate.json index 5c4eb5baf442f..ca16a470ca1bb 100644 --- a/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfstate.json +++ b/provisioner/terraform/testdata/multiple-apps/multiple-apps.tfstate.json @@ -16,11 +16,11 @@ "auth": "token", "dir": null, "env": null, - "id": "04d74496-49a6-4757-b1b2-47e21840067e", + "id": "3d4ee1d5-6413-4dc7-baec-2fa9dbd870ba", "init_script": "", "os": "linux", "startup_script": null, - "token": "1417b29e-da8c-45fb-998d-fbec32069e8d" + "token": "32e082d7-af02-42f1-a5bd-f6adc34220a1" }, "sensitive_values": {} }, @@ -32,10 +32,10 @@ "provider_name": "registry.terraform.io/coder/coder", "schema_version": 0, "values": { - "agent_id": "04d74496-49a6-4757-b1b2-47e21840067e", + "agent_id": "3d4ee1d5-6413-4dc7-baec-2fa9dbd870ba", "command": null, "icon": null, - "id": "0a5869ef-00d9-4a37-9f72-e0b2bf0d266b", + "id": "90e045f9-19f1-4d8a-8021-be61c44ee54f", "name": null, "relative_path": null, "url": null @@ -53,10 +53,10 @@ "provider_name": "registry.terraform.io/coder/coder", "schema_version": 0, "values": { - "agent_id": "04d74496-49a6-4757-b1b2-47e21840067e", + "agent_id": "3d4ee1d5-6413-4dc7-baec-2fa9dbd870ba", "command": null, "icon": null, - "id": "d525e0c1-b494-4911-8b17-8cfb2d248fbf", + "id": "873026f8-3050-4b0b-bebf-41e13e5949bb", "name": null, "relative_path": null, "url": null @@ -74,7 +74,7 @@ "provider_name": "registry.terraform.io/hashicorp/null", "schema_version": 0, "values": { - "id": "5711218402680555438", + "id": "4447693752005094678", "triggers": null }, "sensitive_values": {}, diff --git a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tf b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tf index 9000f2a3345d5..bed06efe7520e 100644 --- a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tf +++ b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tf @@ -17,6 +17,7 @@ resource "null_resource" "about" {} resource "coder_metadata" "about_info" { resource_id = null_resource.about.id hide = true + icon = "/icon/server.svg" item { key = "hello" value = "world" diff --git a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json index f6340ab53a3d8..64ab537cedc1a 100644 --- a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json +++ b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfplan.json @@ -55,7 +55,12 @@ ] }, "sensitive_values": { - "item": [{}, {}, {}, {}] + "item": [ + {}, + {}, + {}, + {} + ] } }, { @@ -81,7 +86,9 @@ "name": "main", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "arch": "amd64", @@ -107,7 +114,9 @@ "name": "about_info", "provider_name": "registry.terraform.io/coder/coder", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "hide": true, @@ -155,7 +164,12 @@ }, "before_sensitive": false, "after_sensitive": { - "item": [{}, {}, {}, {}] + "item": [ + {}, + {}, + {}, + {} + ] } } }, @@ -166,7 +180,9 @@ "name": "about", "provider_name": "registry.terraform.io/hashicorp/null", "change": { - "actions": ["create"], + "actions": [ + "create" + ], "before": null, "after": { "triggers": null @@ -219,6 +235,9 @@ "hide": { "constant_value": true }, + "icon": { + "constant_value": "/icon/server.svg" + }, "item": [ { "key": { @@ -254,7 +273,10 @@ } ], "resource_id": { - "references": ["null_resource.about.id", "null_resource.about"] + "references": [ + "null_resource.about.id", + "null_resource.about" + ] } }, "schema_version": 0 @@ -273,7 +295,9 @@ "relevant_attributes": [ { "resource": "null_resource.about", - "attribute": ["id"] + "attribute": [ + "id" + ] } ] } diff --git a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfstate.json b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfstate.json index 72677f2fcf39a..bc017d9e13ca9 100644 --- a/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfstate.json +++ b/provisioner/terraform/testdata/resource-metadata/resource-metadata.tfstate.json @@ -16,11 +16,11 @@ "auth": "token", "dir": null, "env": null, - "id": "bf761056-4c83-4f36-98e9-fb15c4f3818f", + "id": "09aac2a4-9d8e-43ef-83cb-34657db199f4", "init_script": "", "os": "linux", "startup_script": null, - "token": "fcc945d1-ad27-47e5-9c31-aeb4ffd2dd67" + "token": "a0f6b8af-8edc-447f-b6d2-67a60ecd2a77" }, "sensitive_values": {} }, @@ -34,7 +34,7 @@ "values": { "hide": true, "icon": "/icon/server.svg", - "id": "6f981e35-73a3-4478-8227-fed4643afd71", + "id": "a7f9cf03-de78-4d17-bcbb-21dc34c2d86a", "item": [ { "is_null": false, @@ -61,12 +61,19 @@ "value": "squirrel" } ], - "resource_id": "3184975245680216434" + "resource_id": "6209384655473556868" }, "sensitive_values": { - "item": [{}, {}, {}, {}] + "item": [ + {}, + {}, + {}, + {} + ] }, - "depends_on": ["null_resource.about"] + "depends_on": [ + "null_resource.about" + ] }, { "address": "null_resource.about", @@ -76,7 +83,7 @@ "provider_name": "registry.terraform.io/hashicorp/null", "schema_version": 0, "values": { - "id": "3184975245680216434", + "id": "6209384655473556868", "triggers": null }, "sensitive_values": {} From 87d7de79b3c59976907a55e582ec4fbeffe37475 Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Tue, 13 Sep 2022 14:01:42 +0000 Subject: [PATCH 10/13] Update FE to use custom icons --- .../Resources/ResourceAvatar.stories.tsx | 26 +++++++-- .../components/Resources/ResourceAvatar.tsx | 54 +++++++++---------- .../Resources/ResourceAvatarData.tsx | 2 +- site/static/icon/database.svg | 1 + site/static/icon/folder.svg | 1 + site/static/icon/image.svg | 1 + site/static/icon/memory.svg | 1 + site/static/icon/widgets.svg | 1 + 8 files changed, 51 insertions(+), 36 deletions(-) create mode 100644 site/static/icon/database.svg create mode 100644 site/static/icon/folder.svg create mode 100644 site/static/icon/image.svg create mode 100644 site/static/icon/memory.svg create mode 100644 site/static/icon/widgets.svg diff --git a/site/src/components/Resources/ResourceAvatar.stories.tsx b/site/src/components/Resources/ResourceAvatar.stories.tsx index ee6ba30f79b34..925c87a7c0c14 100644 --- a/site/src/components/Resources/ResourceAvatar.stories.tsx +++ b/site/src/components/Resources/ResourceAvatar.stories.tsx @@ -1,4 +1,5 @@ import { Story } from "@storybook/react" +import { MockWorkspaceResource } from "testHelpers/entities" import { ResourceAvatar, ResourceAvatarProps } from "./ResourceAvatar" export default { @@ -10,25 +11,40 @@ const Template: Story = (args) => { - return -} - -// NOTE@jsjoeio, @BrunoQuaresma +// NOTE @jsjoeio, @BrunoQuaresma // These resources (i.e. docker_image, kubernetes_deployment) map to Terraform // resource types. These are the most used ones and are based on user usage. // We may want to update from time-to-time. -const iconByResource: Record = { - docker_volume: FolderIcon, - docker_container: AdjustedMemoryIcon, - docker_image: ImageIcon, - kubernetes_persistent_volume_claim: FolderIcon, - kubernetes_pod: AdjustedMemoryIcon, - google_compute_disk: FolderIcon, - google_compute_instance: AdjustedMemoryIcon, - aws_instance: AdjustedMemoryIcon, - kubernetes_deployment: AdjustedMemoryIcon, - null_resource: WidgetsIcon, +const iconPathByResource: Record = { + docker_volume: "/icon/folder.svg", + docker_container: "/icon/memory.svg", + docker_image: "/icon/image.svg", + kubernetes_persistent_volume_claim: "/icon/folder.svg", + kubernetes_pod: "/icon/memory.svg", + google_compute_disk: "/icon/folder.svg", + google_compute_instance: "/icon/memory.svg", + aws_instance: "/icon/memory.svg", + kubernetes_deployment: "/icon/memory.svg", + null_resource: "/icon/widgets.svg", } -export type ResourceAvatarProps = { type: WorkspaceResource["type"] } +export type ResourceAvatarProps = { resource: WorkspaceResource } -export const ResourceAvatar: React.FC = ({ type }) => { - const IconComponent = iconByResource[type] ?? WidgetsIcon +export const ResourceAvatar: React.FC = ({ resource }) => { + const hasIcon = resource.icon && resource.icon !== "" + const avatarSrc = hasIcon + ? resource.icon + : iconPathByResource[resource.type] ?? iconPathByResource["null_resource"] const styles = useStyles() - return ( - - - - ) + return } const useStyles = makeStyles((theme) => ({ resourceAvatar: { color: theme.palette.info.contrastText, backgroundColor: theme.palette.info.main, + + "& img": { + width: 20, + height: 20, + }, }, })) diff --git a/site/src/components/Resources/ResourceAvatarData.tsx b/site/src/components/Resources/ResourceAvatarData.tsx index 14e2bac8006aa..4755cc22c52a2 100644 --- a/site/src/components/Resources/ResourceAvatarData.tsx +++ b/site/src/components/Resources/ResourceAvatarData.tsx @@ -49,7 +49,7 @@ export const ResourceAvatarData: FC = ({ resource }) => return (
- +
diff --git a/site/static/icon/database.svg b/site/static/icon/database.svg new file mode 100644 index 0000000000000..f17b64163fb50 --- /dev/null +++ b/site/static/icon/database.svg @@ -0,0 +1 @@ + diff --git a/site/static/icon/folder.svg b/site/static/icon/folder.svg new file mode 100644 index 0000000000000..b718dea59df2f --- /dev/null +++ b/site/static/icon/folder.svg @@ -0,0 +1 @@ + diff --git a/site/static/icon/image.svg b/site/static/icon/image.svg new file mode 100644 index 0000000000000..97a042f331ba9 --- /dev/null +++ b/site/static/icon/image.svg @@ -0,0 +1 @@ + diff --git a/site/static/icon/memory.svg b/site/static/icon/memory.svg new file mode 100644 index 0000000000000..7e13668312667 --- /dev/null +++ b/site/static/icon/memory.svg @@ -0,0 +1 @@ + diff --git a/site/static/icon/widgets.svg b/site/static/icon/widgets.svg new file mode 100644 index 0000000000000..dda5a6ed5b092 --- /dev/null +++ b/site/static/icon/widgets.svg @@ -0,0 +1 @@ + From 47bb3919b5b4b512cbb5791df57cca1ae02d6cb5 Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Tue, 13 Sep 2022 14:09:30 +0000 Subject: [PATCH 11/13] Fix migrations --- ...urce_icon.down.sql => 000049_workspace_resource_icon.down.sql} | 0 ...resource_icon.up.sql => 000049_workspace_resource_icon.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename coderd/database/migrations/{000048_workspace_resource_icon.down.sql => 000049_workspace_resource_icon.down.sql} (100%) rename coderd/database/migrations/{000048_workspace_resource_icon.up.sql => 000049_workspace_resource_icon.up.sql} (100%) diff --git a/coderd/database/migrations/000048_workspace_resource_icon.down.sql b/coderd/database/migrations/000049_workspace_resource_icon.down.sql similarity index 100% rename from coderd/database/migrations/000048_workspace_resource_icon.down.sql rename to coderd/database/migrations/000049_workspace_resource_icon.down.sql diff --git a/coderd/database/migrations/000048_workspace_resource_icon.up.sql b/coderd/database/migrations/000049_workspace_resource_icon.up.sql similarity index 100% rename from coderd/database/migrations/000048_workspace_resource_icon.up.sql rename to coderd/database/migrations/000049_workspace_resource_icon.up.sql From e5792facf21053d36dc1873a5542bdf97e56ffd5 Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Tue, 13 Sep 2022 14:17:58 +0000 Subject: [PATCH 12/13] Fix eslint error --- site/src/components/Resources/ResourceAvatar.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/site/src/components/Resources/ResourceAvatar.tsx b/site/src/components/Resources/ResourceAvatar.tsx index ce5f70edbaae5..8f5618ef14743 100644 --- a/site/src/components/Resources/ResourceAvatar.tsx +++ b/site/src/components/Resources/ResourceAvatar.tsx @@ -26,7 +26,9 @@ export const ResourceAvatar: React.FC = ({ resource }) => { const hasIcon = resource.icon && resource.icon !== "" const avatarSrc = hasIcon ? resource.icon - : iconPathByResource[resource.type] ?? iconPathByResource["null_resource"] + : // resource.type is dynamic so iconPathByResource[resource.type] can be null + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + iconPathByResource[resource.type] ?? iconPathByResource["null_resource"] const styles = useStyles() return From 086f2651dc7a1630a3b281e7a404ea1c45da85cf Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Tue, 13 Sep 2022 14:19:07 +0000 Subject: [PATCH 13/13] Fix template resources table --- .../TemplateResourcesTable/TemplateResourcesTable.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/src/components/TemplateResourcesTable/TemplateResourcesTable.tsx b/site/src/components/TemplateResourcesTable/TemplateResourcesTable.tsx index 140d0a255d193..ef50ebb396c71 100644 --- a/site/src/components/TemplateResourcesTable/TemplateResourcesTable.tsx +++ b/site/src/components/TemplateResourcesTable/TemplateResourcesTable.tsx @@ -61,7 +61,7 @@ export const TemplateResourcesTable: FC} + avatar={} /> @@ -79,7 +79,7 @@ export const TemplateResourcesTable: FC} + avatar={} /> )}