Files
userbase/app/src/ui/routes/test/index.tsx
T
dswbx 1b8ce41837 role and permission handling in auth module
- Updated the `Role` class to change the `create` method signature for improved clarity and flexibility.
- Refactored the `guardRoleSchema` to utilize the new `roleSchema` for better consistency.
- Introduced a new `TPermission` type to enhance type safety in permission handling across the application.
- Updated various components and forms to accommodate the new permission structure, ensuring backward compatibility.
- Enhanced the `AuthRolesEdit` and `AuthRolesList` components to improve role management and permissions display.
- Added new API endpoints for fetching permissions, improving the overall functionality of the auth module.
2025-10-14 16:36:42 +02:00

100 lines
3.4 KiB
TypeScript

import AppShellAccordionsTest from "ui/routes/test/tests/appshell-accordions-test";
import FormyTest from "ui/routes/test/tests/formy-test";
import HtmlFormTest from "ui/routes/test/tests/html-form-test";
import SwaggerTest from "ui/routes/test/tests/swagger-test";
import SWRAndAPI from "ui/routes/test/tests/swr-and-api";
import SwrAndDataApi from "ui/routes/test/tests/swr-and-data-api";
import { Route, useParams } from "wouter";
import { Empty } from "../../components/display/Empty";
import { Link } from "../../components/wouter/Link";
import { AppShell } from "../../layouts/AppShell";
import FlowCreateSchemaTest from "../../routes/test/tests/flow-create-schema-test";
import FlowFormTest from "../../routes/test/tests/flow-form-test";
import ModalTest from "../../routes/test/tests/modal-test";
import QueryJsonFormTest from "../../routes/test/tests/query-jsonform";
import DropdownTest from "./tests/dropdown-test";
import DropzoneElementTest from "./tests/dropzone-element-test";
import FlowsTest from "./tests/flows-test";
import JsonSchemaForm3 from "./tests/json-schema-form3";
import JsonFormTest from "./tests/jsonform-test";
import { LiquidJsTest } from "./tests/liquid-js-test";
import MantineTest from "./tests/mantine-test";
import ReactHookErrors from "./tests/react-hook-errors";
import ReactFlowTest from "./tests/reactflow-test";
import SchemaTest from "./tests/schema-test";
import SortableTest from "./tests/sortable-test";
import { SqlAiTest } from "./tests/sql-ai-test";
import Themes from "./tests/themes";
import ErrorBoundary from "ui/components/display/ErrorBoundary";
import CodeEditorTest from "./tests/code-editor-test";
const tests = {
DropdownTest,
Themes,
ModalTest,
JsonFormTest,
FlowFormTest,
QueryJsonFormTest,
FlowCreateSchemaTest,
ReactFlowTest,
SchemaTest,
MantineTest,
LiquidJsTest,
SqlAiTest,
SortableTest,
ReactHookErrors,
FlowsTest,
AppShellAccordionsTest,
SwaggerTest,
SWRAndAPI,
SwrAndDataApi,
DropzoneElementTest,
JsonSchemaForm3,
FormyTest,
HtmlFormTest,
CodeEditorTest,
} as const;
export default function TestRoutes() {
return (
<TestRoot>
<Route path="/" component={() => <Empty title="Test" description="Select one." />} />
<Route path="/:test" component={RenderTest} />
</TestRoot>
);
}
function RenderTest() {
const params = useParams();
if (!params.test || !(params.test in tests)) {
return <Empty title="Test not found" />;
}
const Test = tests[params.test];
return <Test />;
}
function TestRoot({ children }) {
return (
<>
<AppShell.Sidebar>
<AppShell.SectionHeader>Tests</AppShell.SectionHeader>
<AppShell.Scrollable initialOffset={96}>
<div className="flex flex-col flex-grow p-3 gap-3">
<nav className="flex flex-col flex-1 gap-1">
{Object.entries(tests).map(([key, Component]) => (
<AppShell.SidebarLink key={key} as={Link} href={`/${key}`}>
{key}
</AppShell.SidebarLink>
))}
</nav>
</div>
</AppShell.Scrollable>
</AppShell.Sidebar>
<AppShell.Main key={window.location.href}>
<ErrorBoundary key={window.location.href}>{children}</ErrorBoundary>
</AppShell.Main>
</>
);
}