@@ -9,6 +9,7 @@ import TableCell from "@mui/material/TableCell";
9
9
import TableContainer from "@mui/material/TableContainer" ;
10
10
import TableHead from "@mui/material/TableHead" ;
11
11
import TableRow from "@mui/material/TableRow" ;
12
+ import { hasError , isApiValidationError } from "api/errors" ;
12
13
import type { Template , TemplateExample } from "api/typesGenerated" ;
13
14
import { ErrorAlert } from "components/Alert/ErrorAlert" ;
14
15
import { ExternalAvatar } from "components/Avatar/Avatar" ;
@@ -228,45 +229,45 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
228
229
</ PageHeaderSubtitle >
229
230
</ PageHeader >
230
231
231
- < TemplatesFilter filter = { filter } />
232
-
233
- { error ? (
232
+ < TemplatesFilter filter = { filter } error = { error } />
233
+ { /* Validation errors are shown on the filter, other errors are an alert box. */ }
234
+ { hasError ( error ) && ! isApiValidationError ( error ) && (
234
235
< 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 /> }
236
+ ) }
251
237
252
- { isEmpty ? (
253
- < EmptyTemplates
254
- canCreateTemplates = { canCreateTemplates }
255
- examples = { examples ?? [ ] }
238
+ < TableContainer >
239
+ < Table >
240
+ < TableHead >
241
+ < TableRow >
242
+ < TableCell width = "35%" > { Language . nameLabel } </ TableCell >
243
+ < TableCell width = "15%" >
244
+ { showOrganizations ? "Organization" : Language . usedByLabel }
245
+ </ TableCell >
246
+ < TableCell width = "10%" > { Language . buildTimeLabel } </ TableCell >
247
+ < TableCell width = "15%" > { Language . lastUpdatedLabel } </ TableCell >
248
+ < TableCell width = "1%" />
249
+ </ TableRow >
250
+ </ TableHead >
251
+ < TableBody >
252
+ { isLoading && < TableLoader /> }
253
+
254
+ { isEmpty ? (
255
+ < EmptyTemplates
256
+ canCreateTemplates = { canCreateTemplates }
257
+ examples = { examples ?? [ ] }
258
+ />
259
+ ) : (
260
+ templates ?. map ( ( template ) => (
261
+ < TemplateRow
262
+ key = { template . id }
263
+ showOrganizations = { showOrganizations }
264
+ template = { template }
256
265
/>
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
- ) }
266
+ ) )
267
+ ) }
268
+ </ TableBody >
269
+ </ Table >
270
+ </ TableContainer >
270
271
</ Margins >
271
272
) ;
272
273
} ;
0 commit comments