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

Commit9da6467

Browse files
authored
fix: prefer organization display name for workspaces table (#14617)
* fix: prefer organization display name for workspaces table* fix: update story to account for organization name changes* fix: resolve typo in regex search for test
1 parenteb646f0 commit9da6467

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

‎site/src/@types/storybook.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type {
33
DeploymentValues,
44
Experiments,
55
FeatureName,
6+
Organization,
67
SerpentOption,
78
User,
89
}from"api/typesGenerated";
@@ -17,6 +18,7 @@ declare module "@storybook/react" {
1718
features?:FeatureName[];
1819
experiments?:Experiments;
1920
showOrganizations?:boolean;
21+
organizations?:Organization[];
2022
queries?:{key:QueryKey;data:unknown}[];
2123
webSocket?:WebSocketEvent[];
2224
user?:User;

‎site/src/pages/WorkspacesPage/WorkspacesPageView.stories.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import uniqueId from "lodash/uniqueId";
1515
importtype{ComponentProps}from"react";
1616
import{
1717
MockBuildInfo,
18+
MockOrganization,
1819
MockPendingProvisionerJob,
1920
MockTemplate,
2021
MockUser,
@@ -269,25 +270,27 @@ export const InvalidPageNumber: Story = {
269270

270271
exportconstShowOrganizations:Story={
271272
args:{
272-
workspaces:[
273-
{
274-
...MockWorkspace,
275-
organization_name:"Limbus Co.",
276-
},
277-
],
273+
workspaces:[{ ...MockWorkspace,organization_name:"limbus-co"}],
278274
},
279275

280276
parameters:{
281277
showOrganizations:true,
278+
organizations:[
279+
{
280+
...MockOrganization,
281+
name:"limbus-co",
282+
display_name:"Limbus Company, LLC",
283+
},
284+
],
282285
},
283286

284287
play:async({ canvasElement})=>{
285288
constcanvas=within(canvasElement);
286289
constaccessibleTableCell=awaitcanvas.findByRole("cell",{
287-
//Need whitespace classes because different parts oftheelement
288-
//are going in different spans, and Storybook doesn't consolidate
289-
//these
290-
name:/org\s?(?:anization)?\s?:\s?LimbusCo\./i,
290+
//The organization label is always visually hidden, butthetest
291+
//makes sure that there's a screen reader hook to give the table
292+
//cell more structured output
293+
name:/organization:LimbusCompany,LLC/i,
291294
});
292295

293296
expect(accessibleTableCell).toBeDefined();

‎site/src/pages/WorkspacesPage/WorkspacesTable.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({
115115
constchecked=checkedWorkspaces.some(
116116
(w)=>w.id===workspace.id,
117117
);
118+
constactiveOrg=dashboard.organizations.find(
119+
(o)=>o.id===workspace.organization_id,
120+
);
121+
118122
return(
119123
<WorkspacesRow
120124
workspace={workspace}
@@ -208,7 +212,7 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({
208212
}}
209213
>
210214
<spancss={{ ...visuallyHidden}}>Organization:</span>
211-
{workspace.organization_name}
215+
{activeOrg?.display_name||workspace.organization_name}
212216
</div>
213217
)}
214218
</TableCell>

‎site/src/testHelpers/storybook.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const withDashboardProvider = (
2424
features=[],
2525
experiments=[],
2626
showOrganizations=false,
27+
organizations=[MockDefaultOrganization],
2728
}=parameters;
2829

2930
constentitlements:Entitlements={
@@ -44,9 +45,9 @@ export const withDashboardProvider = (
4445
value={{
4546
entitlements,
4647
experiments,
47-
appearance:MockAppearanceConfig,
48-
organizations:[MockDefaultOrganization],
48+
organizations,
4949
showOrganizations,
50+
appearance:MockAppearanceConfig,
5051
}}
5152
>
5253
<Story/>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp