Skip to content

fix: Show correct 'no results' message on workspace filters #2103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix: Show correct 'no results' message on workspace filters
  • Loading branch information
f0ssel committed Jun 7, 2022
commit 44d0d6df73da62ca238b7937f4bc3ac8c6eafaee
2 changes: 1 addition & 1 deletion site/src/pages/WorkspacesPage/WorkspacesPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("WorkspacesPage", () => {
render(<WorkspacesPage />)

// Then
await screen.findByText(Language.emptyMessage)
await screen.findByText(Language.emptyCreateWorkspaceMessage)
})

it("renders a filled workspaces page", async () => {
Expand Down
46 changes: 29 additions & 17 deletions site/src/pages/WorkspacesPage/WorkspacesPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ import { getDisplayStatus } from "../../util/workspace"
dayjs.extend(relativeTime)

export const Language = {
createButton: "Create workspace",
emptyMessage: "Create your first workspace",
emptyDescription: "Start editing your source code and building your software",
filterName: "Filters",
createWorkspaceButton: "Create workspace",
emptyCreateWorkspaceMessage: "Create your first workspace",
emptyCreateWorkspaceDescription: "Start editing your source code and building your software",
emptyResultsMessage: "No results matched your search",
filterName: "Filters",
yourWorkspacesButton: "Your workspaces",
allWorkspacesButton: "All workspaces",
workspaceTooltipTitle: "What is workspace?",
Expand Down Expand Up @@ -200,19 +200,31 @@ export const WorkspacesPageView: FC<WorkspacesPageViewProps> = ({ loading, works
<TableBody>
{!workspaces && loading && <TableLoader />}
{workspaces && workspaces.length === 0 && (
<TableRow>
<TableCell colSpan={999}>
<EmptyState
message={Language.emptyMessage}
description={Language.emptyDescription}
cta={
<Link underline="none" component={RouterLink} to="/workspaces/new">
<Button startIcon={<AddCircleOutline />}>{Language.createButton}</Button>
</Link>
}
/>
</TableCell>
</TableRow>
<>
{filter === "owner:me" || filter === "" ? (
<TableRow>
<TableCell colSpan={999}>
<EmptyState
message={Language.emptyCreateWorkspaceMessage}
description={Language.emptyCreateWorkspaceDescription}
cta={
<Link underline="none" component={RouterLink} to="/workspaces/new">
<Button startIcon={<AddCircleOutline />}>{Language.createWorkspaceButton}</Button>
</Link>
}
/>
</TableCell>
</TableRow>
) : (
<TableRow>
<TableCell colSpan={999}>
<EmptyState
message={Language.emptyResultsMessage}
/>
</TableCell>
</TableRow>
)}
</>
)}
{workspaces &&
workspaces.map((workspace) => {
Expand Down