diff --git a/site/src/pages/TemplatesPage/TemplatesFilter.tsx b/site/src/pages/TemplatesPage/TemplatesFilter.tsx index 581858aabe9bf..f463a35ff5261 100644 --- a/site/src/pages/TemplatesPage/TemplatesFilter.tsx +++ b/site/src/pages/TemplatesPage/TemplatesFilter.tsx @@ -16,9 +16,13 @@ import type { FC } from "react"; interface TemplatesFilterProps { filter: ReturnType; + error?: unknown; } -export const TemplatesFilter: FC = ({ filter }) => { +export const TemplatesFilter: FC = ({ + filter, + error, +}) => { const organizationMenu = useFilterMenu({ onChange: (option) => filter.update({ ...filter.values, organization: option?.value }), @@ -48,6 +52,7 @@ export const TemplatesFilter: FC = ({ filter }) => { // learnMoreLink={docs("/templates#template-filtering")} isLoading={false} filter={filter} + error={error} options={ <> = ({ - - - {error ? ( + + {/* Validation errors are shown on the filter, other errors are an alert box. */} + {hasError(error) && !isApiValidationError(error) && ( - ) : ( - - - - - {Language.nameLabel} - - {showOrganizations ? "Organization" : Language.usedByLabel} - - {Language.buildTimeLabel} - {Language.lastUpdatedLabel} - - - - - {isLoading && } + )} - {isEmpty ? ( - +
+ + + {Language.nameLabel} + + {showOrganizations ? "Organization" : Language.usedByLabel} + + {Language.buildTimeLabel} + {Language.lastUpdatedLabel} + + + + + {isLoading && } + + {isEmpty ? ( + + ) : ( + templates?.map((template) => ( + - ) : ( - templates?.map((template) => ( - - )) - )} - -
-
- )} + )) + )} + + + ); };