diff --git a/cli/testdata/coder_list_--output_json.golden b/cli/testdata/coder_list_--output_json.golden index d8e6a306cabcf..c37c89c4efe2a 100644 --- a/cli/testdata/coder_list_--output_json.golden +++ b/cli/testdata/coder_list_--output_json.golden @@ -23,7 +23,7 @@ "workspace_id": "===========[workspace ID]===========", "workspace_name": "test-workspace", "workspace_owner_id": "==========[first user ID]===========", - "workspace_owner_username": "testuser", + "workspace_owner_name": "testuser", "template_version_id": "============[version ID]============", "template_version_name": "===========[version name]===========", "build_number": 1, diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index 5e8b8d6afa89e..16a51d187a486 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -17865,9 +17865,7 @@ const docTemplate = `{ "format": "uuid" }, "workspace_owner_name": { - "type": "string" - }, - "workspace_owner_username": { + "description": "WorkspaceOwnerName is the username of the owner of the workspace.", "type": "string" } } diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index ef32dcd24f375..986862df59a09 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -16315,9 +16315,7 @@ "format": "uuid" }, "workspace_owner_name": { - "type": "string" - }, - "workspace_owner_username": { + "description": "WorkspaceOwnerName is the username of the owner of the workspace.", "type": "string" } } diff --git a/coderd/workspacebuilds.go b/coderd/workspacebuilds.go index 55598abe726b3..c01004653f86e 100644 --- a/coderd/workspacebuilds.go +++ b/coderd/workspacebuilds.go @@ -1098,8 +1098,7 @@ func (api *API) convertWorkspaceBuild( CreatedAt: build.CreatedAt, UpdatedAt: build.UpdatedAt, WorkspaceOwnerID: workspace.OwnerID, - WorkspaceOwnerName: workspace.OwnerName, - WorkspaceOwnerUsername: workspace.OwnerUsername, + WorkspaceOwnerName: workspace.OwnerUsername, WorkspaceOwnerAvatarURL: workspace.OwnerAvatarUrl, WorkspaceID: build.WorkspaceID, WorkspaceName: workspace.Name, diff --git a/coderd/workspacebuilds_test.go b/coderd/workspacebuilds_test.go index c121523c4da4a..ac33c9e92c4f7 100644 --- a/coderd/workspacebuilds_test.go +++ b/coderd/workspacebuilds_test.go @@ -79,8 +79,7 @@ func TestWorkspaceBuild(t *testing.T) { }, testutil.WaitShort, testutil.IntervalFast) wb, err := client.WorkspaceBuild(testutil.Context(t, testutil.WaitShort), workspace.LatestBuild.ID) require.NoError(t, err) - require.Equal(t, up.Username, wb.WorkspaceOwnerUsername) - require.Equal(t, up.Name, wb.WorkspaceOwnerName) + require.Equal(t, up.Username, wb.WorkspaceOwnerName) require.Equal(t, up.AvatarURL, wb.WorkspaceOwnerAvatarURL) } diff --git a/codersdk/workspacebuilds.go b/codersdk/workspacebuilds.go index dd7af027ae701..d3372b272548f 100644 --- a/codersdk/workspacebuilds.go +++ b/codersdk/workspacebuilds.go @@ -51,14 +51,14 @@ const ( // WorkspaceBuild is an at-point representation of a workspace state. // BuildNumbers start at 1 and increase by 1 for each subsequent build type WorkspaceBuild struct { - ID uuid.UUID `json:"id" format:"uuid"` - CreatedAt time.Time `json:"created_at" format:"date-time"` - UpdatedAt time.Time `json:"updated_at" format:"date-time"` - WorkspaceID uuid.UUID `json:"workspace_id" format:"uuid"` - WorkspaceName string `json:"workspace_name"` - WorkspaceOwnerID uuid.UUID `json:"workspace_owner_id" format:"uuid"` - WorkspaceOwnerName string `json:"workspace_owner_name,omitempty"` - WorkspaceOwnerUsername string `json:"workspace_owner_username"` + ID uuid.UUID `json:"id" format:"uuid"` + CreatedAt time.Time `json:"created_at" format:"date-time"` + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + WorkspaceID uuid.UUID `json:"workspace_id" format:"uuid"` + WorkspaceName string `json:"workspace_name"` + WorkspaceOwnerID uuid.UUID `json:"workspace_owner_id" format:"uuid"` + // WorkspaceOwnerName is the username of the owner of the workspace. + WorkspaceOwnerName string `json:"workspace_owner_name"` WorkspaceOwnerAvatarURL string `json:"workspace_owner_avatar_url,omitempty"` TemplateVersionID uuid.UUID `json:"template_version_id" format:"uuid"` TemplateVersionName string `json:"template_version_name"` diff --git a/docs/reference/api/builds.md b/docs/reference/api/builds.md index 2d0742737a3ad..9db3fe370a3d2 100644 --- a/docs/reference/api/builds.md +++ b/docs/reference/api/builds.md @@ -225,8 +225,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/workspace/{workspacenam "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" } ``` @@ -461,8 +460,7 @@ curl -X GET http://coder-server:8080/api/v2/workspacebuilds/{workspacebuild} \ "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" } ``` @@ -1176,8 +1174,7 @@ curl -X GET http://coder-server:8080/api/v2/workspacebuilds/{workspacebuild}/sta "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" } ``` @@ -1485,8 +1482,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace}/builds \ "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" } ] ``` @@ -1658,8 +1654,7 @@ Status Code **200** | `» workspace_name` | string | false | | | | `» workspace_owner_avatar_url` | string | false | | | | `» workspace_owner_id` | string(uuid) | false | | | -| `» workspace_owner_name` | string | false | | | -| `» workspace_owner_username` | string | false | | | +| `» workspace_owner_name` | string | false | | Workspace owner name is the username of the owner of the workspace. | #### Enumerated Values @@ -1972,8 +1967,7 @@ curl -X POST http://coder-server:8080/api/v2/workspaces/{workspace}/builds \ "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" } ``` diff --git a/docs/reference/api/schemas.md b/docs/reference/api/schemas.md index 65e3b5f7c8ec8..f8e2152f629be 100644 --- a/docs/reference/api/schemas.md +++ b/docs/reference/api/schemas.md @@ -8422,8 +8422,7 @@ If the schedule is empty, the user will be updated to use the default schedule.| "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" }, "name": "string", "next_start_at": "2019-08-24T14:15:22Z", @@ -9414,39 +9413,37 @@ If the schedule is empty, the user will be updated to use the default schedule.| "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -|------------------------------|-------------------------------------------------------------------|----------|--------------|-------------| -| `build_number` | integer | false | | | -| `created_at` | string | false | | | -| `daily_cost` | integer | false | | | -| `deadline` | string | false | | | -| `id` | string | false | | | -| `initiator_id` | string | false | | | -| `initiator_name` | string | false | | | -| `job` | [codersdk.ProvisionerJob](#codersdkprovisionerjob) | false | | | -| `matched_provisioners` | [codersdk.MatchedProvisioners](#codersdkmatchedprovisioners) | false | | | -| `max_deadline` | string | false | | | -| `reason` | [codersdk.BuildReason](#codersdkbuildreason) | false | | | -| `resources` | array of [codersdk.WorkspaceResource](#codersdkworkspaceresource) | false | | | -| `status` | [codersdk.WorkspaceStatus](#codersdkworkspacestatus) | false | | | -| `template_version_id` | string | false | | | -| `template_version_name` | string | false | | | -| `template_version_preset_id` | string | false | | | -| `transition` | [codersdk.WorkspaceTransition](#codersdkworkspacetransition) | false | | | -| `updated_at` | string | false | | | -| `workspace_id` | string | false | | | -| `workspace_name` | string | false | | | -| `workspace_owner_avatar_url` | string | false | | | -| `workspace_owner_id` | string | false | | | -| `workspace_owner_name` | string | false | | | -| `workspace_owner_username` | string | false | | | + "workspace_owner_name": "string" +} +``` + +### Properties + +| Name | Type | Required | Restrictions | Description | +|------------------------------|-------------------------------------------------------------------|----------|--------------|---------------------------------------------------------------------| +| `build_number` | integer | false | | | +| `created_at` | string | false | | | +| `daily_cost` | integer | false | | | +| `deadline` | string | false | | | +| `id` | string | false | | | +| `initiator_id` | string | false | | | +| `initiator_name` | string | false | | | +| `job` | [codersdk.ProvisionerJob](#codersdkprovisionerjob) | false | | | +| `matched_provisioners` | [codersdk.MatchedProvisioners](#codersdkmatchedprovisioners) | false | | | +| `max_deadline` | string | false | | | +| `reason` | [codersdk.BuildReason](#codersdkbuildreason) | false | | | +| `resources` | array of [codersdk.WorkspaceResource](#codersdkworkspaceresource) | false | | | +| `status` | [codersdk.WorkspaceStatus](#codersdkworkspacestatus) | false | | | +| `template_version_id` | string | false | | | +| `template_version_name` | string | false | | | +| `template_version_preset_id` | string | false | | | +| `transition` | [codersdk.WorkspaceTransition](#codersdkworkspacetransition) | false | | | +| `updated_at` | string | false | | | +| `workspace_id` | string | false | | | +| `workspace_name` | string | false | | | +| `workspace_owner_avatar_url` | string | false | | | +| `workspace_owner_id` | string | false | | | +| `workspace_owner_name` | string | false | | Workspace owner name is the username of the owner of the workspace. | #### Enumerated Values @@ -10125,8 +10122,7 @@ If the schedule is empty, the user will be updated to use the default schedule.| "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" }, "name": "string", "next_start_at": "2019-08-24T14:15:22Z", diff --git a/docs/reference/api/workspaces.md b/docs/reference/api/workspaces.md index 1e73787dfb77e..de6fb8331047d 100644 --- a/docs/reference/api/workspaces.md +++ b/docs/reference/api/workspaces.md @@ -280,8 +280,7 @@ of the template will be used. "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" }, "name": "string", "next_start_at": "2019-08-24T14:15:22Z", @@ -565,8 +564,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/workspace/{workspacenam "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" }, "name": "string", "next_start_at": "2019-08-24T14:15:22Z", @@ -876,8 +874,7 @@ of the template will be used. "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" }, "name": "string", "next_start_at": "2019-08-24T14:15:22Z", @@ -1147,8 +1144,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces \ "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" }, "name": "string", "next_start_at": "2019-08-24T14:15:22Z", @@ -1433,8 +1429,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace} \ "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" }, "name": "string", "next_start_at": "2019-08-24T14:15:22Z", @@ -1834,8 +1829,7 @@ curl -X PUT http://coder-server:8080/api/v2/workspaces/{workspace}/dormant \ "workspace_name": "string", "workspace_owner_avatar_url": "string", "workspace_owner_id": "e7078695-5279-4c86-8774-3ac2367a2fc7", - "workspace_owner_name": "string", - "workspace_owner_username": "string" + "workspace_owner_name": "string" }, "name": "string", "next_start_at": "2019-08-24T14:15:22Z", diff --git a/site/src/api/api.ts b/site/src/api/api.ts index a0f2d487b8603..81931c003c99d 100644 --- a/site/src/api/api.ts +++ b/site/src/api/api.ts @@ -1165,7 +1165,7 @@ class ApiMethods { ) ) { const { job } = await this.getWorkspaceBuildByNumber( - build.workspace_owner_username, + build.workspace_owner_name, build.workspace_name, build.build_number, ); diff --git a/site/src/api/queries/workspaces.ts b/site/src/api/queries/workspaces.ts index 61bc7f0e70c22..6c6a1aa19825c 100644 --- a/site/src/api/queries/workspaces.ts +++ b/site/src/api/queries/workspaces.ts @@ -279,7 +279,7 @@ const updateWorkspaceBuild = async ( queryClient: QueryClient, ) => { const workspaceKey = workspaceByOwnerAndNameKey( - build.workspace_owner_username, + build.workspace_owner_name, build.workspace_name, ); const previousData = queryClient.getQueryData(workspaceKey); diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 8465f3d02be38..9fa6e45fa30da 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -3623,8 +3623,7 @@ export interface WorkspaceBuild { readonly workspace_id: string; readonly workspace_name: string; readonly workspace_owner_id: string; - readonly workspace_owner_name?: string; - readonly workspace_owner_username: string; + readonly workspace_owner_name: string; readonly workspace_owner_avatar_url?: string; readonly template_version_id: string; readonly template_version_name: string; diff --git a/site/src/pages/WorkspaceBuildPage/WorkspaceBuildPageView.tsx b/site/src/pages/WorkspaceBuildPage/WorkspaceBuildPageView.tsx index 09a4676cf6d60..6add701c8b688 100644 --- a/site/src/pages/WorkspaceBuildPage/WorkspaceBuildPageView.tsx +++ b/site/src/pages/WorkspaceBuildPage/WorkspaceBuildPageView.tsx @@ -104,7 +104,7 @@ export const WorkspaceBuildPageView: FC = ({ label="Workspace" value={ {build.workspace_name} @@ -158,7 +158,7 @@ export const WorkspaceBuildPageView: FC = ({ {builds?.map((build) => ( @@ -205,7 +205,7 @@ export const WorkspaceBuildPageView: FC = ({ fontWeight: 600, }} > - {`coder rm ${`${build.workspace_owner_username}/${build.workspace_name}`} --orphan`} + {`coder rm ${`${build.workspace_owner_name}/${build.workspace_name}`} --orphan`} {" "} to delete the workspace skipping resource destruction. diff --git a/site/src/pages/WorkspacePage/HistorySidebar.tsx b/site/src/pages/WorkspacePage/HistorySidebar.tsx index 2976a6daa3b71..2d978fb2a7d83 100644 --- a/site/src/pages/WorkspacePage/HistorySidebar.tsx +++ b/site/src/pages/WorkspacePage/HistorySidebar.tsx @@ -35,7 +35,7 @@ export const HistorySidebar: FC = ({ workspace }) => { diff --git a/site/src/testHelpers/entities.ts b/site/src/testHelpers/entities.ts index fa16d65dc8d5b..20df57eddd10b 100644 --- a/site/src/testHelpers/entities.ts +++ b/site/src/testHelpers/entities.ts @@ -1288,7 +1288,7 @@ export const MockWorkspaceBuild: TypesGen.WorkspaceBuild = { updated_at: "2022-05-17T17:39:01.382927298Z", workspace_name: "test-workspace", workspace_owner_id: MockUserOwner.id, - workspace_owner_username: MockUserOwner.username, + workspace_owner_name: MockUserOwner.username, workspace_owner_avatar_url: MockUserOwner.avatar_url, workspace_id: "759f1d46-3174-453d-aa60-980a9c1442f3", deadline: "2022-05-17T23:39:00.00Z", @@ -1316,7 +1316,7 @@ const MockWorkspaceBuildAutostart: TypesGen.WorkspaceBuild = { updated_at: "2022-05-17T17:39:01.382927298Z", workspace_name: "test-workspace", workspace_owner_id: MockUserOwner.id, - workspace_owner_username: MockUserOwner.username, + workspace_owner_name: MockUserOwner.username, workspace_owner_avatar_url: MockUserOwner.avatar_url, workspace_id: "759f1d46-3174-453d-aa60-980a9c1442f3", deadline: "2022-05-17T23:39:00.00Z", @@ -1340,7 +1340,7 @@ const MockWorkspaceBuildAutostop: TypesGen.WorkspaceBuild = { updated_at: "2022-05-17T17:39:01.382927298Z", workspace_name: "test-workspace", workspace_owner_id: MockUserOwner.id, - workspace_owner_username: MockUserOwner.username, + workspace_owner_name: MockUserOwner.username, workspace_owner_avatar_url: MockUserOwner.avatar_url, workspace_id: "759f1d46-3174-453d-aa60-980a9c1442f3", deadline: "2022-05-17T23:39:00.00Z", @@ -1366,7 +1366,7 @@ export const MockFailedWorkspaceBuild = ( updated_at: "2022-05-17T17:39:01.382927298Z", workspace_name: "test-workspace", workspace_owner_id: MockUserOwner.id, - workspace_owner_username: MockUserOwner.username, + workspace_owner_name: MockUserOwner.username, workspace_owner_avatar_url: MockUserOwner.avatar_url, workspace_id: "759f1d46-3174-453d-aa60-980a9c1442f3", deadline: "2022-05-17T23:39:00.00Z",