Skip to content

Commit

Permalink
feat: Add functionalities for bulk tag operations (GSoC) (#2362)
Browse files Browse the repository at this point in the history
* add people to tag functaionality

* minor change

* more translations

* minor change

* add a variable for page size

* add tag actions

* add tests

* translations

* add subtags infinite scroll

* minor correction

* exclude ManageTag from countline check

* fix linting

* fix linting

* fix linting

* make coderabbit suggested changes

* more changes

* more changes

* minor correction

* add error component for tagNode subtags query

* fix translation

* fix translation
  • Loading branch information
meetulr authored Oct 30, 2024
1 parent 6fadd0c commit af2f509
Show file tree
Hide file tree
Showing 18 changed files with 2,396 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Count number of lines
run: |
chmod +x ./.github/workflows/countline.py
./.github/workflows/countline.py --lines 600 --exclude_files src/screens/LoginPage/LoginPage.tsx src/GraphQl/Queries/Queries.ts src/screens/OrgList/OrgList.tsx src/GraphQl/Mutations/mutations.ts src/components/EventListCard/EventListCardModals.tsx
./.github/workflows/countline.py --lines 600 --exclude_files src/screens/LoginPage/LoginPage.tsx src/GraphQl/Queries/Queries.ts src/screens/OrgList/OrgList.tsx src/GraphQl/Mutations/mutations.ts src/components/EventListCard/EventListCardModals.tsx src/screens/ManageTag/ManageTag.tsx
- name: Get changed TypeScript files
id: changed-files
Expand Down
24 changes: 22 additions & 2 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,31 @@
"subTags": "Sub Tags",
"assignedToAll": "Tag Assigned to All",
"successfullyAssignedToPeople": "Tag assigned successfully",
"assignPeople": "Assign",
"errorOccurredWhileLoadingMembers": "Error occured while loading members",
"userName": "User Name",
"actions": "Actions",
"noOneSelected": "No One Selected"
"noOneSelected": "No One Selected",
"assignToTags": "Assign to Tags",
"removeFromTags": "Remove from Tags",
"assign": "Assign",
"remove": "Remove",
"successfullyAssignedToTags": "Successfully Assigned to Tags",
"successfullyRemovedFromTags": "Successfully Removed from Tags",
"errorOccurredWhileLoadingOrganizationUserTags": "Error occurred while loading organization tags",
"errorOccurredWhileLoadingSubTags": "Error occurred while loading subTags tags",
"removeUserTag": "Delete Tag",
"removeUserTagMessage": "Do you want to delete this tag? It delete all the sub tags and all the associations.",
"tagDetails": "Tag Details",
"tagName": "Name",
"tagUpdationSuccess": "Tag updated successfully",
"tagRemovalSuccess": "Tag deleted successfully",
"noTagSelected": "No Tag Selected",
"changeNameToEdit": "Change the name to make an update",
"selectTag": "Select Tag",
"collapse": "Collapse",
"expand": "Expand",
"tagNamePlaceholder": "Write the name of the tag",
"allTags": "All Tags"
},
"userListCard": {
"addAdmin": "Add Admin",
Expand Down
24 changes: 22 additions & 2 deletions public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,31 @@
"subTags": "Sous-étiquettes",
"assignedToAll": "Étiquette attribuée à tous",
"successfullyAssignedToPeople": "Étiquette attribuée avec succès",
"assignPeople": "Attribuer",
"errorOccurredWhileLoadingMembers": "Erreur survenue lors du chargement des membres",
"userName": "Nom d'utilisateur",
"actions": "Actions",
"noOneSelected": "Personne sélectionnée"
"noOneSelected": "Personne sélectionnée",
"assignToTags": "Attribuer aux étiquettes",
"removeFromTags": "Retirer des étiquettes",
"assign": "Attribuer",
"remove": "Retirer",
"successfullyAssignedToTags": "Attribué aux étiquettes avec succès",
"successfullyRemovedFromTags": "Retiré des étiquettes avec succès",
"errorOccurredWhileLoadingOrganizationUserTags": "Erreur lors du chargement des étiquettes de l'organisation",
"errorOccurredWhileLoadingSubTags": "Une erreur s'est produite lors du chargement des sous-étiquettes",
"removeUserTag": "Supprimer l'étiquette",
"removeUserTagMessage": "Voulez-vous supprimer cette étiquette ? Cela supprimera toutes les sous-étiquettes et toutes les associations.",
"tagDetails": "Détails de l'étiquette",
"tagName": "Nom de l'étiquette",
"tagUpdationSuccess": "Étiquette mise à jour avec succès",
"tagRemovalSuccess": "Étiquette supprimée avec succès",
"noTagSelected": "Aucune étiquette sélectionnée",
"changeNameToEdit": "Modifiez le nom pour faire une mise à jour",
"selectTag": "Sélectionner l'étiquette",
"collapse": "Réduire",
"expand": "Développer",
"tagNamePlaceholder": "Écrire le nom de l'étiquette",
"allTags": "Toutes les étiquettes"
},
"userListCard": {
"addAdmin": "Ajouter un administrateur",
Expand Down
24 changes: 22 additions & 2 deletions public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,31 @@
"subTags": "उप-टैग्स",
"assignedToAll": "सभी को टैग असाइन किया गया",
"successfullyAssignedToPeople": "टैग सफलतापूर्वक असाइन किया गया",
"assignPeople": "असाइन करें",
"errorOccurredWhileLoadingMembers": "सदस्यों को लोड करते समय त्रुटि हुई",
"userName": "उपयोगकर्ता नाम",
"actions": "क्रियाएँ",
"noOneSelected": "कोई चयनित नहीं"
"noOneSelected": "कोई चयनित नहीं",
"assignToTags": "टैग्स को असाइन करें",
"removeFromTags": "टैग्स से हटाएं",
"assign": "असाइन करें",
"remove": "हटाएं",
"successfullyAssignedToTags": "सफलतापूर्वक टैग्स को असाइन किया गया",
"successfullyRemovedFromTags": "सफलतापूर्वक टैग्स से हटाया गया",
"errorOccurredWhileLoadingOrganizationUserTags": "संगठन टैग्स को लोड करते समय त्रुटि हुई",
"errorOccurredWhileLoadingSubTags": "उप-टैग लोड करते समय त्रुटि हुई",
"removeUserTag": "टैग हटाएं",
"removeUserTagMessage": "क्या आप इस टैग को हटाना चाहते हैं? यह सभी उप-टैग्स और सभी संबंधों को हटा देगा।",
"tagDetails": "टैग विवरण",
"tagName": "नाम",
"tagUpdationSuccess": "टैग सफलतापूर्वक अपडेट की गई",
"tagRemovalSuccess": "टैग सफलतापूर्वक हटाई गई",
"noTagSelected": "कोई टैग चयनित नहीं",
"changeNameToEdit": "अपडेट करने के लिए नाम बदलें",
"selectTag": "टैग चुनें",
"collapse": "संक्षिप्त करें",
"expand": "विस्तारित करें",
"tagNamePlaceholder": "टैग का नाम लिखें",
"allTags": "सभी टैग"
},
"userListCard": {
"addAdmin": "व्यवस्थापक जोड़ें",
Expand Down
24 changes: 22 additions & 2 deletions public/locales/sp/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,31 @@
"subTags": "Subetiquetas",
"assignedToAll": "Etiqueta asignada a todos",
"successfullyAssignedToPeople": "Etiqueta asignada con éxito",
"assignPeople": "Asignar",
"errorOccurredWhileLoadingMembers": "Error al cargar los miembros",
"userName": "Nombre de usuario",
"actions": "Acciones",
"noOneSelected": "Nadie seleccionado"
"noOneSelected": "Nadie seleccionado",
"assignToTags": "Asignar a etiquetas",
"removeFromTags": "Eliminar de etiquetas",
"assign": "Asignar",
"remove": "Eliminar",
"successfullyAssignedToTags": "Asignado a etiquetas con éxito",
"successfullyRemovedFromTags": "Eliminado de etiquetas con éxito",
"errorOccurredWhileLoadingOrganizationUserTags": "Error al cargar las etiquetas de la organización",
"errorOccurredWhileLoadingSubTags": "Ocurrió un error al cargar las subetiquetas",
"removeUserTag": "Eliminar etiqueta",
"removeUserTagMessage": "¿Desea eliminar esta etiqueta? Esto eliminará todas las subetiquetas y todas las asociaciones.",
"tagDetails": "Detalles de la etiqueta",
"tagName": "Nombre",
"tagUpdationSuccess": "Etiqueta actualizada con éxito",
"tagRemovalSuccess": "Etiqueta eliminada con éxito",
"noTagSelected": "Ninguna etiqueta seleccionada",
"changeNameToEdit": "Cambia el nombre para hacer una actualización",
"selectTag": "Seleccionar etiqueta",
"collapse": "Colapsar",
"expand": "Expandir",
"tagNamePlaceholder": "Escribe el nombre de la etiqueta",
"allTags": "Todas las etiquetas"
},
"userListCard": {
"joined": "Unido",
Expand Down
24 changes: 22 additions & 2 deletions public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,31 @@
"subTags": "子标签",
"assignedToAll": "标签分配给所有人",
"successfullyAssignedToPeople": "标签分配成功",
"assignPeople": "分配",
"errorOccurredWhileLoadingMembers": "加载成员时出错",
"userName": "用户名",
"actions": "操作",
"noOneSelected": "未选择任何人"
"noOneSelected": "未选择任何人",
"assignToTags": "分配到标签",
"removeFromTags": "从标签中移除",
"assign": "分配",
"remove": "移除",
"successfullyAssignedToTags": "成功分配到标签",
"successfullyRemovedFromTags": "成功从标签中移除",
"errorOccurredWhileLoadingOrganizationUserTags": "加载组织标签时出错",
"errorOccurredWhileLoadingSubTags": "加载子标签时发生错误",
"removeUserTag": "删除标签",
"removeUserTagMessage": "您要删除此标签吗?这将删除所有子标签和所有关联。",
"tagDetails": "标签详情",
"tagName": "名称",
"tagUpdationSuccess": "标签更新成功",
"tagRemovalSuccess": "标签删除成功",
"noTagSelected": "未选择标签",
"changeNameToEdit": "更改名称以进行更新",
"selectTag": "选择标签",
"collapse": "收起",
"expand": "展开",
"tagNamePlaceholder": "输入标签名称",
"allTags": "所有标签"
},
"userListCard": {
"addAdmin": "添加管理员",
Expand Down
34 changes: 34 additions & 0 deletions src/GraphQl/Mutations/TagMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,37 @@ export const ADD_PEOPLE_TO_TAG = gql`
}
}
`;

/**
* GraphQL mutation to assign people to multiple tags.
*
* @param currentTagId - Id of the current tag.
* @param selectedTagIds - Ids of the selected tags to be assined.
*/

export const ASSIGN_TO_TAGS = gql`
mutation AssignToUserTags($currentTagId: ID!, $selectedTagIds: [ID!]!) {
assignToUserTags(
input: { currentTagId: $currentTagId, selectedTagIds: $selectedTagIds }
) {
_id
}
}
`;

/**
* GraphQL mutation to remove people from multiple tags.
*
* @param currentTagId - Id of the current tag.
* @param selectedTagIds - Ids of the selected tags to be removed from.
*/

export const REMOVE_FROM_TAGS = gql`
mutation RemoveFromUserTags($currentTagId: ID!, $selectedTagIds: [ID!]!) {
removeFromUserTags(
input: { currentTagId: $currentTagId, selectedTagIds: $selectedTagIds }
) {
_id
}
}
`;
2 changes: 1 addition & 1 deletion src/components/AddPeopleToTag/AddPeopleToTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ const AddPeopleToTag: React.FC<InterfaceAddPeopleToTagProps> = ({
variant="primary"
data-testid="assignPeopleBtn"
>
{t('assignPeople')}
{t('assign')}
</Button>
</Modal.Footer>
</Form>
Expand Down
Loading

0 comments on commit af2f509

Please sign in to comment.