diff --git a/packages/manager/modules/pci/src/projects/project/instances/backup/backup.routing.js b/packages/manager/modules/pci/src/projects/project/instances/backup/backup.routing.js index 062af911ed83..c82ad9cca1b5 100644 --- a/packages/manager/modules/pci/src/projects/project/instances/backup/backup.routing.js +++ b/packages/manager/modules/pci/src/projects/project/instances/backup/backup.routing.js @@ -20,7 +20,7 @@ export default /* @ngInject */ ($stateProvider) => { projectId, instance, ) => - PciProjectsProjectInstanceService.getSnapshotMonthlyPrice( + PciProjectsProjectInstanceService.getLZSnapshotMonthlyPrice( projectId, instance, ), diff --git a/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.contants.js b/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.contants.js index 4190630f9e41..835f429bced8 100644 --- a/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.contants.js +++ b/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.contants.js @@ -3,6 +3,9 @@ export const FLAVORS_TYPE = { iops: 'ovh.iops', }; +export const HOURS_PER_MONTH = 730; + export default { FLAVORS_TYPE, + HOURS_PER_MONTH, }; diff --git a/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.controller.js b/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.controller.js index de08a110fd12..39e0e59808b2 100644 --- a/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.controller.js +++ b/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.controller.js @@ -1,6 +1,6 @@ import get from 'lodash/get'; -import { FLAVORS_TYPE } from './backup.contants'; +import { FLAVORS_TYPE, HOURS_PER_MONTH } from './backup.contants'; export default class PciInstanceBackupController { /* @ngInject */ @@ -10,6 +10,7 @@ export default class PciInstanceBackupController { CucCloudMessage, PciProjectsProjectInstanceService, atInternet, + coreConfig, ) { this.$filter = $filter; this.$translate = $translate; @@ -17,6 +18,7 @@ export default class PciInstanceBackupController { this.PciProjectsProjectInstanceService = PciProjectsProjectInstanceService; this.atInternet = atInternet; this.FLAVORS_TYPE = FLAVORS_TYPE; + this.coreConfig = coreConfig; } $onInit() { @@ -70,4 +72,16 @@ export default class PciInstanceBackupController { type: 'action', }); } + + formatPrice() { + const { value, currencyCode } = this.monthlyPrice.price; + return `~${new Intl.NumberFormat( + this.coreConfig.getUser().language.replace('_', '-'), + { + style: 'currency', + currency: currencyCode, + maximumFractionDigits: 3, + }, + ).format(value * HOURS_PER_MONTH)}`; + } } diff --git a/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.html b/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.html index 343233a102c6..c3106589951a 100644 --- a/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.html +++ b/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.html @@ -29,7 +29,7 @@ diff --git a/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.routing.js b/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.routing.js index d1dbbaa09aa8..dd61a35135f2 100644 --- a/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.routing.js +++ b/packages/manager/modules/pci/src/projects/project/instances/instance/backup/backup.routing.js @@ -13,7 +13,7 @@ export default /* @ngInject */ ($stateProvider) => { projectId, instance, ) => - PciProjectsProjectInstanceService.getSnapshotMonthlyPrice( + PciProjectsProjectInstanceService.getLZSnapshotMonthlyPrice( projectId, instance, ), diff --git a/packages/manager/modules/pci/src/projects/project/instances/instance/backup/translations/Messages_fr_FR.json b/packages/manager/modules/pci/src/projects/project/instances/instance/backup/translations/Messages_fr_FR.json index 6bdf3e743e57..10b36f0ec95b 100644 --- a/packages/manager/modules/pci/src/projects/project/instances/instance/backup/translations/Messages_fr_FR.json +++ b/packages/manager/modules/pci/src/projects/project/instances/instance/backup/translations/Messages_fr_FR.json @@ -6,7 +6,7 @@ "pci_projects_project_instances_instance_backup_price": "Prix : {{ price }} HT/mois/Go", "pci_projects_project_instances_instance_backup_submit_label": "Confirmer", "pci_projects_project_instances_instance_backup_cancel_label": "Annuler", - "pci_projects_project_instances_instance_backup_success_message": "Le backup {{ backup }} est en cours de création", + "pci_projects_project_instances_instance_backup_success_message": "Le backup {{ backup }} est en cours de création. Pour visualiser son statut et les détails de l'opération, veuillez vous rendre sur la page 'Instance Backup'. Si le backup ne s'affiche pas immédiatement, n'hésitez pas à rafraîchir votre page pour mettre à jour la liste.", "pci_projects_project_instances_instance_backup_error_backup": "Une erreur est survenue lors de la création du backup {{ backup }} : {{ message }}", "pci_projects_project_instances_instance_backup_warning_iops_message": "La sauvegarde ne concerne que votre disque racine (système d'exploitation). Aucune donnée ne sera sauvegardée à partir de périphériques NVMe. Veuillez utiliser vos propres outils pour cela.", "pci_projects_project_instances_instance_backup_trusted_zone_extra_amount_charge_message": "Le prix affiché correspond au prix du service. La majoration liée à la zone de confiance est ajoutée à la facturation mensuelle globale." diff --git a/packages/manager/modules/pci/src/projects/project/instances/instance/instance.html b/packages/manager/modules/pci/src/projects/project/instances/instance/instance.html index a506ccf82f92..dd9db76e6bfa 100644 --- a/packages/manager/modules/pci/src/projects/project/instances/instance/instance.html +++ b/packages/manager/modules/pci/src/projects/project/instances/instance/instance.html @@ -61,7 +61,7 @@ + catalog[`snapshot.consumption.${instance.region}`] ?? + catalog['snapshot.consumption.LZ'], + ); + } + createBackup(projectId, { id: instanceId }, { name: snapshotName }) { return this.OvhApiCloudProjectInstance.v6().backup( { diff --git a/packages/manager/modules/pci/src/projects/project/storages/instance-backups/instance-backups.controller.js b/packages/manager/modules/pci/src/projects/project/storages/instance-backups/instance-backups.controller.js index ba1907d8b401..895088b9ecbe 100644 --- a/packages/manager/modules/pci/src/projects/project/storages/instance-backups/instance-backups.controller.js +++ b/packages/manager/modules/pci/src/projects/project/storages/instance-backups/instance-backups.controller.js @@ -2,7 +2,8 @@ import { getCriteria } from '../../project.utils'; export default class PciInstanceBackupsController { /* @ngInject */ - constructor(CucCloudMessage, ovhManagerRegionService) { + constructor($state, CucCloudMessage, ovhManagerRegionService) { + this.$state = $state; this.CucCloudMessage = CucCloudMessage; this.ovhManagerRegionService = ovhManagerRegionService; } @@ -24,4 +25,8 @@ export default class PciInstanceBackupsController { refreshMessages() { this.messages = this.messageHandler.getMessages(); } + + refreshList() { + return this.$state.go(this.$state.current.name, {}, { reload: true }); + } } diff --git a/packages/manager/modules/pci/src/projects/project/storages/instance-backups/instance-backups.html b/packages/manager/modules/pci/src/projects/project/storages/instance-backups/instance-backups.html index fcb67d9cadd0..8242459b2ed1 100644 --- a/packages/manager/modules/pci/src/projects/project/storages/instance-backups/instance-backups.html +++ b/packages/manager/modules/pci/src/projects/project/storages/instance-backups/instance-backups.html @@ -136,6 +136,13 @@ data-translate="pci_projects_project_storages_instance-backups_add_label" > +