mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: update WorkspaceOwnerName to use user.name instead of user.username (#18025)
We have been using the user.username instead of user.name in wrong places, making it very confusing for the UI.
This commit is contained in:
+1
-1
@@ -1166,7 +1166,7 @@ class ApiMethods {
|
||||
)
|
||||
) {
|
||||
const { job } = await this.getWorkspaceBuildByNumber(
|
||||
build.workspace_owner_name,
|
||||
build.workspace_owner_username,
|
||||
build.workspace_name,
|
||||
build.build_number,
|
||||
);
|
||||
|
||||
@@ -27,12 +27,10 @@ import { checkAuthorization } from "./authCheck";
|
||||
import { disabledRefetchOptions } from "./util";
|
||||
import { workspaceBuildsKey } from "./workspaceBuilds";
|
||||
|
||||
export const workspaceByOwnerAndNameKey = (owner: string, name: string) => [
|
||||
"workspace",
|
||||
owner,
|
||||
name,
|
||||
"settings",
|
||||
];
|
||||
export const workspaceByOwnerAndNameKey = (
|
||||
ownerUsername: string,
|
||||
name: string,
|
||||
) => ["workspace", ownerUsername, name, "settings"];
|
||||
|
||||
export const workspaceByOwnerAndName = (owner: string, name: string) => {
|
||||
return {
|
||||
@@ -281,7 +279,7 @@ const updateWorkspaceBuild = async (
|
||||
queryClient: QueryClient,
|
||||
) => {
|
||||
const workspaceKey = workspaceByOwnerAndNameKey(
|
||||
build.workspace_owner_name,
|
||||
build.workspace_owner_username,
|
||||
build.workspace_name,
|
||||
);
|
||||
const previousData = queryClient.getQueryData<Workspace>(workspaceKey);
|
||||
|
||||
Generated
+2
-1
@@ -3619,7 +3619,8 @@ export interface WorkspaceBuild {
|
||||
readonly workspace_id: string;
|
||||
readonly workspace_name: string;
|
||||
readonly workspace_owner_id: string;
|
||||
readonly workspace_owner_name: string;
|
||||
readonly workspace_owner_name?: string;
|
||||
readonly workspace_owner_username: string;
|
||||
readonly workspace_owner_avatar_url?: string;
|
||||
readonly template_version_id: string;
|
||||
readonly template_version_name: string;
|
||||
|
||||
@@ -205,7 +205,7 @@ export const WorkspaceBuildPageView: FC<WorkspaceBuildPageViewProps> = ({
|
||||
fontWeight: 600,
|
||||
}}
|
||||
>
|
||||
{`coder rm ${`${build.workspace_owner_name}/${build.workspace_name}`} --orphan`}
|
||||
{`coder rm ${`${build.workspace_owner_username}/${build.workspace_name}`} --orphan`}
|
||||
</code>{" "}
|
||||
to delete the workspace skipping resource destruction.
|
||||
</div>
|
||||
|
||||
@@ -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_name: MockUserOwner.username,
|
||||
workspace_owner_username: 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_name: MockUserOwner.username,
|
||||
workspace_owner_username: 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_name: MockUserOwner.username,
|
||||
workspace_owner_username: 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_name: MockUserOwner.username,
|
||||
workspace_owner_username: MockUserOwner.username,
|
||||
workspace_owner_avatar_url: MockUserOwner.avatar_url,
|
||||
workspace_id: "759f1d46-3174-453d-aa60-980a9c1442f3",
|
||||
deadline: "2022-05-17T23:39:00.00Z",
|
||||
|
||||
Reference in New Issue
Block a user