-
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 l7 rule edit page
ref: DTCORE-2645 Signed-off-by: Yoann Fievez <[email protected]>
- Loading branch information
Showing
14 changed files
with
194 additions
and
23 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...ages/manager/apps/pci-load-balancer/public/translations/l7/rules/edit/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,3 @@ | ||
{ | ||
"octavia_load_balancer_edit_l7_rule_success": "Ihre L7 Rule wurde erfolgreich geändert!" | ||
} |
3 changes: 3 additions & 0 deletions
3
...ages/manager/apps/pci-load-balancer/public/translations/l7/rules/edit/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,3 @@ | ||
{ | ||
"octavia_load_balancer_edit_l7_rule_success": "Your L7 rule has been modified." | ||
} |
3 changes: 3 additions & 0 deletions
3
...ages/manager/apps/pci-load-balancer/public/translations/l7/rules/edit/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,3 @@ | ||
{ | ||
"octavia_load_balancer_edit_l7_rule_success": "¡Su L7 rule se ha modificado correctamente!" | ||
} |
3 changes: 3 additions & 0 deletions
3
...ages/manager/apps/pci-load-balancer/public/translations/l7/rules/edit/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,3 @@ | ||
{ | ||
"octavia_load_balancer_edit_l7_rule_success": "Votre L7 rule a été modifée avec succès !" | ||
} |
3 changes: 3 additions & 0 deletions
3
...ages/manager/apps/pci-load-balancer/public/translations/l7/rules/edit/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,3 @@ | ||
{ | ||
"octavia_load_balancer_edit_l7_rule_success": "Votre L7 rule a été modifée avec succès !" | ||
} |
3 changes: 3 additions & 0 deletions
3
...ages/manager/apps/pci-load-balancer/public/translations/l7/rules/edit/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,3 @@ | ||
{ | ||
"octavia_load_balancer_edit_l7_rule_success": "La L7 rule è stata modificata correttamente." | ||
} |
3 changes: 3 additions & 0 deletions
3
...ages/manager/apps/pci-load-balancer/public/translations/l7/rules/edit/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,3 @@ | ||
{ | ||
"octavia_load_balancer_edit_l7_rule_success": "Twoja L7 rule została zmodyfikowana." | ||
} |
3 changes: 3 additions & 0 deletions
3
...ages/manager/apps/pci-load-balancer/public/translations/l7/rules/edit/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,3 @@ | ||
{ | ||
"octavia_load_balancer_edit_l7_rule_success": "A sua L7 rule foi modificada 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
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
61 changes: 61 additions & 0 deletions
61
...ges/manager/apps/pci-load-balancer/src/pages/detail/listeners/l7/rules/edit/Edit.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,61 @@ | ||
import { useNavigate, useParams } from 'react-router-dom'; | ||
import { Translation } from 'react-i18next'; | ||
import { ApiError } from '@ovh-ux/manager-core-api'; | ||
import { useNotifications } from '@ovh-ux/manager-react-components'; | ||
import { ODS_SPINNER_SIZE } from '@ovhcloud/ods-components'; | ||
import { OsdsSpinner } from '@ovhcloud/ods-components/react'; | ||
import RuleForm from '@/components/detail/listeners/l7/rules/RuleForm.component'; | ||
import { useGetL7Rule, useUpdateL7Rule } from '@/api/hook/useL7Rule'; | ||
|
||
export default function UpdatePage() { | ||
const { addSuccess, addError } = useNotifications(); | ||
const navigate = useNavigate(); | ||
const { projectId, policyId, region, ruleId } = useParams(); | ||
const { updateL7Rule, isPending: isPendingUpdate } = useUpdateL7Rule({ | ||
projectId, | ||
policyId, | ||
region, | ||
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, | ||
); | ||
}, | ||
onSuccess() { | ||
addSuccess( | ||
<Translation ns="l7/rules/edit"> | ||
{(_t) => _t('octavia_load_balancer_edit_l7_rule_success')} | ||
</Translation>, | ||
true, | ||
); | ||
navigate('..'); | ||
}, | ||
}); | ||
const { data: rule, isPending: isPendingGetRule } = useGetL7Rule( | ||
projectId, | ||
policyId, | ||
region, | ||
ruleId, | ||
); | ||
const isPending = isPendingGetRule || isPendingUpdate; | ||
return ( | ||
<> | ||
{isPending ? ( | ||
<OsdsSpinner size={ODS_SPINNER_SIZE.md} inline /> | ||
) : ( | ||
<RuleForm | ||
rule={rule} | ||
onCancel={() => navigate('..')} | ||
onSubmit={updateL7Rule} | ||
/> | ||
)} | ||
</> | ||
); | ||
} |
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