Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Show custom resource icons#4020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 14 commits intomainfrombq/3487
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
14 commits
Select commitHold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionscoderd/database/databasefake/databasefake.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1801,6 +1801,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
Expand Down
3 changes: 2 additions & 1 deletioncoderd/database/dump.sql
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
ALTER TABLE workspace_resources
DROP COLUMN icon;
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
ALTER TABLE workspace_resources
ADD COLUMN icon VARCHAR(256) NOT NULL DEFAULT ''
1 change: 1 addition & 0 deletionscoderd/database/models.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

16 changes: 11 additions & 5 deletionscoderd/database/queries.sql.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

4 changes: 2 additions & 2 deletionscoderd/database/queries/workspaceresources.sql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
1 change: 1 addition & 0 deletionscoderd/provisionerdaemons.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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)
Expand Down
1 change: 1 addition & 0 deletionscoderd/workspacebuilds.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -707,6 +707,7 @@ func convertWorkspaceResource(resource database.WorkspaceResource, agents []code
Type: resource.Type,
Name: resource.Name,
Hide: resource.Hide,
Icon: resource.Icon,
Agents: agents,
Metadata: convertedMetadata,
}
Expand Down
5 changes: 4 additions & 1 deletioncoderd/workspaceresources_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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",
Expand DownExpand Up@@ -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)
// Ensureit's sorted alphabetically!
// Ensureagents 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) {
Expand Down
1 change: 1 addition & 0 deletionscodersdk/workspaceresources.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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"`
}
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/aws-linux/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/aws-windows/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/azure-linux/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
azurerm = {
source = "hashicorp/azurerm"
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/do-linux/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
digitalocean = {
source = "digitalocean/digitalocean"
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/docker-code-server/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
docker = {
source = "kreuzwerker/docker"
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/docker-image-builds/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
docker = {
source = "kreuzwerker/docker"
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/docker-with-dotfiles/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
docker = {
source = "kreuzwerker/docker"
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/docker/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
docker = {
source = "kreuzwerker/docker"
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/ecs-container/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,7 @@ terraform {
}
coder = {
source = "coder/coder"
version = "~>0.4.9"
version = "0.4.11"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/gcp-linux/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
google = {
source = "hashicorp/google"
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/gcp-vm-container/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
google = {
source = "hashicorp/google"
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/gcp-windows/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
google = {
source = "hashicorp/google"
Expand Down
2 changes: 1 addition & 1 deletionexamples/templates/kubernetes/main.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.9"
version = "0.4.11"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
4 changes: 4 additions & 0 deletionsprovisioner/terraform/resources.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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"`
}

Expand DownExpand Up@@ -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
Expand DownExpand Up@@ -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{
Expand DownExpand Up@@ -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],
})
}
Expand Down
1 change: 1 addition & 0 deletionsprovisioner/terraform/resources_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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",
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.10"
version = "0.4.11"
}
}
}
Expand Down
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.4.10"
version = "0.4.11"
}
}
}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp