Skip to content

Commit 1e70d8a

Browse files
committed
docs: more docs restructure
1 parent 99e6317 commit 1e70d8a

22 files changed

Lines changed: 549 additions & 719 deletions

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
![Unit tests](https://github.com/DIRACGrid/diracx-web/actions/workflows/diracx-web-components-test.yml/badge.svg?branch=main)
88
![Integration tests](https://github.com/DIRACGrid/diracx-web/actions/workflows/diracx-web-test.yml/badge.svg?branch=main)
99
![Deployment](https://github.com/DIRACGrid/diracx-web/actions/workflows/deployment.yml/badge.svg?branch=main)
10+
![Gubbins](https://github.com/DIRACGrid/diracx-web/actions/workflows/gubbins-test.yml/badge.svg?branch=main)
1011

1112

1213
**DiracX-Web** is a web application that provides a user-friendly interface to interact with the [DiracX](https://github.com/DIRACGrid/diracx) services. It is part of the [DIRAC](https://github.com/DIRACGrid) ecosystem.
File renamed without changes.
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
### Development mode
55

6-
Refer to the [Developer Guide: Setting up you Development Environment](../developer/setup_environment.md) for instructions on running `diracx-web` in development mode.
6+
Refer to the [Developer Guide: Setting up your Development Environment](../../dev/how-to/setup_web_environment.md) for instructions on running `diracx-web` in development mode.
77

88
### Production mode
99

@@ -14,7 +14,8 @@ global.images.web.tag: <latest diracx-web version, docker tag>
1414
global.images.web.repository: <diracx-web docker image>
1515
```
1616
17-
:bulb: Make sure to update these values to point to the appropriate Docker image and version for your deployment.
17+
!!! tip
18+
Make sure to update these values to point to the appropriate Docker image and version for your deployment.
1819
1920
### Integrating new features/hotfixes
2021
@@ -25,14 +26,15 @@ diracxWeb.repoURL: <repository hosting the branch you want to apply>
2526
diracxWeb.branch: <branch hosting the changes you want to apply>
2627
```
2728

28-
:bulb: Make sure to update these values to point to the appropriate Docker image and version for your deployment.
29+
!!! tip
30+
Make sure to update these values to point to the appropriate Docker image and version for your deployment.
2931

3032
## Extension
3133

3234

3335
### `gubbins` extension in development mode
3436

35-
For managing the `gubbins` extension in development mode, refer to the [Developer Guide: Managing an extension](../developer/manage_extension.md).
37+
For managing the `gubbins` extension in development mode, refer to the [Developer Guide: Managing an extension](../../dev/how-to/manage_web_extension.md).
3638

3739
### `gubbins` extension in development mode, as a standalone
3840

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Contributing to DiracX-Web
2+
3+
*Requirements: [Setup Environment](setup_web_environment.md)*
4+
5+
=== "Documentation"
6+
7+
Ensure that any code you write is well-documented. This includes:
8+
9+
- Inline comments where necessary to explain complex logic.
10+
- Updating or creating Storybook documentation if you are contributing to the `diracx-web-components` library.
11+
- You can use tools like [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/) to maintain code quality.
12+
13+
=== "Testing"
14+
15+
**Component Testing**
16+
: Write tests for your stories to ensure they work as expected. Use [Jest](https://jestjs.io/) for unit testing and snapshot testing of your React components.
17+
18+
**Application Testing**
19+
: Use [Cypress](https://www.cypress.io/) for end-to-end testing to simulate real user interactions and ensure your application behaves correctly.
20+
21+
**Test Coverage**
22+
: Maintain good test coverage to ensure that your critical features are well-protected during updates. Tools like Jest provide [coverage reports](https://jestjs.io/docs/code-coverage) that help you identify untested parts of your code.
23+
24+
=== "Accessibility"
25+
26+
Make your application accessible to all users. Use semantic HTML, ARIA attributes, and test your application with different screen sizes and assistive technologies.
27+
28+
!!! note
29+
If you create an export function or component in `diracx-web-components`, you must add it to the `index.ts` file and run `npm run build` inside `packages/diracx-web-components` to ensure the pre-commit hook passes.
30+
31+
!!! warning
32+
Don't forget to update the `packages/extensions` code if you integrate breaking changes in the `diracx-web-components` library. See [Managing the extension](manage_web_extension.md) for further details.
33+
34+
!!! note "Pre-commit Hooks"
35+
`Husky` is configured to run as a pre-commit script, executing tasks such as linting staged files to maintain code consistency with the codebase.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ You must provide:
1414
- An icon that will appear in the `Add application` menu
1515
- An optional function, `validateAndConvertState`, which identifies and corrects the structure of a JSON pasted by the user during import. This function ensures compatibility between versions by transforming the pasted state into a valid, updated version. It should be reviewed and updated in any version that modifies the exported/imported state structure
1616

17-
💡You can look at the type `ApplicationMetadata` for more details
17+
!!! tip
18+
You can look at the type `ApplicationMetadata` for more details.
1819

1920
### Code the application
2021

2122
The code of your app should be in `packages/diracx-web-components/src/components/<new-app>`. The new app can and should use what already exist in `@dirac-grid/diracx-web-components`.
2223

2324
In order to be compatible with the share and import buttons, the application must write its state to the session storage at `<appId>_State`. This slot is read from and written to by the corresponding functions.
2425

25-
💡You can look at `JobMonitor` as an example.
26+
!!! tip
27+
You can look at `JobMonitor` as an example.
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,5 @@ export DIRACX_URL=<diracX installation>
8181
npm run --prefix packages/extensions test
8282
```
8383

84-
### `gubbins` (backend)
85-
86-
Follow the instructions from the [Gubbins extension README](https://github.com/DIRACGrid/diracx/tree/main/extensions#work-on-gubbins).
87-
88-
:bulb: Like `diracx-web`, `gubbins-web` does automatically reflect changes made in `diracx-web-components`. This means that while running `gubbins` using `diracx-charts/run_demo.sh`, any modifications to `diracx-web-components` will also be applied to `gubbins`.
84+
!!! tip
85+
Like `diracx-web`, `gubbins-web` does automatically reflect changes made in `diracx-web-components`. This means that while running `gubbins` using `diracx-charts/run_demo.sh`, any modifications to `diracx-web-components` will also be applied to `gubbins`.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ git clone git@github.com:DIRACGrid/diracx-charts.git
140140
diracx-charts/run_demo.sh ./diracx-web [./diracx]
141141
```
142142

143-
:bulb: Any change made in `diracx-web-components` are automatically reflected into the development environment. We rely on the [NextJS transpile option](https://nextjs.org/docs/app/api-reference/config/next-config-js/transpilePackages). Further details are available in the `diracx-web` NextJS configuration.
143+
!!! tip
144+
Any change made in `diracx-web-components` is automatically reflected into the development environment. We rely on the [NextJS transpile option](https://nextjs.org/docs/app/api-reference/config/next-config-js/transpilePackages). Further details are available in the `diracx-web` NextJS configuration.
144145

145146
## Testing
146147

docs/dev/manage_dependencies.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/dev/reference/web-arch.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Web Architecture
2+
3+
## Monorepo Structure
4+
5+
The DiracX-Web repository is organized as a monorepo using [npm workspaces](https://docs.npmjs.com/cli/v10/using-npm/workspaces). Local packages are resolved from their workspace versions rather than the npm registry.
6+
7+
```mermaid
8+
---
9+
config:
10+
layout: elk
11+
---
12+
flowchart TD
13+
subgraph monorepo["Monorepo"]
14+
components["diracx-web-components"]
15+
web["diracx-web"]
16+
extensions["extensions (gubbins)"]
17+
end
18+
web -. uses .-> components
19+
extensions -. uses .-> components
20+
components -- published on --> npm["npm registry"]
21+
community["Community extensions"] -. uses .-> npm
22+
```
23+
24+
## Packages
25+
26+
### diracx-web-components
27+
28+
- **Purpose**: Reusable React component library.
29+
- **Build tool**: [tsup](https://tsup.egoist.dev/) for TypeScript compilation.
30+
- **Design system**: [Material-UI (MUI)](https://mui.com/).
31+
- **Documentation**: [Storybook](https://storybook.js.org/).
32+
- **Testing**: [Jest](https://jestjs.io/) + [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/).
33+
- **Exports**: Components, contexts, hooks, and types as separate modules.
34+
35+
### diracx-web
36+
37+
- **Purpose**: Vanilla DiracX web interface.
38+
- **Framework**: [Next.js 15](https://nextjs.org/) with App Router.
39+
- **Output**: Static export (`output: "export"`).
40+
- **Authentication**: [@axa-fr/react-oidc](https://github.com/AxaFrance/oidc-client).
41+
- **Testing**: [Cypress](https://www.cypress.io/) for end-to-end tests.
42+
- **Serving**: Nginx in production (Docker image).
43+
44+
### extensions (gubbins)
45+
46+
- **Purpose**: Reference example of a custom DiracX web extension.
47+
- **Framework**: Next.js, same setup as `diracx-web`.
48+
- **Demonstrates**: How to extend the application list, add custom components, and deploy as a standalone project.
49+
50+
## Key Directories
51+
52+
| Path | Description |
53+
|---|---|
54+
| `packages/diracx-web-components/src/components/` | Reusable UI components |
55+
| `packages/diracx-web-components/src/contexts/` | React contexts for state management |
56+
| `packages/diracx-web-components/src/hooks/` | Custom React hooks |
57+
| `packages/diracx-web-components/src/types/` | TypeScript type definitions |
58+
| `packages/diracx-web/src/app/` | Next.js App Router pages and layouts |
59+
| `packages/extensions/src/` | Extension source (gubbins example) |
60+
61+
## Routing
62+
63+
DiracX-Web uses [Next.js folder-based routing](https://nextjs.org/docs/app/building-your-application/routing):
64+
65+
- `src/app/(dashboard)/` — Main dashboard (parentheses are ignored in the route, so this is the root URL).
66+
- `src/app/auth/` — Authentication pages, served at `/auth`.
67+
- `page.tsx` files define the UI for a route.
68+
- `layout.tsx` files define shared UI for a segment and its children.
69+
70+
## State Management
71+
72+
- **Application state**: Managed via React Context (`ApplicationProvider`).
73+
- **Session storage**: Each application instance writes its state to `<appId>_State` for share/import functionality.
74+
- **URL encoding**: Dashboard layout is encoded in the URL for sharing.

0 commit comments

Comments
 (0)