-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pci-load-balancer): add deletion pool members modal
ref: DTCORE-2662 Signed-off-by: Yoann Fievez <[email protected]>
- Loading branch information
Showing
15 changed files
with
258 additions
and
7 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...nager/apps/pci-load-balancer/public/translations/pools/members/delete/Messages_de_DE.json
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,6 @@ | ||
{ | ||
"octavia_load_balancer_pools_members_delete_title": "Mitglied löschen", | ||
"octavia_load_balancer_pools_members_delete_description": "Möchten Sie {{ member }} wirklich löschen?", | ||
"octavia_load_balancer_pools_members_delete_cancel": "Abbrechen", | ||
"octavia_load_balancer_pools_members_delete_confirm": "Löschen" | ||
} |
6 changes: 6 additions & 0 deletions
6
...nager/apps/pci-load-balancer/public/translations/pools/members/delete/Messages_en_GB.json
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,6 @@ | ||
{ | ||
"octavia_load_balancer_pools_members_delete_title": "Delete a member", | ||
"octavia_load_balancer_pools_members_delete_description": "Are you sure you want to delete {{ member }}?", | ||
"octavia_load_balancer_pools_members_delete_cancel": "Cancel", | ||
"octavia_load_balancer_pools_members_delete_confirm": "Delete" | ||
} |
6 changes: 6 additions & 0 deletions
6
...nager/apps/pci-load-balancer/public/translations/pools/members/delete/Messages_es_ES.json
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,6 @@ | ||
{ | ||
"octavia_load_balancer_pools_members_delete_title": "Eliminar un miembro", | ||
"octavia_load_balancer_pools_members_delete_description": "¿Seguro que quiere eliminar {{ member }}?", | ||
"octavia_load_balancer_pools_members_delete_cancel": "Cancelar", | ||
"octavia_load_balancer_pools_members_delete_confirm": "Eliminar" | ||
} |
6 changes: 6 additions & 0 deletions
6
...nager/apps/pci-load-balancer/public/translations/pools/members/delete/Messages_fr_CA.json
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,6 @@ | ||
{ | ||
"octavia_load_balancer_pools_members_delete_title": "Supprimer un membre", | ||
"octavia_load_balancer_pools_members_delete_description": "Voulez-vous vraiment supprimer {{ member }} ?", | ||
"octavia_load_balancer_pools_members_delete_cancel": "Annuler", | ||
"octavia_load_balancer_pools_members_delete_confirm": "Supprimer" | ||
} |
6 changes: 6 additions & 0 deletions
6
...nager/apps/pci-load-balancer/public/translations/pools/members/delete/Messages_fr_FR.json
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,6 @@ | ||
{ | ||
"octavia_load_balancer_pools_members_delete_title": "Supprimer un membre", | ||
"octavia_load_balancer_pools_members_delete_description": "Voulez-vous vraiment supprimer {{ member }} ?", | ||
"octavia_load_balancer_pools_members_delete_cancel": "Annuler", | ||
"octavia_load_balancer_pools_members_delete_confirm": "Supprimer" | ||
} |
6 changes: 6 additions & 0 deletions
6
...nager/apps/pci-load-balancer/public/translations/pools/members/delete/Messages_it_IT.json
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,6 @@ | ||
{ | ||
"octavia_load_balancer_pools_members_delete_title": "Elimina un membro", | ||
"octavia_load_balancer_pools_members_delete_description": "Vuoi davvero eliminare {{ member }}?", | ||
"octavia_load_balancer_pools_members_delete_cancel": "Annullare", | ||
"octavia_load_balancer_pools_members_delete_confirm": "Elimina" | ||
} |
6 changes: 6 additions & 0 deletions
6
...nager/apps/pci-load-balancer/public/translations/pools/members/delete/Messages_pl_PL.json
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,6 @@ | ||
{ | ||
"octavia_load_balancer_pools_members_delete_title": "Usuń użytkownika", | ||
"octavia_load_balancer_pools_members_delete_description": "Czy na pewno chcesz usunąć {{ member }}?", | ||
"octavia_load_balancer_pools_members_delete_cancel": "Anuluj", | ||
"octavia_load_balancer_pools_members_delete_confirm": "Usuń" | ||
} |
6 changes: 6 additions & 0 deletions
6
...nager/apps/pci-load-balancer/public/translations/pools/members/delete/Messages_pt_PT.json
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,6 @@ | ||
{ | ||
"octavia_load_balancer_pools_members_delete_title": "Eliminar um membro", | ||
"octavia_load_balancer_pools_members_delete_description": "Tem a certeza de que quer eliminar {{ member }}?", | ||
"octavia_load_balancer_pools_members_delete_cancel": "Anular", | ||
"octavia_load_balancer_pools_members_delete_confirm": "Eliminar" | ||
} |
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
27 changes: 27 additions & 0 deletions
27
.../manager/apps/pci-load-balancer/src/components/detail/pools/members/Actions.component.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,27 @@ | ||
import { ActionMenu } from '@ovh-ux/manager-react-components'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useHref } from 'react-router-dom'; | ||
|
||
export type ActionsComponentProps = { | ||
memberId: string; | ||
}; | ||
export default function ActionsComponent({ | ||
memberId, | ||
}: Readonly<ActionsComponentProps>) { | ||
const { t } = useTranslation('pools/members/list'); | ||
|
||
const items = [ | ||
{ | ||
id: 0, | ||
href: useHref(`../${memberId}/edit`), | ||
label: t('octavia_load_balancer_pools_detail_members_edit'), | ||
}, | ||
{ | ||
id: 1, | ||
href: useHref(`./${memberId}/delete`), | ||
label: t('octavia_load_balancer_pools_detail_members_delete'), | ||
}, | ||
]; | ||
|
||
return <ActionMenu items={items} isCompact />; | ||
} |
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
92 changes: 92 additions & 0 deletions
92
...nager/apps/pci-load-balancer/src/pages/detail/pools/detail/members/delete/Delete.page.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,92 @@ | ||
import { Translation, useTranslation } from 'react-i18next'; | ||
import { DeletionModal } from '@ovh-ux/manager-pci-common'; | ||
import { useNavigate, useParams } from 'react-router-dom'; | ||
import { OsdsText } from '@ovhcloud/ods-components/react'; | ||
import { ODS_TEXT_LEVEL, ODS_TEXT_SIZE } from '@ovhcloud/ods-components'; | ||
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; | ||
import { useNotifications } from '@ovh-ux/manager-react-components'; | ||
import { ApiError } from '@ovh-ux/manager-core-api'; | ||
import { | ||
useDeletePoolMember, | ||
useGetPoolMember, | ||
} from '@/api/hook/usePoolMember'; | ||
|
||
export default function DeletePage() { | ||
const { addSuccess, addError } = useNotifications(); | ||
const { t: tDelete } = useTranslation('pools/members/delete'); | ||
const navigate = useNavigate(); | ||
const { projectId, poolId, region, memberId } = useParams(); | ||
const onClose = () => { | ||
navigate('..'); | ||
}; | ||
const { data: poolMember, isPending: isPendingPoolMember } = useGetPoolMember( | ||
projectId, | ||
poolId, | ||
region, | ||
memberId, | ||
); | ||
const { deletePoolMember, isPending: isPendingDelete } = useDeletePoolMember({ | ||
projectId, | ||
region, | ||
poolId, | ||
memberId, | ||
onError(error: ApiError) { | ||
addError( | ||
<Translation ns="octavia-load-balancer"> | ||
{(_t) => | ||
_t('octavia_load_balancer_global_error', { | ||
message: error?.response?.data?.message || error?.message || null, | ||
requestId: error?.config?.headers['X-OVH-MANAGER-REQUEST-ID'], | ||
}) | ||
} | ||
</Translation>, | ||
true, | ||
); | ||
onClose(); | ||
}, | ||
onSuccess() { | ||
addSuccess( | ||
<Translation ns="pools/members"> | ||
{(_t) => | ||
_t('octavia_load_balancer_pools_detail_members_delete_success', { | ||
member: poolMember?.name, | ||
}) | ||
} | ||
</Translation>, | ||
true, | ||
); | ||
navigate('..'); | ||
}, | ||
}); | ||
|
||
const onConfirm = () => { | ||
deletePoolMember(); | ||
}; | ||
|
||
const onCancel = () => { | ||
navigate('..'); | ||
}; | ||
|
||
return ( | ||
<DeletionModal | ||
title={tDelete('octavia_load_balancer_pools_members_delete_title')} | ||
onConfirm={onConfirm} | ||
onClose={onClose} | ||
onCancel={onCancel} | ||
isPending={isPendingDelete || isPendingPoolMember} | ||
type="warning" | ||
submitText={tDelete('octavia_load_balancer_pools_members_delete_confirm')} | ||
cancelText={tDelete('octavia_load_balancer_pools_members_delete_cancel')} | ||
> | ||
<OsdsText | ||
level={ODS_TEXT_LEVEL.body} | ||
color={ODS_THEME_COLOR_INTENT.text} | ||
size={ODS_TEXT_SIZE._400} | ||
> | ||
{tDelete('octavia_load_balancer_pools_members_delete_description', { | ||
member: poolMember?.name, | ||
})} | ||
</OsdsText> | ||
</DeletionModal> | ||
); | ||
} |
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