Commit Graph

66 Commits

Author SHA1 Message Date
Anthony LC
ec2fcaa1dd ♻️(app-desk) create Auth component
- Create the Auth component, it will manage the authentication.
- Moved auth folder to features folder.
2024-02-05 16:08:22 +01:00
Anthony LC
0b703cda97 🚚(app-desk) move features to features folder
The features were in the app folder, app folder is where Next uses
his router system.
To avoid confusion between the folder router and the features,
we export the features in a feature folder.
2024-02-05 16:08:22 +01:00
Anthony LC
fc6487ddc1 🚚(app-desk) integrate next router with menu
Integrate next router with the menu.
Create most of the pages.
2024-02-05 16:08:22 +01:00
Anthony LC
66dbea3c6d (app-desk) integrate static menu in the app
Integrate the menu from the mockup in the app.
2024-02-05 16:08:22 +01:00
Anthony LC
cbe356214d 🚨(frontend) fix some eslint warnings
- Eslint tried to search some configs in the node_modules folder,
we ignore node_modules in the eslint config now.
- Adapt next eslint to use next/babel.
2024-02-05 16:08:22 +01:00
Anthony LC
ce55721b5d 💄(app-desk) handle svg as react component
The svg in nextjs was not handled as a react component, it was
not possible to change dynamically the color of the svg by example.
We add the @svgr/webpack, it will handle the svg as react component.
We keep as well the way next.js handle the svg, so we can use both
ways.
To handle the svg in the next way we need to add the
`?url` at the end of the svg import.
2024-02-05 16:08:22 +01:00
Anthony LC
32e42e126d 🌐(app-desk) translate Desk in french
Translate app Desk in french thanks to crowdin.
2024-02-05 15:34:37 +01:00
Anthony LC
8043d12315 🚨(i18n) add linter to i18n package
We need to add a linter to the i18n package, we are mainly
interested by the jest linting rules so we create
a jest eslint config pluggable our other configs and to the
i18n eslint config.
2024-02-05 15:34:37 +01:00
Anthony LC
801cb98e15 (i18n) install jest and add tests
We install Jest to test our i18n package.
We tests:
  - the extraction of the translations on the Desk app fo crowdin
  - the formatings of the translations from crowdin to the app
  - we check that all the translations are present in the app
We connect the tests to the CI.
2024-02-05 15:34:37 +01:00
Anthony LC
3d0824e023 🌐(i18n) create package i18n
We create a package i18n to manage the translations of the project.
It help us to extract the translations from the frontend to
be deployed to crowdin.
It also help us to format the translations from crowdin to
be used by the frontend apps.
2024-02-05 15:34:37 +01:00
Anthony LC
7add42f525 🌐(app-desk) plug i18n to LanguagePicker
- Plug i18n to LanguagePicker.
- Make translatable all the string of the app.
2024-02-05 15:34:37 +01:00
Anthony LC
01b7ad3f30 🌐(app-desk) install internationalization
Install internationalization in the Desk app.
We use react-i18next.
2024-02-05 15:34:37 +01:00
renovate[bot]
6a0ed04b0d ⬆️(dependencies) update python dependencies 2024-02-05 13:22:56 +01:00
Anthony LC
21550fe01d 🚨(frontend) fix linting issues
The prettier upgrade was causing some linting issues.
This commit fixes them.
2024-02-05 09:46:30 +01:00
renovate[bot]
92e3e11daf ⬆️(dependencies) update js dependencies 2024-02-05 09:46:30 +01:00
Lebaud Antoine
c54d457fa6 🎨(project) fixed minor code formatting issues in .sops.yaml
Identified and resolved minor code formatting issues.

Updates:
* Add a newline at the end of the file
* Capitalize first names and last names of all users.
2024-02-01 13:54:18 +01:00
Marie
6f18713a7e 📝(doc) improve test names and docstrings
improve test names and docstrings

Co-authored-by: aleb_the_flash <45729124+lebaudantoine@users.noreply.github.com>
2024-02-01 10:36:06 +01:00
Samuel Paccoud - DINUM
a4ac5304d7 🐛(api) return best matching identity only
Use best matching identity to order results.
2024-02-01 10:36:06 +01:00
Marie PUPO JEAMMET
3aba9a4419 🐛(api) enable search on identites instead of users
A previous PR enabled user search using the email. After discussion models,
we chose to enable research on identities, while still returning users.
2024-02-01 10:36:06 +01:00
Jacques ROUSSEL
5b0b2933a2 🔧(sops) update secrets
Decrypt and reencrypt secrets to grant access to marie's key
2024-01-31 18:50:58 +01:00
Marie PUPO JEAMMET
31a5518a5c 🔧(sops) add maries public key
add marie's key to grant her access
2024-01-31 18:50:58 +01:00
Anthony LC
13a58d6fa0 🚨(frontend) fix linting issues
The prettier upgrade was causing some linting issues.
This commit fixes them.
2024-01-30 09:26:33 +01:00
renovate[bot]
83d9310c26 ⬆️(dependencies) update js dependencies 2024-01-30 09:26:33 +01:00
renovate[bot]
6abcf98ad2 ⬆️(dependencies) update python dependencies
Fix new linter issues introduced by Ruff's upgrade.
2024-01-29 15:48:23 +01:00
Lebaud Antoine
ab7d466823 🔧(project) enable renovate dependency dashboard
Enable renovate bot to open an issue with a dependency dashboard.
2024-01-29 15:09:13 +01:00
Jacques ROUSSEL
ab9aac08b0 👷(ci) sops: Add age key
Add key for Antoine Lebaud
2024-01-29 14:39:37 +01:00
Lebaud Antoine
d5f16cddb0 🔧(project) update Renovate configuration to fix match manager issue
The current Renovate configuration is using the wrong match manager, as our
project utilizes `pyproject.toml` instead of `setup.cfg`. This commit corrects
the configuration to ensure compatibility with our project structure.
2024-01-29 13:24:17 +01:00
Jacques ROUSSEL
54f64838a0 👷(ci) sops: Add age key
Add key for Anthony Le-Courric
2024-01-29 12:10:49 +01:00
Marie
269ba42204 (api) search users by email (#16)
* (api) search users by email

The front end should be able to search users by email.
To that goal, we added a list method to the users viewset
thus creating the /users/ endpoint.
Results are filtered based on similarity with the query,
based on what preexisted for the /contacts/ endpoint.

* (api) test list users by email

Test search when complete, partial query,
accentuated and capital.
Also, lower similarity threshold for user search by email
as it was too high for some tests to pass.

* 💡(api) improve documentation and test comments

Improve user viewset documentation
and comments describing tests sections

Co-authored-by: aleb_the_flash <45729124+lebaudantoine@users.noreply.github.com>
Co-authored-by: Anthony LC <anthony.le-courric@mail.numerique.gouv.fr>

* 🛂(api) set isAuthenticated as base requirements

Instead of checking permissions or adding decorators
to every viewset, isAuthenticated is set as base requirement.

* 🛂(api) define throttle limits in settings

Use of Djando Rest Framework's throttle options, now set globally
to avoid duplicate code.

* 🩹(api) add email to user serializer

email field added to serializer. Tests modified accordingly.
I added the email field as "read only" to pass tests, but we need to discuss
that point in review.

* 🧱(api) move search logic to queryset

User viewset "list" method was overridden to allow search by email.
This removed the pagination. Instead of manually re-adding pagination at
the end of this method, I moved the search/filter logic to get_queryset,
to leave DRF handle pagination.

* (api) test throttle protection

Test that throttle protection succesfully blocks too many requests.

* 📝(tests) improve tests comment

Fix typos on comments and clarify which setting are tested on test_throttle test
(setting import required disabling pylint false positive error)

Co-authored-by: aleb_the_flash <45729124+lebaudantoine@users.noreply.github.com>

---------

Co-authored-by: aleb_the_flash <45729124+lebaudantoine@users.noreply.github.com>
Co-authored-by: Anthony LC <anthony.le-courric@mail.numerique.gouv.fr>
2024-01-29 10:14:17 +01:00
Jacques ROUSSEL
8f2f47d3b1 👷(ci) sops: configure workflows to use sops secrets
Github secrets are difficult to maintain in time because we do not have
a way to track them efficiently. So to avoid this issue, we prefer to use
sops encrypted files to manage our secrets.
2024-01-29 08:56:43 +01:00
Anthony LC
c2c6ae88db 🚨(frontend) create package eslint-config-people
We want to lint the e2e tests, we export the eslint config from the
app desk to a package in order to use it for the e2e tests and
for our apps.
2024-01-24 16:14:03 +01:00
Anthony LC
3b155b708c 🚨(app-desk) add eslint-plugin-jsx-a11y
eslint-plugin-jsx-a11y is a plugin that provides a set of
accessibility rules that can find common
accessibility problems in your React.js elements.
2024-01-24 16:14:03 +01:00
Anthony LC
e8186408a0 🚨(add-desk) remove hydratation warning
When working with Next, some browser (like Brave) gives us
warning about hydratation. This commit remove this warning.
2024-01-24 16:14:03 +01:00
Anthony LC
38997fef6a (app-desk) design static LanguagePicker
Design static LanguagePicker, we will add the interactivity later.
2024-01-24 16:14:03 +01:00
Anthony LC
5062cac623 (app-desk) design static Header
Design static Header, we will add the interactivity later.
2024-01-24 16:14:03 +01:00
Anthony LC
5b4fe1e77f 🧑‍💻(app-desk) add styled-components and create generic components
Add styled-components to the app-desk, it will help us to create
easily styled components.
We create 2 components, Box and Text, it is 2 generic components
that we help us to style quickly html elements. They use
the power of styled-components and Cunningham's design system.
2024-01-24 16:14:03 +01:00
Anthony LC
30721b9ef9 🏷️(app-desk) add custom-next.d.ts file
Add custom-next.d.ts file to augment types.
We add our environment variables to avoid mispelling
and to have better autocompletion.
2024-01-24 16:14:03 +01:00
Anthony LC
e2618d0e11 💄(app-desk) add DSFR theme to Cunningham
In order to have the look and feel of the DSFR, we
create a DSFR theme to the Cunningham design system.
2024-01-24 16:14:03 +01:00
Anthony LC
97e7d99c02 🏗️(project) expose app Desk to nginx
Now that we have a out folder for the Desk app, we can expose it
to our server nginx.
2024-01-23 12:59:15 +01:00
Anthony LC
9ee39e1068 🏗️(app-desk) export app in out folder
We export the app in the out folder. This is a static export,
so our app can be deployed and hosted
on any web server that can serve HTML/CSS/JS static assets.
2024-01-23 12:59:15 +01:00
Anthony LC
c6823ba698 🛂(app-desk) create fetchAPI
Create a fetch wrapper for the API calls, it will handle:
- add correct basename on the api request
- add Bearer automatically on the api request
- logout automatically on 401 request
2024-01-23 12:59:15 +01:00
Anthony LC
da851f508a 👷(CI) add test-e2e job to people.yml
Add test-e2e to people.yml, it will run e2e tests on every PR.
Steps:
  - set env vars for e2e tests
  - build and start docker servers
  (backend, keycloak, DB)
  - install playwright
  - build apps
  - run e2e tests
  - save reports
2024-01-23 12:59:15 +01:00
Anthony LC
5f280ae3fc (app-desk) e2e test app-desk
Tests:
- login to keycloak
- create new teams
- check teams are displayed
2024-01-23 12:59:15 +01:00
Anthony LC
2ef31a424a (project) install e2e playwright
Install playwright, adapt the config file and add a scripts to
run the tests.
e2e testing will monitor all our frontend applications,
so we install it in the frontend folder.
It configures the base of our monorepo.
2024-01-23 12:59:15 +01:00
Anthony LC
fc7747dddf 🚚(frontend) rename folder app to apps
The folder app will be used for more than one app, so it was
renamed to apps.
2024-01-23 12:59:15 +01:00
Anthony LC
ba21784eab (app-desk) add fetch-mock and adapt the tests
- Adapt the tests to use React-Query
- Install fetch-mock to mock the fetch requests with Jest.
- Create a test to show how to mock the fetch requests
with fetch-mock
2024-01-17 13:37:55 +01:00
Samuel Paccoud - DINUM
0c550ebd1c (demo) add a "demo" app to facilitate testing/working on the project
We designed it to allow creating a huge number of objects fast using
bulk creation.
2024-01-17 13:37:55 +01:00
Samuel Paccoud - DINUM
cfc35ac23e ♻️(models) rename *_on fields to *_at
This is only for display, nothing has changed in database.
2024-01-17 13:37:55 +01:00
Samuel Paccoud - DINUM
65cfe7ff2b (admin) configure a minimum admin with users and teams
We added identities and team accesses as inlines.
2024-01-17 13:37:55 +01:00
Samuel Paccoud - DINUM
8b026078bc (models) make user and authentication work with Keycloak and admin
The admin was broken as we did not worry about it up to now. On the frontend
we want to use OIDC authentication only but for the admin, it is better if
the default authentication works as well. To allow this, we propose to add
an "email" field to the user model and make it the identifier in place of
the usual username. Some changes are necessary to make the "createsuperuser"
management command work.

We also had to fix the "oidc_user_getter" method to make it work with Keycloak.
Some tests were added to secure that everything works as expected.
2024-01-17 13:37:55 +01:00