-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(information): migrate to HTML content #1463
Conversation
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
rowCount: number; | ||
}; | ||
|
||
export const EnhancedTableHead = <T extends Data>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Création d'un tableau générique permettant d'afficher la liste des documents, d'en sélectionner et de publier.
C'est un composant générique graphique mais avec également une partie publication qui est commune aux différents contenu. Cette partie affiche une modale avec les contenus sélectionnés et permet de les publier et de suivre l'avancement de l'opération.
Son principal objectif dans un premier temps est de nous permettre de republier des contenus après des migrations de contenu.
Par la suite, on pourra ajouter un bouton pour supprimer. Ajouter le suivi des statuts et principalement celui de savoir si le contenu est publié et dispo en prod, à publier (version en attente de publication)...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok top, j'aurai juste nommé le fichier composant EnhancedTableHead
au lieu de Head
@@ -11,13 +11,12 @@ import React from "react"; | |||
import { useAgreementUpdateMutation } from "./agreement.mutation"; | |||
import { useAgreementQuery } from "./agreement.query"; | |||
import { AgreementForm } from "../Common"; | |||
import { usePublishMutation } from "./publish.mutation"; | |||
import { usePublishMutation } from "../../../documents/components/publish.mutation"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai homogénéisé le usePublicationMutation pour en avoir un seul dans documents. Ca évite de devoir modifier X graphQL quand on veut modifier l'API...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coool
}; | ||
|
||
return ( | ||
<FormControl sx={{ width: 200, marginX: "8px" }} size="small"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ce composant est une amélioration du filtre sur les conventions collectives. Avant on avait un switch, maintenant on a une liste à choix multiple. Plus simple à comprendre et plus jolie.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
color="success" | ||
onClick={() => { | ||
router.push("/agreements/creation"); | ||
<EnhancedTable<AgreementData> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ici, on remplace le code répété pour chaque contenu qui affiche les documents dans un tableau. On remplace par le composant EnhancedTable
.
Ce composant prend la source pour faire automatiquement le publish.
Il va ensuite prendre des headCells
qui sont les différentes colonnes. Pour chaque colonne, on indique la donnée dans l'objet à afficher et on peut customiser le render si besoin.
On a ensuite rows
qui contient le contenu du tableau donc ici les conventions collectives.
On a ensuite les onClick
permettant de rediriger.
Le setSearch
qui permet d'appliquer la recherche
Et pour finir le customFilters
qui permet d'ajouter des filtres spécifiques (comme ici sur les CCs traitées vs non traitées).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sympa le generic pour bien typer
@@ -10,8 +10,7 @@ export const listAgreementsQuery = gql` | |||
agreements: agreement_agreements( | |||
order_by: { id: asc } | |||
where: { | |||
id: { _ilike: $idcc } | |||
name: { _ilike: $keyword } | |||
_or: [{ id: { _ilike: $idcc } }, { shortName: { _ilike: $keyword } }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Petite amélioration sur la recherche dans les CCs. Au lieu d'avoir deux champs, un pour filtrer sur l'idcc et un autre sur le nom, on a un seul champ et on filtre sur les deux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice ;)
props: PublishProps | ||
) => Promise<OperationResult<Result>>; | ||
|
||
export const usePublishMutation = (): PublishMutationResult => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ici c'est le usePublishMutation
générique que l'on réutilise ensuite. Ca permet d'avoir qu'une requête graphQL écrite pour publier dans le code (comme la fonction est générique, c'est plus simple de le faire comme ça).
@@ -21,14 +21,11 @@ export const InformationsBlockText = ({ | |||
spacing={2} | |||
> | |||
<FormControl> | |||
<FormTextField | |||
<FormEditionField |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ce qui nous intéresse dans cette PR :)
J'ai remplacé par le composant tiptap pour éditer une page info.
@@ -48,7 +48,7 @@ export const mapInformationToDocument = async ( | |||
blocks: await Promise.all( | |||
blocks.map(async (block) => { | |||
const htmlWithGlossary = await getGlossaryContent( | |||
"markdown", | |||
"html", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a maintenant du html en entrée :)
@@ -4,6 +4,7 @@ actions: | |||
kind: synchronous | |||
handler: '{{API_URL}}/actions/publish' | |||
forward_client_headers: true | |||
timeout: 180 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai monté le timeout du publish car en local j'avais des pages infos qui prenaient trop de temps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -0,0 +1,1500 @@ | |||
UPDATE information.informations_contents_blocks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Là on migre les données en markdown en html. Il faudra vérifier qu'aucune page info n'a été mise à jour au moment de merge et release la feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
top gg! j'ai juste lu le code mais pas recetté pour info
rowCount: number; | ||
}; | ||
|
||
export const EnhancedTableHead = <T extends Data>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok top, j'aurai juste nommé le fichier composant EnhancedTableHead
au lieu de Head
@@ -11,13 +11,12 @@ import React from "react"; | |||
import { useAgreementUpdateMutation } from "./agreement.mutation"; | |||
import { useAgreementQuery } from "./agreement.query"; | |||
import { AgreementForm } from "../Common"; | |||
import { usePublishMutation } from "./publish.mutation"; | |||
import { usePublishMutation } from "../../../documents/components/publish.mutation"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coool
color="success" | ||
onClick={() => { | ||
router.push("/agreements/creation"); | ||
<EnhancedTable<AgreementData> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sympa le generic pour bien typer
{value ? ( | ||
<Tooltip title="Convention collective traitée par le CDTN"> | ||
<GavelIcon fontSize="small" /> | ||
</Tooltip> | ||
) : undefined} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{value ? ( | |
<Tooltip title="Convention collective traitée par le CDTN"> | |
<GavelIcon fontSize="small" /> | |
</Tooltip> | |
) : undefined} | |
{value && ( | |
<Tooltip title="Convention collective traitée par le CDTN"> | |
<GavelIcon fontSize="small" /> | |
</Tooltip> | |
)} |
@@ -10,8 +10,7 @@ export const listAgreementsQuery = gql` | |||
agreements: agreement_agreements( | |||
order_by: { id: asc } | |||
where: { | |||
id: { _ilike: $idcc } | |||
name: { _ilike: $keyword } | |||
_or: [{ id: { _ilike: $idcc } }, { shortName: { _ilike: $keyword } }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
@@ -4,6 +4,7 @@ actions: | |||
kind: synchronous | |||
handler: '{{API_URL}}/actions/publish' | |||
forward_client_headers: true | |||
timeout: 180 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
No description provided.