diff --git a/site/src/pages/WorkspacesPage/WorkspacesPageView.stories.tsx b/site/src/pages/WorkspacesPage/WorkspacesPageView.stories.tsx index 0091cd709f..8dbda6b01a 100644 --- a/site/src/pages/WorkspacesPage/WorkspacesPageView.stories.tsx +++ b/site/src/pages/WorkspacesPage/WorkspacesPageView.stories.tsx @@ -195,6 +195,13 @@ export const AllStates: Story = { }, }; +export const Loading: Story = { + args: { + workspaces: undefined, + count: undefined, + }, +}; + export const AllStatesWithFavorites: Story = { args: { workspaces: allWorkspaces.map((workspace, i) => ({ diff --git a/site/src/pages/WorkspacesPage/WorkspacesTable.tsx b/site/src/pages/WorkspacesPage/WorkspacesTable.tsx index f60c64caa5..0ecc517f12 100644 --- a/site/src/pages/WorkspacesPage/WorkspacesTable.tsx +++ b/site/src/pages/WorkspacesPage/WorkspacesTable.tsx @@ -1,4 +1,3 @@ -import Skeleton from "@mui/material/Skeleton"; import { BanIcon, CloudIcon, @@ -43,8 +42,8 @@ import { ConfirmDialog } from "#/components/Dialogs/ConfirmDialog/ConfirmDialog" import { ExternalImage } from "#/components/ExternalImage/ExternalImage"; import { VSCodeIcon } from "#/components/Icons/VSCodeIcon"; import { VSCodeInsidersIcon } from "#/components/Icons/VSCodeInsidersIcon"; +import { Skeleton } from "#/components/Skeleton/Skeleton"; import { Spinner } from "#/components/Spinner/Spinner"; -import { Stack } from "#/components/Stack/Stack"; import { Table, TableBody, @@ -111,47 +110,57 @@ export const WorkspacesTable: FC = ({ chatsByWorkspace, }) => { const dashboard = useDashboard(); + const isLoading = !workspaces; + const isEmpty = workspaces && workspaces.length === 0; + const hideHeaders = isLoading || isEmpty; return ( -
- 0 && - checkedWorkspaces.length === workspaces.length - } - onCheckedChange={(checked) => { - if (!workspaces) { - return; + {isLoading ? ( + + ) : ( +
+ - Name -
+ onCheckedChange={(checked) => { + if (!checked) { + onCheckChange([]); + } else { + onCheckChange(workspaces); + } + }} + aria-label="Select all workspaces" + className="my-0" + /> + Name +
+ )} +
+ + Template + + + Status - Template - Status Actions
- {!workspaces && } - {workspaces && workspaces.length === 0 && ( + {isLoading && } + {isEmpty && ( = ({ /> +
{workspace.name} @@ -224,7 +233,7 @@ export const WorkspacesTable: FC = ({ )} - +
} subtitle={
@@ -355,11 +364,11 @@ const TableLoader: FC = () => { - +
- +