-
Notifications
You must be signed in to change notification settings - Fork 110
feat(dedicated): add migration vcfaas banner #20062
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import controller from './customer-vcfaas-migration-banner.controller'; | ||
| import template from './customer-vcfaas-migration-banner.html'; | ||
|
|
||
| export default { | ||
| bindings: { | ||
| serviceName: '<', | ||
| setMessage: '<', | ||
| }, | ||
| controller, | ||
| name: 'ovhManagerPccDashboardCustomerVcfaasMigrationBanner', | ||
| template, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| export const PCC_MIGRATION_VCFAAS_URL = { | ||
| FR: 'https://www.ovhcloud.com/fr/public-vcf-aas', | ||
| GB: 'https://www.ovhcloud.com/en-gb/public-vcf-aas', | ||
| IE: 'https://www.ovhcloud.com/en-ie/public-vcf-aas', | ||
| NL: 'https://www.ovhcloud.com/nl/public-vcf-aas', | ||
| CA: 'https://www.ovhcloud.com/en-ca/public-vcf-aas', | ||
| AU: 'https://www.ovhcloud.com/en-au/public-vcf-aas', | ||
| SG: 'https://www.ovhcloud.com/en-sg/public-vcf-aas', | ||
| ASIA: 'https://www.ovhcloud.com/asia/public-vcf-aas', | ||
| EN: 'https://www.ovhcloud.com/en/public-vcf-aas', | ||
| IN: 'https://www.ovhcloud.com/en-in/public-vcf-aas', | ||
| PL: 'https://www.ovhcloud.com/pl/public-vcf-aas', | ||
| PT: 'https://www.ovhcloud.com/pt/public-vcf-aas', | ||
| ES: 'https://www.ovhcloud.com/es-es/public-vcf-aas', | ||
| WS: 'https://www.ovhcloud.com/en/public-vcf-aas', | ||
| DE: 'https://www.ovhcloud.com/de/public-vcf-aas', | ||
| IT: 'https://www.ovhcloud.com/it/public-vcf-aas', | ||
| QC: 'https://www.ovhcloud.com/fr-ca/public-vcf-aas', | ||
| MA: 'https://www.ovhcloud.com/fr-ma/public-vcf-aas', | ||
| SN: 'https://www.ovhcloud.com/fr-sn/public-vcf-aas', | ||
| TN: 'https://www.ovhcloud.com/fr-tn/public-vcf-aas', | ||
| DEFAULT: 'https://www.ovhcloud.com/en/public-vcf-aas', | ||
| }; | ||
|
|
||
| // Operation name will be changed to requestContactForVcfAasMigration | ||
| export const OPERATION_REQUEST_CONTACT_FOR_VCFAAS_MIGRATION = | ||
| 'requestContactForVcdMigration'; | ||
| export const STATUS_OPERATION = 'done'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import { | ||
| PCC_MIGRATION_VCFAAS_URL, | ||
| STATUS_OPERATION, | ||
| OPERATION_REQUEST_CONTACT_FOR_VCFAAS_MIGRATION, | ||
| } from './customer-vcfaas-migration-banner.constants'; | ||
|
|
||
| export default class DedicatedCloudCustomerVcfaasMigrationBanner { | ||
| /* @ngInject */ | ||
| constructor($translate, coreConfig, DedicatedCloud) { | ||
| this.coreConfig = coreConfig; | ||
| this.$translate = $translate; | ||
| this.DedicatedCloud = DedicatedCloud; | ||
| this.pending = false; | ||
| this.displayMigrationBanner = false; | ||
| } | ||
|
|
||
| $onInit() { | ||
| const user = this.coreConfig.getUser(); | ||
| this.offerLink = | ||
| PCC_MIGRATION_VCFAAS_URL[user?.ovhSubsidiary] || | ||
| PCC_MIGRATION_VCFAAS_URL.DEFAULT; | ||
| this.retrieveOperationRequestContactForVcdMigration(); | ||
| } | ||
|
|
||
| retrieveOperationRequestContactForVcdMigration() { | ||
| this.pending = true; | ||
| this.DedicatedCloud.getOperations( | ||
| this.serviceName, | ||
| {}, | ||
| { | ||
| name: OPERATION_REQUEST_CONTACT_FOR_VCFAAS_MIGRATION, | ||
| state: STATUS_OPERATION, | ||
| }, | ||
| ) | ||
| .then(({ meta }) => { | ||
| this.displayMigrationBanner = !(meta && meta.totalCount > 0); | ||
| }) | ||
|
|
||
| .finally(() => { | ||
| this.pending = false; | ||
| }); | ||
| } | ||
|
|
||
| requestContactForVmwareCloudDirectorMigration() { | ||
| this.DedicatedCloud.requestContactForVmwareCloudDirectorMigration( | ||
| this.serviceName, | ||
| ) | ||
| .then(() => { | ||
| this.setMessage( | ||
| this.$translate.instant( | ||
| 'dedicated_cloud_dashboard_customer_vcfaas_migration_banner_success', | ||
| ), | ||
| 'success', | ||
| ); | ||
| this.displayMigrationBanner = false; | ||
| }) | ||
| .catch(() => { | ||
| this.setMessage( | ||
| this.$translate.instant( | ||
| 'dedicated_cloud_dashboard_customer_vcfaas_migration_banner_error', | ||
| ), | ||
| 'danger', | ||
| ); | ||
| }); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <oui-message | ||
| data-ng-if="$ctrl.displayMigrationBanner && !$ctrl.pending" | ||
| class="mb-2" | ||
| data-type="info" | ||
| dismissable | ||
| > | ||
| <div class="flex items-center gap-2"> | ||
| <p | ||
| class="mb-0 inline" | ||
| ng-bind-html="'dedicated_cloud_dashboard_customer_vcfaas_migration_banner' | translate:{ url: $ctrl.offerLink }" | ||
| ></p> | ||
|
|
||
| <a | ||
| href="" | ||
| class="oui-link" | ||
| ng-click="$ctrl.requestContactForVmwareCloudDirectorMigration()" | ||
| data-translate="dedicated_cloud_dashboard_customer_vcfaas_migration_banner_action" | ||
| ></a> | ||
| </div> | ||
| </oui-message> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import customerVcfaasMIgrationBannerComponent from './customer-vcfaas-migration-banner.component'; | ||
|
|
||
| const moduleName = 'ovhManagerPccDashboardCustomerVcfaasMigrationBanner'; | ||
|
|
||
| angular | ||
| .module(moduleName, ['oui', 'pascalprecht.translate']) | ||
| .component( | ||
| customerVcfaasMIgrationBannerComponent.name, | ||
| customerVcfaasMIgrationBannerComponent, | ||
| ) | ||
| .run(/* @ngTranslationsInject:json ./translations */); | ||
|
|
||
| export default moduleName; |
pauldkn marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,6 @@ | ||||||
| { | ||||||
| "dedicated_cloud_dashboard_customer_vcfaas_migration_banner": "Nouvelle offre Public VCF as-a-Service - Tarifs ultra compétitifs et migration gratuite - Découvrir <a href=\"{{ url }}\" target=\"_blank\"> l'offre </a> et Testez votre éligibilité", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strange mix of tenses
Suggested change
|
||||||
| "dedicated_cloud_dashboard_customer_vcfaas_migration_banner_action": "[en cliquant ici]", | ||||||
| "dedicated_cloud_dashboard_customer_vcfaas_migration_banner_success": "Votre demande de migration vers Public VCF as-a-Service a bien été prise en compte. Vous serez prochainement contacté par l'équipe d'OVHcloud.", | ||||||
| "dedicated_cloud_dashboard_customer_vcfaas_migration_banner_error": "Une erreur s'est produite lors de votre demande de migration. Veuillez réessayer." | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1756,6 +1756,18 @@ class DedicatedCloudService { | |
| .get(`/services/${serviceId}/options`) | ||
| .then(({ data }) => data); | ||
| } | ||
|
|
||
| requestContactForVmwareCloudDirectorMigration(serviceName) { | ||
| return this.OvhHttp.post( | ||
| `/dedicatedCloud/{serviceName}/requestContactForVmwareCloudDirectorMigration`, | ||
| { | ||
| rootPath: 'apiv6', | ||
| urlParams: { | ||
| serviceName, | ||
| }, | ||
| }, | ||
| ); | ||
| } | ||
|
Comment on lines
+1761
to
+1770
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
||
| angular | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -174,6 +174,18 @@ export default /* @ngInject */ ($stateProvider) => { | |
| 'dedicated-cloud:customerSurveyBanner', | ||
| ), | ||
| ), | ||
| customerVcfaasMigrationBannerAvailability: /* @ngInject */ ( | ||
| ovhFeatureFlipping, | ||
| ) => | ||
| ovhFeatureFlipping | ||
| .checkFeatureAvailability( | ||
| 'dedicated-cloud:customerVcfaasMigrationBanner', | ||
| ) | ||
| .then((featureAvailability) => | ||
| featureAvailability.isFeatureAvailable( | ||
| 'dedicated-cloud:customerVcfaasMigrationBanner', | ||
| ), | ||
| ), | ||
|
Comment on lines
+177
to
+188
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There a lot of featureAvailability calls inside the resolve section. Making one call for each feature is not very performant. features: /* @ngInject */ (ovhFeatureFlipping) => ovhFeatureFlipping
.checkFeatureAvailability('feature1', 'feature2',..., 'dedicated-cloud:customerSurveyBanner', 'dedicated-cloud:customerVcfaasMigrationBanner'),
customerVcfaasMigrationBannerAvailability: /* @ngInject */ (
features,
) => features.isFeatureAvailable(
'dedicated-cloud:customerVcfaasMigrationBanner',
), |
||
|
|
||
| zertoGlobalStatus: /* @ngInject */ ( | ||
| currentZerto, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.