Skip to content

chore: match templates search error with workspace search error #14479

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 4 commits into from
Aug 30, 2024
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
chore: make templates search error the same as workspaces
  • Loading branch information
Emyrk committed Aug 29, 2024
commit 36fa80c7cd5ed8f1c22eddc2fb0b37791e5fde9d
4 changes: 3 additions & 1 deletion site/src/pages/TemplatesPage/TemplatesFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ import type { FC } from "react";

interface TemplatesFilterProps {
filter: ReturnType<typeof useFilter>;
error?: unknown;
}

export const TemplatesFilter: FC<TemplatesFilterProps> = ({ filter }) => {
export const TemplatesFilter: FC<TemplatesFilterProps> = ({ filter, error }) => {
const organizationMenu = useFilterMenu({
onChange: (option) =>
filter.update({ ...filter.values, organization: option?.value }),
Expand Down Expand Up @@ -48,6 +49,7 @@ export const TemplatesFilter: FC<TemplatesFilterProps> = ({ filter }) => {
// learnMoreLink={docs("/templates#template-filtering")}
isLoading={false}
filter={filter}
error={error}
options={
<>
<SelectFilter
Expand Down
70 changes: 33 additions & 37 deletions site/src/pages/TemplatesPage/TemplatesPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,45 +228,41 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
</PageHeaderSubtitle>
</PageHeader>

<TemplatesFilter filter={filter} />
<TemplatesFilter filter={filter} error={error} />

<TableContainer>
<Table>
<TableHead>
<TableRow>
<TableCell width="35%">{Language.nameLabel}</TableCell>
<TableCell width="15%">
{showOrganizations ? "Organization" : Language.usedByLabel}
</TableCell>
<TableCell width="10%">{Language.buildTimeLabel}</TableCell>
<TableCell width="15%">{Language.lastUpdatedLabel}</TableCell>
<TableCell width="1%" />
</TableRow>
</TableHead>
<TableBody>
{isLoading && <TableLoader />}

{error ? (
<ErrorAlert error={error} />
) : (
<TableContainer>
<Table>
<TableHead>
<TableRow>
<TableCell width="35%">{Language.nameLabel}</TableCell>
<TableCell width="15%">
{showOrganizations ? "Organization" : Language.usedByLabel}
</TableCell>
<TableCell width="10%">{Language.buildTimeLabel}</TableCell>
<TableCell width="15%">{Language.lastUpdatedLabel}</TableCell>
<TableCell width="1%" />
</TableRow>
</TableHead>
<TableBody>
{isLoading && <TableLoader />}

{isEmpty ? (
<EmptyTemplates
canCreateTemplates={canCreateTemplates}
examples={examples ?? []}
{isEmpty ? (
<EmptyTemplates
canCreateTemplates={canCreateTemplates}
examples={examples ?? []}
/>
) : (
templates?.map((template) => (
<TemplateRow
key={template.id}
showOrganizations={showOrganizations}
template={template}
/>
) : (
templates?.map((template) => (
<TemplateRow
key={template.id}
showOrganizations={showOrganizations}
template={template}
/>
))
)}
</TableBody>
</Table>
</TableContainer>
)}
))
)}
</TableBody>
</Table>
</TableContainer>
</Margins>
);
};
Expand Down
Loading