Skip to content

Commit e40e672

Browse files
committed
feat(dedicated): add migration vcfaas banner
ref: #MANAGER-19946 Signed-off-by: ahmed sefiani <[email protected]>
1 parent fff85e0 commit e40e672

File tree

11 files changed

+184
-0
lines changed

11 files changed

+184
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import controller from './customer-vcfaas-migration-banner.controller';
2+
import template from './customer-vcfaas-migration-banner.html';
3+
4+
export default {
5+
bindings: {
6+
// datacenterId: '<',
7+
// vmId: '<',
8+
// guestOsFamily: '<',
9+
// goBack: '<',
10+
serviceName: '<',
11+
setMessage: '<',
12+
13+
// trackClick: '<',
14+
// trackPage: '<',
15+
},
16+
controller,
17+
name: 'ovhManagerPccDashboardCustomerVcfaasMigrationBanner',
18+
template,
19+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export const PCC_MIGRATION_VCFAAS_URL = {
2+
FR: 'https://www.ovhcloud.com/fr/public-vcf-aas',
3+
GB: 'https://www.ovhcloud.com/en-gb/public-vcf-aas',
4+
IE: 'https://www.ovhcloud.com/en-ie/public-vcf-aas',
5+
NL: 'https://www.ovhcloud.com/nl/public-vcf-aas',
6+
CA: 'https://www.ovhcloud.com/en-ca/public-vcf-aas',
7+
AU: 'https://www.ovhcloud.com/en-au/public-vcf-aas',
8+
SG: 'https://www.ovhcloud.com/en-sg/public-vcf-aas',
9+
ASIA: 'https://www.ovhcloud.com/asia/public-vcf-aas',
10+
EN: 'https://www.ovhcloud.com/en/public-vcf-aas',
11+
IN: 'https://www.ovhcloud.com/en-in/public-vcf-aas',
12+
PL: 'https://www.ovhcloud.com/pl/public-vcf-aas',
13+
PT: 'https://www.ovhcloud.com/pt/public-vcf-aas',
14+
ES: 'https://www.ovhcloud.com/es-es/public-vcf-aas',
15+
WS: 'https://www.ovhcloud.com/en/public-vcf-aas',
16+
DE: 'https://www.ovhcloud.com/de/public-vcf-aas',
17+
IT: 'https://www.ovhcloud.com/it/public-vcf-aas',
18+
QC: 'https://www.ovhcloud.com/fr-ca/public-vcf-aas',
19+
MA: 'https://www.ovhcloud.com/fr-ma/public-vcf-aas',
20+
SN: 'https://www.ovhcloud.com/fr-sn/public-vcf-aas',
21+
TN: 'https://www.ovhcloud.com/fr-tn/public-vcf-aas',
22+
DEFAULT: 'https://www.ovhcloud.com/en/public-vcf-aas',
23+
};
24+
25+
// Operation name will be changed to requestContactForVcfAasMigration
26+
export const OPERATION_REQUEST_CONTACT_FOR_VCFAAS_MIGRATION =
27+
'requestContactForVcdMigration';
28+
export const STATUS_OPERATION = 'done';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import {
2+
PCC_MIGRATION_VCFAAS_URL,
3+
STATUS_OPERATION,
4+
OPERATION_REQUEST_CONTACT_FOR_VCFAAS_MIGRATION,
5+
} from './customer-vcfaas-migration-banner.constants';
6+
7+
export default class DedicatedCloudCustomerVcfaasMigrationBanner {
8+
/* @ngInject */
9+
constructor($translate, coreConfig, DedicatedCloud) {
10+
this.coreConfig = coreConfig;
11+
this.$translate = $translate;
12+
this.DedicatedCloud = DedicatedCloud;
13+
this.pending = false;
14+
this.displayMigrationBanner = false;
15+
}
16+
17+
$onInit() {
18+
const user = this.coreConfig.getUser();
19+
this.offerLink =
20+
PCC_MIGRATION_VCFAAS_URL[user?.ovhSubsidiary] ||
21+
PCC_MIGRATION_VCFAAS_URL.DEFAULT;
22+
this.retrieveOperationRequestContactForVcdMigration();
23+
}
24+
25+
retrieveOperationRequestContactForVcdMigration() {
26+
this.pending = true;
27+
this.DedicatedCloud.getOperations(
28+
this.serviceName,
29+
{},
30+
{
31+
name: OPERATION_REQUEST_CONTACT_FOR_VCFAAS_MIGRATION,
32+
state: STATUS_OPERATION,
33+
},
34+
)
35+
.then(({ meta }) => {
36+
this.displayMigrationBanner = !(meta && meta.totalCount > 0);
37+
})
38+
39+
.finally(() => {
40+
this.pending = false;
41+
});
42+
}
43+
44+
requestContactForVmwareCloudDirectorMigration() {
45+
this.DedicatedCloud.requestContactForVmwareCloudDirectorMigration(
46+
this.serviceName,
47+
)
48+
.then(() => {
49+
this.setMessage(
50+
this.$translate.instant(
51+
'dedicated_cloud_dashboard_customer_vcfaad_migration_banner_success',
52+
),
53+
'success',
54+
);
55+
this.displayMigrationBanner = false;
56+
})
57+
.catch(() => {
58+
this.setMessage(
59+
this.$translate.instant(
60+
'dedicated_cloud_dashboard_customer_vcfaad_migration_banner_error',
61+
),
62+
'danger',
63+
);
64+
});
65+
}
66+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<oui-message
2+
data-ng-if="$ctrl.displayMigrationBanner && !$ctrl.pending"
3+
class="mb-2"
4+
data-type="info"
5+
dismissable
6+
>
7+
<div class="flex items-center gap-2">
8+
<p
9+
class="mb-0 inline"
10+
ng-bind-html="'dedicated_cloud_dashboard_customer_vcfaad_migration_banner' | translate:{ url: $ctrl.offerLink }"
11+
></p>
12+
13+
<a
14+
href=""
15+
class="oui-link"
16+
ng-click="$ctrl.requestContactForVmwareCloudDirectorMigration()"
17+
data-translate="dedicated_cloud_dashboard_customer_vcfaad_migration_banner_action"
18+
></a>
19+
</div>
20+
</oui-message>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import customerVcfaasMIgrationBannerComponent from './customer-vcfaas-migration-banner.component';
2+
3+
const moduleName = 'ovhManagerPccDashboardCustomerVcfaasMigrationBanner';
4+
5+
angular
6+
.module(moduleName, ['oui', 'pascalprecht.translate'])
7+
.component(
8+
customerVcfaasMIgrationBannerComponent.name,
9+
customerVcfaasMIgrationBannerComponent,
10+
)
11+
.run(/* @ngTranslationsInject:json ./translations */);
12+
13+
export default moduleName;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"dedicated_cloud_dashboard_customer_vcfaad_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é",
3+
"dedicated_cloud_dashboard_customer_vcfaad_migration_banner_action": "[en cliquant ici]",
4+
"dedicated_cloud_dashboard_customer_vcfaad_migration_banner_success": "Votre demande de migration vers vCFAAS a bien été prise en compte. Vous serez prochainement contacté par l'équipe du support technique d'OVHcloud.",
5+
"dedicated_cloud_dashboard_customer_vcfaad_migration_banner_error": "Une erreur s'est produite lors de votre demande de migration. Veuillez réessayer."
6+
}

packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.component.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default {
1818
hasVCDMigration: '<',
1919
vcdTrackingPrefix: '<',
2020
customerSurveyBannerAvailability: '<',
21+
customerVcfaasMigrationBannerAvailability: '<',
2122
isLogsDisabled: '<?',
2223
},
2324
controller,

packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@
9595
</header>
9696

9797
<div>
98+
<ovh-manager-pcc-dashboard-customer-vcfaas-migration-banner
99+
data-ng-if="$ctrl.customerVcfaasMigrationBannerAvailability"
100+
data-service-name="$ctrl.dedicatedCloud.serviceName"
101+
data-set-message="$ctrl.setMessage"
102+
></ovh-manager-pcc-dashboard-customer-vcfaas-migration-banner>
98103
<div data-ovh-alert="dedicatedCloud"></div>
99104

100105
<div data-ui-view="pccView"></div>

packages/manager/apps/dedicated/client/app/components/dedicated-cloud/dedicatedCloud.service.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,18 @@ class DedicatedCloudService {
17561756
.get(`/services/${serviceId}/options`)
17571757
.then(({ data }) => data);
17581758
}
1759+
1760+
requestContactForVmwareCloudDirectorMigration(serviceName) {
1761+
return this.OvhHttp.post(
1762+
`/dedicatedCloud/{serviceName}/requestContactForVmwareCloudDirectorMigration`,
1763+
{
1764+
rootPath: 'apiv6',
1765+
urlParams: {
1766+
serviceName,
1767+
},
1768+
},
1769+
);
1770+
}
17591771
}
17601772

17611773
angular

packages/manager/apps/dedicated/client/app/components/dedicated-cloud/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import ServicePackService from './service-pack/service-pack.service';
88
import OptionsService from './dashboard/tiles/options/options.service';
99
import ManagedVcdMigrationBanner from './vmware-cloud-director/migration-banner';
1010
import CustomerSurveyBanner from './customer-survey-banner';
11+
import CustomerVcfaasMigrationBanner from './customer-vcfaas-migration-banner';
1112
import PccGuides from './guides';
1213

1314
const moduleName = 'ovhManagerPcc';
@@ -25,6 +26,7 @@ angular
2526
ManagedVcdMigrationBanner,
2627
CustomerSurveyBanner,
2728
PccGuides,
29+
CustomerVcfaasMigrationBanner,
2830
])
2931
.component('ovhManagerPcc', component)
3032
.run(/* @ngTranslationsInject:json ./translations */);

0 commit comments

Comments
 (0)