Skip to content

fix: update create workspace button to recognize template names+display names #10233

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 2 commits into from
Oct 12, 2023
Merged
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
8 changes: 6 additions & 2 deletions site/src/pages/WorkspacesPage/WorkspacesButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ function sortTemplatesByUsersDesc(

const termMatcher = new RegExp(searchTerm.replaceAll(/[^\w]/g, "."), "i");
return templates
.filter((template) => termMatcher.test(template.display_name))
.filter(
(template) =>
termMatcher.test(template.display_name) ||
termMatcher.test(template.name),
)
.sort((t1, t2) => t2.active_user_count - t1.active_user_count)
.slice(0, 10);
}
Expand Down Expand Up @@ -84,7 +88,7 @@ function WorkspaceResultsRow({ template }: { template: Template }) {
sx={{ marginY: 0, paddingBottom: 0.5, lineHeight: 1 }}
noWrap
>
{template.display_name || "[Unnamed]"}
{template.display_name || template.name || "[Unnamed]"}
</Typography>

<Box
Expand Down