Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() {
Comment on lines +13 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.pending = false;
this.displayMigrationBanner = false;
}
$onInit() {
}
$onInit() {
this.pending = false;
this.displayMigrationBanner = false;

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;
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é",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange mix of tenses
Either Découvrir ... et tester ... or Découvrez ... et testez ...

Suggested change
"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é",
"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é",

"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
Expand Up @@ -19,6 +19,7 @@ export default {
vcdTrackingPrefix: '<',
customerSurveyBannerAvailability: '<',
goBackToList: '<',
customerVcfaasMigrationBannerAvailability: '<',
isLogsDisabled: '<?',
},
controller,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@
</header>

<div>
<ovh-manager-pcc-dashboard-customer-vcfaas-migration-banner
data-ng-if="$ctrl.customerVcfaasMigrationBannerAvailability"
data-service-name="$ctrl.dedicatedCloud.serviceName"
data-set-message="$ctrl.setMessage"
></ovh-manager-pcc-dashboard-customer-vcfaas-migration-banner>
<div data-ovh-alert="dedicatedCloud"></div>

<div data-ui-view="pccView"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OvhHttp is deprecated, use $http instead

}

angular
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ServicePackService from './service-pack/service-pack.service';
import OptionsService from './dashboard/tiles/options/options.service';
import ManagedVcdMigrationBanner from './vmware-cloud-director/migration-banner';
import CustomerSurveyBanner from './customer-survey-banner';
import CustomerVcfaasMigrationBanner from './customer-vcfaas-migration-banner';
import PccGuides from './guides';

const moduleName = 'ovhManagerPcc';
Expand All @@ -25,6 +26,7 @@ angular
ManagedVcdMigrationBanner,
CustomerSurveyBanner,
PccGuides,
CustomerVcfaasMigrationBanner,
])
.component('ovhManagerPcc', component)
.run(/* @ngTranslationsInject:json ./translations */);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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.
It could be optimized to make only one call

 features: /* @ngInject */ (ovhFeatureFlipping) => ovhFeatureFlipping
          .checkFeatureAvailability('feature1', 'feature2',..., 'dedicated-cloud:customerSurveyBanner', 'dedicated-cloud:customerVcfaasMigrationBanner'),
customerVcfaasMigrationBannerAvailability: /* @ngInject */ (
        features,
      ) => features.isFeatureAvailable(
              'dedicated-cloud:customerVcfaasMigrationBanner',
      ),


zertoGlobalStatus: /* @ngInject */ (
currentZerto,
Expand Down
Loading