-
Notifications
You must be signed in to change notification settings - Fork 15
Fixed for documentation #426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Contributing to DiracX-Web | ||
|
|
||
| *Requirements: [Setup Environment](setup_web_environment.md)* | ||
|
|
||
| === "Documentation" | ||
|
|
||
| Ensure that any code you write is well-documented. This includes: | ||
|
|
||
| - Inline comments where necessary to explain complex logic. | ||
| - Updating or creating Storybook documentation if you are contributing to the `diracx-web-components` library. | ||
| - You can use tools like [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/) to maintain code quality. | ||
|
|
||
| === "Testing" | ||
|
|
||
| **Component Testing** | ||
| : 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. | ||
|
|
||
| **Application Testing** | ||
| : Use [Cypress](https://www.cypress.io/) for end-to-end testing to simulate real user interactions and ensure your application behaves correctly. | ||
|
|
||
| **Test Coverage** | ||
| : 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. | ||
|
|
||
| === "Accessibility" | ||
|
|
||
| Make your application accessible to all users. Use semantic HTML, ARIA attributes, and test your application with different screen sizes and assistive technologies. | ||
|
|
||
| !!! note | ||
| 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. | ||
|
|
||
| !!! warning | ||
| 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. | ||
|
|
||
| !!! note "Pre-commit Hooks" | ||
| `Husky` is configured to run as a pre-commit script, executing tasks such as linting staged files to maintain code consistency with the codebase. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,12 +81,5 @@ export DIRACX_URL=<diracX installation> | |
| npm run --prefix packages/extensions test | ||
| ``` | ||
|
|
||
| ### `gubbins` (backend) | ||
|
|
||
| Follow the instructions from the [Gubbins extension README](https://github.com/DIRACGrid/diracx/tree/main/extensions#work-on-gubbins). | ||
|
|
||
| :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`. | ||
|
|
||
| ## Creating a new extension | ||
|
|
||
| More details available in the [**extensions** README](/packages/extensions/README.md) | ||
|
Comment on lines
-90
to
-92
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you delete this section?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you already answered by yourself. I can revert if you want... |
||
| !!! tip | ||
| 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`. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # Web Architecture | ||
|
|
||
| ## Monorepo Structure | ||
|
|
||
| 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. | ||
|
|
||
| ```mermaid | ||
| --- | ||
| config: | ||
| layout: elk | ||
| --- | ||
| flowchart TD | ||
| subgraph monorepo["Monorepo"] | ||
| components["diracx-web-components"] | ||
| web["diracx-web"] | ||
| extensions["extensions (gubbins)"] | ||
| end | ||
| web -. uses .-> components | ||
| extensions -. uses .-> components | ||
| components -- published on --> npm["npm registry"] | ||
| community["Community extensions"] -. uses .-> npm | ||
| ``` | ||
|
|
||
| ## Packages | ||
|
|
||
| ### diracx-web-components | ||
|
|
||
| - **Purpose**: Reusable React component library. | ||
| - **Build tool**: [tsup](https://tsup.egoist.dev/) for TypeScript compilation. | ||
| - **Design system**: [Material-UI (MUI)](https://mui.com/). | ||
| - **Documentation**: [Storybook](https://storybook.js.org/). | ||
| - **Testing**: [Jest](https://jestjs.io/) + [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/). | ||
| - **Exports**: Components, contexts, hooks, and types as separate modules. | ||
|
|
||
| ### diracx-web | ||
|
|
||
| - **Purpose**: Vanilla DiracX web interface. | ||
| - **Framework**: [Next.js 15](https://nextjs.org/) with App Router. | ||
| - **Output**: Static export (`output: "export"`). | ||
| - **Authentication**: [@axa-fr/react-oidc](https://github.com/AxaFrance/oidc-client). | ||
| - **Testing**: [Cypress](https://www.cypress.io/) for end-to-end tests. | ||
| - **Serving**: Nginx in production (Docker image). | ||
|
|
||
| ### extensions (gubbins) | ||
|
|
||
| - **Purpose**: Reference example of a custom DiracX web extension. | ||
| - **Framework**: Next.js, same setup as `diracx-web`. | ||
| - **Demonstrates**: How to extend the application list, add custom components, and deploy as a standalone project. | ||
|
|
||
| ## Key Directories | ||
|
|
||
| | Path | Description | | ||
| |---|---| | ||
| | `packages/diracx-web-components/src/components/` | Reusable UI components | | ||
| | `packages/diracx-web-components/src/contexts/` | React contexts for state management | | ||
| | `packages/diracx-web-components/src/hooks/` | Custom React hooks | | ||
| | `packages/diracx-web-components/src/types/` | TypeScript type definitions | | ||
| | `packages/diracx-web/src/app/` | Next.js App Router pages and layouts | | ||
| | `packages/extensions/src/` | Extension source (gubbins example) | | ||
|
|
||
| ## Routing | ||
|
|
||
| DiracX-Web uses [Next.js folder-based routing](https://nextjs.org/docs/app/building-your-application/routing): | ||
|
|
||
| - `src/app/(dashboard)/` — Main dashboard (parentheses are ignored in the route, so this is the root URL). | ||
| - `src/app/auth/` — Authentication pages, served at `/auth`. | ||
| - `page.tsx` files define the UI for a route. | ||
| - `layout.tsx` files define shared UI for a segment and its children. | ||
|
|
||
| ## State Management | ||
|
|
||
| - **Application state**: Managed via React Context (`ApplicationProvider`). | ||
| - **Session storage**: Each application instance writes its state to `<appId>_State` for share/import functionality. | ||
| - **URL encoding**: Dashboard layout is encoded in the URL for sharing. |
Uh oh!
There was an error while loading. Please reload this page.