From a240bc8cfe9fdec3d921cf7a881f166f7f71779a Mon Sep 17 00:00:00 2001 From: BrunoQuaresma Date: Fri, 7 Feb 2025 19:08:10 +0000 Subject: [PATCH 1/3] refactor: return template_icon and make metadata required --- coderd/apidoc/docs.go | 3 ++ coderd/apidoc/swagger.json | 3 ++ coderd/database/queries.sql.go | 4 +++ coderd/database/queries/provisionerjobs.sql | 2 ++ coderd/provisionerjobs.go | 3 +- coderd/provisionerjobs_test.go | 6 ++-- codersdk/provisionerdaemons.go | 37 +++++++++++---------- docs/reference/api/builds.md | 6 ++++ docs/reference/api/organizations.md | 3 ++ docs/reference/api/schemas.md | 7 ++++ docs/reference/api/templates.md | 11 ++++++ docs/reference/api/workspaces.md | 6 ++++ docs/reference/cli/provisioner_jobs_list.md | 8 ++--- site/src/api/typesGenerated.ts | 3 +- 14 files changed, 76 insertions(+), 26 deletions(-) diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index 98c694ab4175d..3aa9865d2964a 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -13229,6 +13229,9 @@ const docTemplate = `{ "template_display_name": { "type": "string" }, + "template_icon": { + "type": "string" + }, "template_id": { "type": "string", "format": "uuid" diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index afe36a8389899..08294266531e5 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -11950,6 +11950,9 @@ "template_display_name": { "type": "string" }, + "template_icon": { + "type": "string" + }, "template_id": { "type": "string", "format": "uuid" diff --git a/coderd/database/queries.sql.go b/coderd/database/queries.sql.go index 7778be9d777aa..7653094a22e2b 100644 --- a/coderd/database/queries.sql.go +++ b/coderd/database/queries.sql.go @@ -6271,6 +6271,7 @@ SELECT t.id AS template_id, COALESCE(t.name, '') AS template_name, COALESCE(t.display_name, '') AS template_display_name, + COALESCE(t.icon, '') AS template_icon, w.id AS workspace_id, COALESCE(w.name, '') AS workspace_name FROM @@ -6300,6 +6301,7 @@ GROUP BY t.id, t.name, t.display_name, + t.icon, w.id, w.name ORDER BY @@ -6324,6 +6326,7 @@ type GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisionerRow TemplateID uuid.NullUUID `db:"template_id" json:"template_id"` TemplateName string `db:"template_name" json:"template_name"` TemplateDisplayName string `db:"template_display_name" json:"template_display_name"` + TemplateIcon string `db:"template_icon" json:"template_icon"` WorkspaceID uuid.NullUUID `db:"workspace_id" json:"workspace_id"` WorkspaceName string `db:"workspace_name" json:"workspace_name"` } @@ -6369,6 +6372,7 @@ func (q *sqlQuerier) GetProvisionerJobsByOrganizationAndStatusWithQueuePositionA &i.TemplateID, &i.TemplateName, &i.TemplateDisplayName, + &i.TemplateIcon, &i.WorkspaceID, &i.WorkspaceName, ); err != nil { diff --git a/coderd/database/queries/provisionerjobs.sql b/coderd/database/queries/provisionerjobs.sql index bac03f1b4253e..fedcc630a1687 100644 --- a/coderd/database/queries/provisionerjobs.sql +++ b/coderd/database/queries/provisionerjobs.sql @@ -136,6 +136,7 @@ SELECT t.id AS template_id, COALESCE(t.name, '') AS template_name, COALESCE(t.display_name, '') AS template_display_name, + COALESCE(t.icon, '') AS template_icon, w.id AS workspace_id, COALESCE(w.name, '') AS workspace_name FROM @@ -165,6 +166,7 @@ GROUP BY t.id, t.name, t.display_name, + t.icon, w.id, w.name ORDER BY diff --git a/coderd/provisionerjobs.go b/coderd/provisionerjobs.go index b8eccdb9c4d3c..492aa50eeb7f9 100644 --- a/coderd/provisionerjobs.go +++ b/coderd/provisionerjobs.go @@ -388,11 +388,12 @@ func convertProvisionerJobWithQueuePosition(pj database.GetProvisionerJobsByOrga QueueSize: pj.QueueSize, }) job.AvailableWorkers = pj.AvailableWorkers - job.Metadata = &codersdk.ProvisionerJobMetadata{ + job.Metadata = codersdk.ProvisionerJobMetadata{ TemplateVersionName: pj.TemplateVersionName, TemplateID: pj.TemplateID.UUID, TemplateName: pj.TemplateName, TemplateDisplayName: pj.TemplateDisplayName, + TemplateIcon: pj.TemplateIcon, WorkspaceName: pj.WorkspaceName, } if pj.WorkspaceID.Valid { diff --git a/coderd/provisionerjobs_test.go b/coderd/provisionerjobs_test.go index ba5f31e6894a3..1c832d6825c6f 100644 --- a/coderd/provisionerjobs_test.go +++ b/coderd/provisionerjobs_test.go @@ -84,11 +84,12 @@ func TestProvisionerJobs(t *testing.T) { require.Equal(t, job.ID, job2.ID) // Verify that job metadata is correct. - assert.Equal(t, job2.Metadata, &codersdk.ProvisionerJobMetadata{ + assert.Equal(t, job2.Metadata, codersdk.ProvisionerJobMetadata{ TemplateVersionName: version.Name, TemplateID: template.ID, TemplateName: template.Name, TemplateDisplayName: template.DisplayName, + TemplateIcon: template.Icon, WorkspaceID: &w.ID, WorkspaceName: w.Name, }) @@ -105,11 +106,12 @@ func TestProvisionerJobs(t *testing.T) { require.Equal(t, version.Job.ID, job2.ID) // Verify that job metadata is correct. - assert.Equal(t, job2.Metadata, &codersdk.ProvisionerJobMetadata{ + assert.Equal(t, job2.Metadata, codersdk.ProvisionerJobMetadata{ TemplateVersionName: version.Name, TemplateID: template.ID, TemplateName: template.Name, TemplateDisplayName: template.DisplayName, + TemplateIcon: template.Icon, }) }) }) diff --git a/codersdk/provisionerdaemons.go b/codersdk/provisionerdaemons.go index 5a93ba9fcaae4..9c8f131cca8a6 100644 --- a/codersdk/provisionerdaemons.go +++ b/codersdk/provisionerdaemons.go @@ -137,6 +137,7 @@ type ProvisionerJobMetadata struct { TemplateID uuid.UUID `json:"template_id" format:"uuid" table:"template id"` TemplateName string `json:"template_name" table:"template name"` TemplateDisplayName string `json:"template_display_name" table:"template display name"` + TemplateIcon string `json:"template_icon" table:"template icon"` WorkspaceID *uuid.UUID `json:"workspace_id,omitempty" format:"uuid" table:"workspace id"` WorkspaceName string `json:"workspace_name,omitempty" table:"workspace name"` } @@ -165,24 +166,24 @@ func JobIsMissingParameterErrorCode(code JobErrorCode) bool { // ProvisionerJob describes the job executed by the provisioning daemon. type ProvisionerJob struct { - ID uuid.UUID `json:"id" format:"uuid" table:"id"` - CreatedAt time.Time `json:"created_at" format:"date-time" table:"created at"` - StartedAt *time.Time `json:"started_at,omitempty" format:"date-time" table:"started at"` - CompletedAt *time.Time `json:"completed_at,omitempty" format:"date-time" table:"completed at"` - CanceledAt *time.Time `json:"canceled_at,omitempty" format:"date-time" table:"canceled at"` - Error string `json:"error,omitempty" table:"error"` - ErrorCode JobErrorCode `json:"error_code,omitempty" enums:"REQUIRED_TEMPLATE_VARIABLES" table:"error code"` - Status ProvisionerJobStatus `json:"status" enums:"pending,running,succeeded,canceling,canceled,failed" table:"status"` - WorkerID *uuid.UUID `json:"worker_id,omitempty" format:"uuid" table:"worker id"` - FileID uuid.UUID `json:"file_id" format:"uuid" table:"file id"` - Tags map[string]string `json:"tags" table:"tags"` - QueuePosition int `json:"queue_position" table:"queue position"` - QueueSize int `json:"queue_size" table:"queue size"` - OrganizationID uuid.UUID `json:"organization_id" format:"uuid" table:"organization id"` - Input ProvisionerJobInput `json:"input" table:"input,recursive_inline"` - Type ProvisionerJobType `json:"type" table:"type"` - AvailableWorkers []uuid.UUID `json:"available_workers,omitempty" format:"uuid" table:"available workers"` - Metadata *ProvisionerJobMetadata `json:"metadata,omitempty" table:"metadata,recursive_inline"` + ID uuid.UUID `json:"id" format:"uuid" table:"id"` + CreatedAt time.Time `json:"created_at" format:"date-time" table:"created at"` + StartedAt *time.Time `json:"started_at,omitempty" format:"date-time" table:"started at"` + CompletedAt *time.Time `json:"completed_at,omitempty" format:"date-time" table:"completed at"` + CanceledAt *time.Time `json:"canceled_at,omitempty" format:"date-time" table:"canceled at"` + Error string `json:"error,omitempty" table:"error"` + ErrorCode JobErrorCode `json:"error_code,omitempty" enums:"REQUIRED_TEMPLATE_VARIABLES" table:"error code"` + Status ProvisionerJobStatus `json:"status" enums:"pending,running,succeeded,canceling,canceled,failed" table:"status"` + WorkerID *uuid.UUID `json:"worker_id,omitempty" format:"uuid" table:"worker id"` + FileID uuid.UUID `json:"file_id" format:"uuid" table:"file id"` + Tags map[string]string `json:"tags" table:"tags"` + QueuePosition int `json:"queue_position" table:"queue position"` + QueueSize int `json:"queue_size" table:"queue size"` + OrganizationID uuid.UUID `json:"organization_id" format:"uuid" table:"organization id"` + Input ProvisionerJobInput `json:"input" table:"input,recursive_inline"` + Type ProvisionerJobType `json:"type" table:"type"` + AvailableWorkers []uuid.UUID `json:"available_workers,omitempty" format:"uuid" table:"available workers"` + Metadata ProvisionerJobMetadata `json:"metadata" table:"metadata,recursive_inline"` } // ProvisionerJobLog represents the provisioner log entry annotated with source and level. diff --git a/docs/reference/api/builds.md b/docs/reference/api/builds.md index 73fd35bb4f270..26f6df4a55b73 100644 --- a/docs/reference/api/builds.md +++ b/docs/reference/api/builds.md @@ -52,6 +52,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/workspace/{workspacenam }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -265,6 +266,7 @@ curl -X GET http://coder-server:8080/api/v2/workspacebuilds/{workspacebuild} \ }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -920,6 +922,7 @@ curl -X GET http://coder-server:8080/api/v2/workspacebuilds/{workspacebuild}/sta }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -1206,6 +1209,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace}/builds \ }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -1397,6 +1401,7 @@ Status Code **200** | `»»» workspace_build_id` | string(uuid) | false | | | | `»» metadata` | [codersdk.ProvisionerJobMetadata](schemas.md#codersdkprovisionerjobmetadata) | false | | | | `»»» template_display_name` | string | false | | | +| `»»» template_icon` | string | false | | | | `»»» template_id` | string(uuid) | false | | | | `»»» template_name` | string | false | | | | `»»» template_version_name` | string | false | | | @@ -1646,6 +1651,7 @@ curl -X POST http://coder-server:8080/api/v2/workspaces/{workspace}/builds \ }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", diff --git a/docs/reference/api/organizations.md b/docs/reference/api/organizations.md index 52442b6258559..08fceb2e29d82 100644 --- a/docs/reference/api/organizations.md +++ b/docs/reference/api/organizations.md @@ -407,6 +407,7 @@ curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/provisi }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -455,6 +456,7 @@ Status Code **200** | `»» workspace_build_id` | string(uuid) | false | | | | `» metadata` | [codersdk.ProvisionerJobMetadata](schemas.md#codersdkprovisionerjobmetadata) | false | | | | `»» template_display_name` | string | false | | | +| `»» template_icon` | string | false | | | | `»» template_id` | string(uuid) | false | | | | `»» template_name` | string | false | | | | `»» template_version_name` | string | false | | | @@ -530,6 +532,7 @@ curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/provisi }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", diff --git a/docs/reference/api/schemas.md b/docs/reference/api/schemas.md index 082b3f3a1f19f..8092ff2dcd3da 100644 --- a/docs/reference/api/schemas.md +++ b/docs/reference/api/schemas.md @@ -4604,6 +4604,7 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -4717,6 +4718,7 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith ```json { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -4730,6 +4732,7 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith | Name | Type | Required | Restrictions | Description | |-------------------------|--------|----------|--------------|-------------| | `template_display_name` | string | false | | | +| `template_icon` | string | false | | | | `template_id` | string | false | | | | `template_name` | string | false | | | | `template_version_name` | string | false | | | @@ -6136,6 +6139,7 @@ Restarts will only happen on weekdays in this list on weeks which line up with W }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -7209,6 +7213,7 @@ If the schedule is empty, the user will be updated to use the default schedule.| }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -7959,6 +7964,7 @@ If the schedule is empty, the user will be updated to use the default schedule.| }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -8631,6 +8637,7 @@ If the schedule is empty, the user will be updated to use the default schedule.| }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", diff --git a/docs/reference/api/templates.md b/docs/reference/api/templates.md index 49a4b3b45c196..9a2a35f40f182 100644 --- a/docs/reference/api/templates.md +++ b/docs/reference/api/templates.md @@ -464,6 +464,7 @@ curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/templat }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -560,6 +561,7 @@ curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/templat }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -680,6 +682,7 @@ curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/templa }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -1228,6 +1231,7 @@ curl -X GET http://coder-server:8080/api/v2/templates/{template}/versions \ }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -1299,6 +1303,7 @@ Status Code **200** | `»»» workspace_build_id` | string(uuid) | false | | | | `»» metadata` | [codersdk.ProvisionerJobMetadata](schemas.md#codersdkprovisionerjobmetadata) | false | | | | `»»» template_display_name` | string | false | | | +| `»»» template_icon` | string | false | | | | `»»» template_id` | string(uuid) | false | | | | `»»» template_name` | string | false | | | | `»»» template_version_name` | string | false | | | @@ -1503,6 +1508,7 @@ curl -X GET http://coder-server:8080/api/v2/templates/{template}/versions/{templ }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -1574,6 +1580,7 @@ Status Code **200** | `»»» workspace_build_id` | string(uuid) | false | | | | `»» metadata` | [codersdk.ProvisionerJobMetadata](schemas.md#codersdkprovisionerjobmetadata) | false | | | | `»»» template_display_name` | string | false | | | +| `»»» template_icon` | string | false | | | | `»»» template_id` | string(uuid) | false | | | | `»»» template_name` | string | false | | | | `»»» template_version_name` | string | false | | | @@ -1668,6 +1675,7 @@ curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion} \ }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -1773,6 +1781,7 @@ curl -X PATCH http://coder-server:8080/api/v2/templateversions/{templateversion} }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -1968,6 +1977,7 @@ curl -X POST http://coder-server:8080/api/v2/templateversions/{templateversion}/ }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -2039,6 +2049,7 @@ curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/d }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", diff --git a/docs/reference/api/workspaces.md b/docs/reference/api/workspaces.md index 680dec178bf4e..7264b6dbb3939 100644 --- a/docs/reference/api/workspaces.md +++ b/docs/reference/api/workspaces.md @@ -93,6 +93,7 @@ of the template will be used. }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -342,6 +343,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/workspace/{workspacenam }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -615,6 +617,7 @@ of the template will be used. }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -867,6 +870,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces \ }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -1113,6 +1117,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace} \ }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", @@ -1478,6 +1483,7 @@ curl -X PUT http://coder-server:8080/api/v2/workspaces/{workspace}/dormant \ }, "metadata": { "template_display_name": "string", + "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", diff --git a/docs/reference/cli/provisioner_jobs_list.md b/docs/reference/cli/provisioner_jobs_list.md index ed16448459d7b..2cd40049e2400 100644 --- a/docs/reference/cli/provisioner_jobs_list.md +++ b/docs/reference/cli/provisioner_jobs_list.md @@ -45,10 +45,10 @@ Select which organization (uuid or name) to use. ### -c, --column -| | | -|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Type | [id\|created at\|started at\|completed at\|canceled at\|error\|error code\|status\|worker id\|file id\|tags\|queue position\|queue size\|organization id\|template version id\|workspace build id\|type\|available workers\|template version name\|template id\|template name\|template display name\|workspace id\|workspace name\|organization\|queue] | -| Default | created at,id,organization,status,type,queue,tags | +| | | +|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Type | [id\|created at\|started at\|completed at\|canceled at\|error\|error code\|status\|worker id\|file id\|tags\|queue position\|queue size\|organization id\|template version id\|workspace build id\|type\|available workers\|template version name\|template id\|template name\|template display name\|template icon\|workspace id\|workspace name\|organization\|queue] | +| Default | created at,id,organization,status,type,queue,tags | Columns to display in table output. diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 2e7732c525c42..764e0ec4d8d7d 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -1638,7 +1638,7 @@ export interface ProvisionerJob { readonly input: ProvisionerJobInput; readonly type: ProvisionerJobType; readonly available_workers?: readonly string[]; - readonly metadata?: ProvisionerJobMetadata; + readonly metadata: ProvisionerJobMetadata; } // From codersdk/provisionerdaemons.go @@ -1664,6 +1664,7 @@ export interface ProvisionerJobMetadata { readonly template_id: string; readonly template_name: string; readonly template_display_name: string; + readonly template_icon: string; readonly workspace_id?: string; readonly workspace_name?: string; } From 75da5139e7ae40193e7ff1dfccfb06165b781efe Mon Sep 17 00:00:00 2001 From: BrunoQuaresma Date: Fri, 7 Feb 2025 19:21:30 +0000 Subject: [PATCH 2/3] Update golden files --- cli/testdata/coder_list_--output_json.golden | 9 ++++++++- cli/testdata/coder_provisioner_jobs_list_--help.golden | 2 +- .../coder_provisioner_jobs_list_--output_json.golden | 4 +++- .../testdata/coder_provisioner_jobs_list_--help.golden | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cli/testdata/coder_list_--output_json.golden b/cli/testdata/coder_list_--output_json.golden index 0ef065dd86a81..4b308a9468b6f 100644 --- a/cli/testdata/coder_list_--output_json.golden +++ b/cli/testdata/coder_list_--output_json.golden @@ -48,7 +48,14 @@ "input": { "workspace_build_id": "========[workspace build ID]========" }, - "type": "workspace_build" + "type": "workspace_build", + "metadata": { + "template_version_name": "", + "template_id": "00000000-0000-0000-0000-000000000000", + "template_name": "", + "template_display_name": "", + "template_icon": "" + } }, "reason": "initiator", "resources": [], diff --git a/cli/testdata/coder_provisioner_jobs_list_--help.golden b/cli/testdata/coder_provisioner_jobs_list_--help.golden index bd29b7560ea6a..d6eb9a7681a07 100644 --- a/cli/testdata/coder_provisioner_jobs_list_--help.golden +++ b/cli/testdata/coder_provisioner_jobs_list_--help.golden @@ -11,7 +11,7 @@ OPTIONS: -O, --org string, $CODER_ORGANIZATION Select which organization (uuid or name) to use. - -c, --column [id|created at|started at|completed at|canceled at|error|error code|status|worker id|file id|tags|queue position|queue size|organization id|template version id|workspace build id|type|available workers|template version name|template id|template name|template display name|workspace id|workspace name|organization|queue] (default: created at,id,organization,status,type,queue,tags) + -c, --column [id|created at|started at|completed at|canceled at|error|error code|status|worker id|file id|tags|queue position|queue size|organization id|template version id|workspace build id|type|available workers|template version name|template id|template name|template display name|template icon|workspace id|workspace name|organization|queue] (default: created at,id,organization,status,type,queue,tags) Columns to display in table output. -l, --limit int, $CODER_PROVISIONER_JOB_LIST_LIMIT (default: 50) diff --git a/cli/testdata/coder_provisioner_jobs_list_--output_json.golden b/cli/testdata/coder_provisioner_jobs_list_--output_json.golden index 9e1f56ba7bf17..d18e07121f653 100644 --- a/cli/testdata/coder_provisioner_jobs_list_--output_json.golden +++ b/cli/testdata/coder_provisioner_jobs_list_--output_json.golden @@ -22,7 +22,8 @@ "template_version_name": "===========[version name]===========", "template_id": "===========[template ID]============", "template_name": "test-template", - "template_display_name": "" + "template_display_name": "", + "template_icon": "" }, "organization_name": "Coder" }, @@ -50,6 +51,7 @@ "template_id": "===========[template ID]============", "template_name": "test-template", "template_display_name": "", + "template_icon": "", "workspace_id": "===========[workspace ID]===========", "workspace_name": "test-workspace" }, diff --git a/enterprise/cli/testdata/coder_provisioner_jobs_list_--help.golden b/enterprise/cli/testdata/coder_provisioner_jobs_list_--help.golden index bd29b7560ea6a..d6eb9a7681a07 100644 --- a/enterprise/cli/testdata/coder_provisioner_jobs_list_--help.golden +++ b/enterprise/cli/testdata/coder_provisioner_jobs_list_--help.golden @@ -11,7 +11,7 @@ OPTIONS: -O, --org string, $CODER_ORGANIZATION Select which organization (uuid or name) to use. - -c, --column [id|created at|started at|completed at|canceled at|error|error code|status|worker id|file id|tags|queue position|queue size|organization id|template version id|workspace build id|type|available workers|template version name|template id|template name|template display name|workspace id|workspace name|organization|queue] (default: created at,id,organization,status,type,queue,tags) + -c, --column [id|created at|started at|completed at|canceled at|error|error code|status|worker id|file id|tags|queue position|queue size|organization id|template version id|workspace build id|type|available workers|template version name|template id|template name|template display name|template icon|workspace id|workspace name|organization|queue] (default: created at,id,organization,status,type,queue,tags) Columns to display in table output. -l, --limit int, $CODER_PROVISIONER_JOB_LIST_LIMIT (default: 50) From c42023456d4e4d63b6c6ef3a34634a4fcddecaba Mon Sep 17 00:00:00 2001 From: BrunoQuaresma Date: Mon, 10 Feb 2025 12:44:18 +0000 Subject: [PATCH 3/3] update entities --- site/src/testHelpers/entities.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/site/src/testHelpers/entities.ts b/site/src/testHelpers/entities.ts index ee2158394c7eb..a607df6bb87c9 100644 --- a/site/src/testHelpers/entities.ts +++ b/site/src/testHelpers/entities.ts @@ -660,6 +660,15 @@ export const MockProvisionerJob: TypesGen.ProvisionerJob = { }, organization_id: MockOrganization.id, type: "template_version_dry_run", + metadata: { + workspace_id: "test-workspace", + template_display_name: "Test Template", + template_icon: "/icon/code.svg", + template_id: "test-template", + template_name: "test-template", + template_version_name: "test-version", + workspace_name: "test-workspace", + }, }; export const MockFailedProvisionerJob: TypesGen.ProvisionerJob = {