chore: rollback PR #18025 (#18118)

Rollback https://github.com/coder/coder/pull/18025
This commit is contained in:
Bruno Quaresma
2025-05-30 11:00:26 -03:00
committed by GitHub
parent a19539ce83
commit f974add373
15 changed files with 64 additions and 87 deletions

View File

@ -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,

4
coderd/apidoc/docs.go generated
View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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,

View File

@ -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)
}

View File

@ -57,8 +57,8 @@ type WorkspaceBuild struct {
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"`
// 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"`

View File

@ -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"
}
```

View File

@ -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,15 +9413,14 @@ 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"
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|------------------------------|-------------------------------------------------------------------|----------|--------------|-------------|
|------------------------------|-------------------------------------------------------------------|----------|--------------|---------------------------------------------------------------------|
| `build_number` | integer | false | | |
| `created_at` | string | false | | |
| `daily_cost` | integer | false | | |
@ -9445,8 +9443,7 @@ If the schedule is empty, the user will be updated to use the default schedule.|
| `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 | 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",

View File

@ -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",

View File

@ -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,
);

View File

@ -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<Workspace>(workspaceKey);

View File

@ -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;

View File

@ -104,7 +104,7 @@ export const WorkspaceBuildPageView: FC<WorkspaceBuildPageViewProps> = ({
label="Workspace"
value={
<Link
to={`/@${build.workspace_owner_username}/${build.workspace_name}`}
to={`/@${build.workspace_owner_name}/${build.workspace_name}`}
>
{build.workspace_name}
</Link>
@ -158,7 +158,7 @@ export const WorkspaceBuildPageView: FC<WorkspaceBuildPageViewProps> = ({
{builds?.map((build) => (
<Link
key={build.id}
to={`/@${build.workspace_owner_username}/${build.workspace_name}/builds/${build.build_number}`}
to={`/@${build.workspace_owner_name}/${build.workspace_name}/builds/${build.build_number}`}
>
<SidebarItem active={build.build_number === activeBuildNumber}>
<WorkspaceBuildData build={build} />
@ -205,7 +205,7 @@ export const WorkspaceBuildPageView: FC<WorkspaceBuildPageViewProps> = ({
fontWeight: 600,
}}
>
{`coder rm ${`${build.workspace_owner_username}/${build.workspace_name}`} --orphan`}
{`coder rm ${`${build.workspace_owner_name}/${build.workspace_name}`} --orphan`}
</code>{" "}
to delete the workspace skipping resource destruction.
</div>

View File

@ -35,7 +35,7 @@ export const HistorySidebar: FC<HistorySidebarProps> = ({ workspace }) => {
<SidebarLink
target="_blank"
key={build.id}
to={`/@${build.workspace_owner_username}/${build.workspace_name}/builds/${build.build_number}`}
to={`/@${build.workspace_owner_name}/${build.workspace_name}/builds/${build.build_number}`}
>
<WorkspaceBuildData build={build} />
</SidebarLink>

View File

@ -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",