Skip to content

Commit

Permalink
JNG-5940 additional routes
Browse files Browse the repository at this point in the history
  • Loading branch information
noherczeg committed Sep 26, 2024
1 parent fa055ee commit 8eb551a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
28 changes: 28 additions & 0 deletions docs/pages/01_ui_react.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,34 @@ const CustomDashboard: FC = () => {
};
----

=== Adding custom routes

Adding custom routes can be done via adding the `src/extra-routes.tsx` tp the generator-ignore files and filling the
array with our additional routes.

*src/extra-routes.tsx:*
[source,typescriptjsx]
----
import type { ReactElement } from 'react';
const Hello = () => {
return (
<>
<div>
Hello
</div>
</>
);
};
export const extraRoutes: Array<{ path: string; element: ReactElement; exact?: boolean }> = [
{
path: 'hello',
element: <Hello />,
},
];
----

=== Filtering Enumeration options

Enumeration options can be filtered based on current view/form data if needed. Filtering actions are available on
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{> fragment.header.hbs }}

import type { ReactElement } from 'react';

export const extraRoutes: Array<{path: string, element: ReactElement, exact?: boolean}> = [];
3 changes: 2 additions & 1 deletion judo-ui-react/src/main/resources/actor/src/routes.tsx.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import { lazy, Suspense } from 'react';
import { OBJECTCLASS } from '@pandino/pandino-api';
import { ComponentProxy } from '@pandino/react-hooks';
import { Redirect } from './pages/Redirect';
import { extraRoutes } from './extra-routes';

let routes: Array<{path: string, element: ReactElement, exact?: boolean}> = [];
let routes: Array<{path: string, element: ReactElement, exact?: boolean}> = [...extraRoutes];

routes.push({
path: '_redirect',
Expand Down
4 changes: 4 additions & 0 deletions judo-ui-react/src/main/resources/ui-react.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ templates:
pathExpression: "'src/routes.tsx'"
templateName: actor/src/routes.tsx.hbs

- name: actor/src/extra-routes.tsx
pathExpression: "'src/extra-routes.tsx'"
templateName: actor/src/extra-routes.tsx.hbs

- name: actor/src/vite-env.d.ts
pathExpression: "'src/vite-env.d.ts'"
templateName: actor/src/vite-env.d.ts.hbs
Expand Down

0 comments on commit 8eb551a

Please sign in to comment.