Skip to content
Closed
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
5 changes: 3 additions & 2 deletions site/src/pages/WorkspacesPage/WorkspacesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const WorkspacesPage: FC = () => {
),
);

// Filter templates based on workspace creation permission
// Filter templates based on workspace creation permission and exclude deprecated templates
const filteredTemplates = useMemo(() => {
if (!templatesQuery.data || !workspacePermissionsQuery.data) {
return templatesQuery.data;
Expand All @@ -61,7 +61,8 @@ const WorkspacesPage: FC = () => {
return templatesQuery.data.filter((template) => {
const workspacePermission =
workspacePermissionsQuery.data[template.organization_id];
return workspacePermission?.createWorkspaceForUserID;
// Filter out deprecated templates and check permissions
return workspacePermission?.createWorkspaceForUserID && !template.deprecated;
});
}, [templatesQuery.data, workspacePermissionsQuery.data]);

Expand Down
6 changes: 3 additions & 3 deletions site/src/pages/WorkspacesPage/filter/menus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const useTemplateFilterMenu = ({
value,
id: "template",
getSelectedOption: async () => {
// Show all templates including deprecated
// Get all templates - we show deprecated templates in filters since users may want to filter by them
const templates = await API.getTemplates();
const template = templates.find((template) => template.name === value);
if (template) {
Expand All @@ -39,7 +39,7 @@ export const useTemplateFilterMenu = ({
return null;
},
getOptions: async (query) => {
// Show all templates including deprecated
// Get all templates - we show deprecated templates in filters since users may want to filter by them
const templates = await API.getTemplates();
const filteredTemplates = templates.filter(
(template) =>
Expand Down Expand Up @@ -168,4 +168,4 @@ export const getStatusIndicatorVariant = (
case "failed":
return "failed";
}
};
};
Loading