-
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 delete l7 rules modal
ref: DTCORE-2646 Signed-off-by: Yoann Fievez <[email protected]>
- Loading branch information
Showing
12 changed files
with
191 additions
and
6 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...es/manager/apps/pci-load-balancer/public/translations/l7/rules/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,7 @@ | ||
{ | ||
"octavia_load_balancer_list_l7_rules_delete_title": "L7 Rule löschen", | ||
"octavia_load_balancer_list_l7_rules_delete_description": "Möchten Sie Ihre L7 Rule wirklich löschen?", | ||
"octavia_load_balancer_list_l7_rules_delete_cancel": "Abbrechen", | ||
"octavia_load_balancer_list_l7_rules_delete_confirm": "Löschen", | ||
"octavia_load_balancer_list_l7_rules_delete_success": "Ihre L7 Rule wurde erfolgreich gelöscht!" | ||
} |
7 changes: 7 additions & 0 deletions
7
...es/manager/apps/pci-load-balancer/public/translations/l7/rules/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,7 @@ | ||
{ | ||
"octavia_load_balancer_list_l7_rules_delete_title": "Delete an L7 rule", | ||
"octavia_load_balancer_list_l7_rules_delete_description": "Are you sure you want to delete your L7 rule?", | ||
"octavia_load_balancer_list_l7_rules_delete_cancel": "Cancel", | ||
"octavia_load_balancer_list_l7_rules_delete_confirm": "Delete", | ||
"octavia_load_balancer_list_l7_rules_delete_success": "Your L7 rule has been deleted." | ||
} |
7 changes: 7 additions & 0 deletions
7
...es/manager/apps/pci-load-balancer/public/translations/l7/rules/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,7 @@ | ||
{ | ||
"octavia_load_balancer_list_l7_rules_delete_title": "Eliminar una L7 rule", | ||
"octavia_load_balancer_list_l7_rules_delete_description": "¿Seguro que quiere eliminar la L7 rule?", | ||
"octavia_load_balancer_list_l7_rules_delete_cancel": "Cancelar", | ||
"octavia_load_balancer_list_l7_rules_delete_confirm": "Eliminar", | ||
"octavia_load_balancer_list_l7_rules_delete_success": "¡Su L7 rule se ha eliminado correctamente!" | ||
} |
7 changes: 7 additions & 0 deletions
7
...es/manager/apps/pci-load-balancer/public/translations/l7/rules/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,7 @@ | ||
{ | ||
"octavia_load_balancer_list_l7_rules_delete_title": "Supprimer une L7 rule", | ||
"octavia_load_balancer_list_l7_rules_delete_description": "Souhaitez-vous vraiment supprimer votre L7 rule ?", | ||
"octavia_load_balancer_list_l7_rules_delete_cancel": "Annuler", | ||
"octavia_load_balancer_list_l7_rules_delete_confirm": "Supprimer", | ||
"octavia_load_balancer_list_l7_rules_delete_success": "Votre L7 rule a été supprimée avec succès !" | ||
} |
7 changes: 7 additions & 0 deletions
7
...es/manager/apps/pci-load-balancer/public/translations/l7/rules/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,7 @@ | ||
{ | ||
"octavia_load_balancer_list_l7_rules_delete_title": "Supprimer une L7 rule", | ||
"octavia_load_balancer_list_l7_rules_delete_description": "Souhaitez-vous vraiment supprimer votre L7 rule ?", | ||
"octavia_load_balancer_list_l7_rules_delete_cancel": "Annuler", | ||
"octavia_load_balancer_list_l7_rules_delete_confirm": "Supprimer", | ||
"octavia_load_balancer_list_l7_rules_delete_success": "Votre L7 rule a été supprimée avec succès !" | ||
} |
7 changes: 7 additions & 0 deletions
7
...es/manager/apps/pci-load-balancer/public/translations/l7/rules/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,7 @@ | ||
{ | ||
"octavia_load_balancer_list_l7_rules_delete_title": "Eliminare una L7 rule", | ||
"octavia_load_balancer_list_l7_rules_delete_description": "Vuoi davvero eliminare la L7 rule?", | ||
"octavia_load_balancer_list_l7_rules_delete_cancel": "Annullare", | ||
"octavia_load_balancer_list_l7_rules_delete_confirm": "Elimina", | ||
"octavia_load_balancer_list_l7_rules_delete_success": "La L7 rule è stata eliminata correttamente." | ||
} |
7 changes: 7 additions & 0 deletions
7
...es/manager/apps/pci-load-balancer/public/translations/l7/rules/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,7 @@ | ||
{ | ||
"octavia_load_balancer_list_l7_rules_delete_title": "Usuń L7 rule", | ||
"octavia_load_balancer_list_l7_rules_delete_description": "Czy na pewno chcesz usunąć Twoją L7 rule?", | ||
"octavia_load_balancer_list_l7_rules_delete_cancel": "Anuluj", | ||
"octavia_load_balancer_list_l7_rules_delete_confirm": "Usuń", | ||
"octavia_load_balancer_list_l7_rules_delete_success": "Twoja L7 rule została usunięta." | ||
} |
7 changes: 7 additions & 0 deletions
7
...es/manager/apps/pci-load-balancer/public/translations/l7/rules/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,7 @@ | ||
{ | ||
"octavia_load_balancer_list_l7_rules_delete_title": "Eliminar uma L7 rule", | ||
"octavia_load_balancer_list_l7_rules_delete_description": "Tem a certeza de que quer eliminar a sua L7 rule?", | ||
"octavia_load_balancer_list_l7_rules_delete_cancel": "Anular", | ||
"octavia_load_balancer_list_l7_rules_delete_confirm": "Eliminar", | ||
"octavia_load_balancer_list_l7_rules_delete_success": "A sua L7 rule foi eliminada com sucesso!" | ||
} |
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
77 changes: 77 additions & 0 deletions
77
...manager/apps/pci-load-balancer/src/pages/detail/listeners/l7/rules/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,77 @@ | ||
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 { useDeleteL7Rule } from '@/api/hook/useL7Rule'; | ||
|
||
export default function DeletePage() { | ||
const { addSuccess, addError } = useNotifications(); | ||
const { t: tDelete } = useTranslation('l7/rules/delete'); | ||
const navigate = useNavigate(); | ||
const { projectId, policyId, region, ruleId } = useParams(); | ||
const onClose = () => { | ||
navigate('..'); | ||
}; | ||
const { deleteL7Rule, isPending: isPendingDelete } = useDeleteL7Rule({ | ||
projectId, | ||
region, | ||
policyId, | ||
ruleId, | ||
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="octavia-load-balancer-l7"> | ||
{(_t) => _t('octavia_load_balancer_list_l7_policies_delete_success')} | ||
</Translation>, | ||
true, | ||
); | ||
navigate('..'); | ||
}, | ||
}); | ||
|
||
const onConfirm = () => { | ||
deleteL7Rule(); | ||
}; | ||
|
||
const onCancel = () => { | ||
navigate('..'); | ||
}; | ||
|
||
return ( | ||
<DeletionModal | ||
title={tDelete('octavia_load_balancer_list_l7_rules_delete_title')} | ||
onConfirm={onConfirm} | ||
onClose={onClose} | ||
onCancel={onCancel} | ||
isPending={isPendingDelete} | ||
type="warning" | ||
submitText={tDelete('octavia_load_balancer_list_l7_rules_delete_confirm')} | ||
cancelText={tDelete('octavia_load_balancer_list_l7_rules_delete_cancel')} | ||
> | ||
<OsdsText | ||
level={ODS_TEXT_LEVEL.body} | ||
color={ODS_THEME_COLOR_INTENT.text} | ||
size={ODS_TEXT_SIZE._400} | ||
> | ||
{tDelete('octavia_load_balancer_list_l7_rules_delete_description')} | ||
</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