8000 chore: make templates search error the same as workspaces · coder/coder@36fa80c · GitHub
[go: up one dir, main page]

Skip to content

Commit 36fa80c

Browse files
committed
chore: make templates search error the same as workspaces
1 parent 4b5c45d commit 36fa80c

File tree

2 files changed

+36
-38
lines changed

2 files changed

+36
-38
lines changed

site/src/pages/TemplatesPage/TemplatesFilter.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ import type { FC } from "react";
1616

1717
interface TemplatesFilterProps {
1818
filter: ReturnType<typeof useFilter>;
19+
error?: unknown;
1920
}
2021

21-
export const TemplatesFilter: FC<TemplatesFilterProps> = ({ filter }) => {
22+
export const TemplatesFilter: FC<TemplatesFilterProps> = ({ filter, error }) => {
2223
const organizationMenu = useFilterMenu({
2324
onChange: (option) =>
2425
filter.update({ ...filter.values, organization: option?.value }),
@@ -48,6 +49,7 @@ export const TemplatesFilter: FC<TemplatesFilterProps> = ({ filter }) => {
4849
// learnMoreLink={docs("/templates#template-filtering")}
4950
isLoading={false}
5051
filter={filter}
52+
error={error}
5153
options={
5254
<>
5355
<SelectFilter

site/src/pages/TemplatesPage/TemplatesPageView.tsx

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -228,45 +228,41 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
228228
</PageHeaderSubtitle>
229229
</PageHeader>
230230

231-
<TemplatesFilter filter={filter} />
231+
<TemplatesFilter filter={filter} error={error} />
232+
233+
<TableContainer>
234+
<Table>
235+
<TableHead>
236+
<TableRow>
237+
<TableCell width="35%">{Language.nameLabel}</TableCell>
238+
<TableCell width="15%">
239+
{showOrganizations ? "Organization" : Language.usedByLabel}
240+
</TableCell>
241+
<TableCell width="10%">{Language.buildTimeLabel}</TableCell>
242+
<TableCell width="15%">{Language.lastUpdatedLabel}</TableCell>
243+
<TableCell width="1%" />
244+
</TableRow>
245+
</TableHead>
246+
<TableBody>
247+
{isLoading && <TableLoader />}
232248

233-
{error ? (
234-
<ErrorAlert error={error} />
235-
) : (
236-
<TableContainer>
237-
<Table>
238-
<TableHead>
239-
<TableRow>
240-
<TableCell width="35%">{Language.nameLabel}</TableCell>
241-
<TableCell width="15%">
242-
{showOrganizations ? "Organization" : Language.usedByLabel}
243-
</TableCell>
244-
<TableCell width="10%">{Language.buildTimeLabel}</TableCell>
245-
<TableCell width="15%">{Language.lastUpdatedLabel}</TableCell>
246-
<TableCell width="1%" />
247-
</TableRow>
248-
</TableHead>
249-
<TableBody>
250-
{isLoading && <TableLoader />}
251-
252-
{isEmpty ? (
253-
<EmptyTemplates
254-
canCreateTemplates={canCreateTemplates}
255-
examples={examples ?? []}
249+
{isEmpty ? (
250+
<EmptyTemplates
251+
canCreateTemplates={canCreateTemplates}
252+
examples={examples ?? []}
253+
/>
254+
) : (
255+
templates?.map((template) => (
256+
<TemplateRow
257+
key={template.id}
258+
showOrganizations={showOrganizations}
259+
template={template}
256260
/>
257-
) : (
258-
templates?.map((template) => (
259-
<TemplateRow
260-
key={template.id}
261-
showOrganizations={showOrganizations}
262-
template={template}
263-
/>
264-
))
265-
)}
266-
</TableBody>
267-
</Table>
268-
</TableContainer>
269-
)}
261+
))
262+
)}
263+
</TableBody>
264+
</Table>
265+
</TableContainer>
270266
</Margins>
271267
);
272268
};

0 commit comments

Comments
 (0)
0