Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions site/src/@types/storybook.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {
DeploymentValues,
Experiments,
FeatureName,
Organization,
SerpentOption,
User,
} from "api/typesGenerated";
Expand All @@ -17,6 +18,7 @@ declare module "@storybook/react" {
features?: FeatureName[];
experiments?: Experiments;
showOrganizations?: boolean;
organizations?: Organization[];
queries?: { key: QueryKey; data: unknown }[];
webSocket?: WebSocketEvent[];
user?: User;
Expand Down
23 changes: 13 additions & 10 deletions site/src/pages/WorkspacesPage/WorkspacesPageView.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import uniqueId from "lodash/uniqueId";
import type { ComponentProps } from "react";
import {
MockBuildInfo,
MockOrganization,
MockPendingProvisionerJob,
MockTemplate,
MockUser,
Expand Down Expand Up @@ -269,25 +270,27 @@ export const InvalidPageNumber: Story = {

export const ShowOrganizations: Story = {
args: {
workspaces: [
{
...MockWorkspace,
organization_name: "Limbus Co.",
},
],
workspaces: [{ ...MockWorkspace, organization_name: "limbus-co" }],
},

parameters: {
showOrganizations: true,
organizations: [
{
...MockOrganization,
name: "limbus-co",
display_name: "Limbus Company, LLC",
},
],
},

play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const accessibleTableCell = await canvas.findByRole("cell", {
// Need whitespace classes because different parts of the element
// are going in different spans, and Storybook doesn't consolidate
// these
name: /org\s?(?:anization)?\s?:\s?Limbus Co\./i,
// The organization label is always visually hidden, but the test
// makes sure that there's a screen reader hook to give the table
// cell more structured output
name: /organization: Limbus Company, LLC/i,
});

expect(accessibleTableCell).toBeDefined();
Expand Down
6 changes: 5 additions & 1 deletion site/src/pages/WorkspacesPage/WorkspacesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({
const checked = checkedWorkspaces.some(
(w) => w.id === workspace.id,
);
const activeOrg = dashboard.organizations.find(
(o) => o.id === workspace.organization_id,
);

return (
<WorkspacesRow
workspace={workspace}
Expand Down Expand Up @@ -208,7 +212,7 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({
}}
>
<span css={{ ...visuallyHidden }}>Organization: </span>
{workspace.organization_name}
{activeOrg?.display_name || workspace.organization_name}
</div>
)}
</TableCell>
Expand Down
5 changes: 3 additions & 2 deletions site/src/testHelpers/storybook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const withDashboardProvider = (
features = [],
experiments = [],
showOrganizations = false,
organizations = [MockDefaultOrganization],
} = parameters;

const entitlements: Entitlements = {
Expand All @@ -44,9 +45,9 @@ export const withDashboardProvider = (
value={{
entitlements,
experiments,
appearance: MockAppearanceConfig,
organizations: [MockDefaultOrganization],
organizations,
showOrganizations,
appearance: MockAppearanceConfig,
}}
>
<Story />
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy