-
Notifications
You must be signed in to change notification settings - Fork 7
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
Tags personnalisés sur la fiche action #3440
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
eb8a098
Ajout de tags de suivi personnalisés à la fiche action
mariheck f7ab0b3
fix: add libres tag to update
elisfainstein 9fab0df
test: adapt to libre tag, probably temporary delete strategy
elisfainstein a0c7901
Corrige des problèmes de typage
mariheck 9631909
fix: add forgotten columns
elisfainstein b2a8912
feature: add libres tag creation to update service
elisfainstein 38bdfb9
feat: add user uuid directly from auth on libres tag update
elisfainstein 5524925
refactor: add example comments + refactor into more expressive functions
elisfainstein cedce62
Ajoute le bouton Exporter dans les pages Indicateur
marc-rutkowski 3fbbb70
Améliore le tri des données exportées
marc-rutkowski 4d874fe
Evite que la colonne "type de données" soit vide
marc-rutkowski 9ac57a3
Change le libellé et le style du bouton d'export des indicateurs
marc-rutkowski b64a327
fix: add libres tag to update
elisfainstein 9cee14c
test: adapt to libre tag, probably temporary delete strategy
elisfainstein 53ba5d2
feature: add libres tag creation to update service
elisfainstein f53fa8c
fix: insert libres tags in table in beforeAll
elisfainstein 6b27077
refactor: remove useless clean hook in tests
elisfainstein 53caac8
fix: fix fixture inserts for libre tag
elisfainstein f2bc1f0
Mise à jour des types de référentiels
mariheck 64dc62d
Fix après rebase
mariheck 3490f49
Corrige l'affichage des tags personnalisés
mariheck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// TODO : This should be defined in generated | ||
|
||
export type Referentiel = 'eci' | 'cae'; | ||
export type Referentiel = 'eci' | 'cae' | 'te' | 'te-test'; | ||
export type ReferentielOfIndicateur = 'eci' | 'cae' | 'crte'; |
42 changes: 42 additions & 0 deletions
42
...ntransitions.react/src/ui/dropdownLists/TagsSuiviPersoDropdown/TagsSuiviPersoDropdown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Tag } from '@tet/api/shared/domain'; | ||
import { SelectMultipleProps } from '@tet/ui'; | ||
import SelectTags from '../tags/SelectTags'; | ||
import { useTagsSuiviPersoListe } from './useTagsSuiviPersoListe'; | ||
import { LibreTag } from '@tet/api/typeUtils'; | ||
|
||
type TagsSuiviPersoDropdownProps = Omit< | ||
SelectMultipleProps, | ||
'values' | 'onChange' | 'options' | ||
> & { | ||
values?: number[]; | ||
onChange: ({ | ||
libresTag, | ||
selectedLibreTag, | ||
}: { | ||
libresTag: LibreTag[]; | ||
selectedLibreTag: LibreTag; | ||
}) => void; | ||
}; | ||
|
||
const TagsSuiviPersoDropdown = (props: TagsSuiviPersoDropdownProps) => { | ||
const { data, refetch } = useTagsSuiviPersoListe(); | ||
|
||
return ( | ||
<SelectTags | ||
{...props} | ||
placeholder={props.placeholder ?? 'Créez un tag de suivi personnalisé'} | ||
queryKey="tags_suivi_perso" | ||
tagTableName="libre_tag" | ||
optionsListe={data} | ||
refetchOptions={refetch} | ||
onChange={({ values, selectedValue }) => { | ||
props.onChange({ | ||
libresTag: values, | ||
selectedLibreTag: selectedValue, | ||
}); | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export default TagsSuiviPersoDropdown; |
23 changes: 23 additions & 0 deletions
23
...entransitions.react/src/ui/dropdownLists/TagsSuiviPersoDropdown/useTagsSuiviPersoListe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Tag } from '@tet/api/shared/domain'; | ||
import { supabaseClient } from 'core-logic/api/supabase'; | ||
import { useCollectiviteId } from 'core-logic/hooks/params'; | ||
import { useQuery } from 'react-query'; | ||
import { objectToCamel } from 'ts-case-convert'; | ||
|
||
export const useTagsSuiviPersoListe = () => { | ||
const collectiviteId = useCollectiviteId()!; | ||
|
||
return useQuery(['tags_suivi_perso', collectiviteId], async () => { | ||
const { error, data } = await supabaseClient | ||
.from('libre_tag') | ||
.select() | ||
.eq('collectivite_id', collectiviteId) | ||
.order('nom'); | ||
|
||
if (error) { | ||
throw new Error(error.message); | ||
} | ||
|
||
return objectToCamel(data) as Tag[]; | ||
}); | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
C'est déclenché dans quels cas le refetch sur ce composant ?
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.
Lors de la création, suppression ou mise à jour d'un tag dans les options du dropdown