new react-openapi
This commit is contained in:
@@ -30,18 +30,20 @@ export function Admin({ basePath }: AdminProps) {
|
||||
if (resources.length === 0) {
|
||||
return (
|
||||
<Box sx={{ p: 4, textAlign: "center" }}>
|
||||
No resources found in the OpenAPI spec with x-resource defined.
|
||||
No resources found in the OpenAPI spec.
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
const topLevel = resources.filter((r) => !r.parent);
|
||||
|
||||
return (
|
||||
<>
|
||||
{warnings.length > 0 && <ValidationAlert errors={[]} warnings={warnings} />}
|
||||
<Layout resources={resources} basePath={basePath}>
|
||||
<Layout resources={topLevel} basePath={basePath}>
|
||||
<Routes>
|
||||
<Route index element={<Navigate to={`${basePath}/${resources[0].name}`} replace />} />
|
||||
{resources.map((r) => (
|
||||
<Route index element={<Navigate to={`${basePath}/${topLevel[0].name}`} replace />} />
|
||||
{topLevel.map((r) => (
|
||||
<React.Fragment key={r.name}>
|
||||
<Route path={r.name} element={<ResourceList resource={r} basePath={basePath} />} />
|
||||
{!r.streaming && (
|
||||
|
||||
Reference in New Issue
Block a user