Skip to content

Commit

Permalink
feat(dedicated): delete vrack from billing autorenew page
Browse files Browse the repository at this point in the history
 ref: MANAGER-15077

Signed-off-by: soufien mhelhali <[email protected]>
  • Loading branch information
soufien mhelhali committed Oct 29, 2024
1 parent 2020a1d commit 31a46e4
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export default class BillingTerminate {
return this.$http.post(`/services/${serviceId}/terminate`);
}

serviceTerminationForVrack(serviceId) {
return this.$http.post(`/vrack/${serviceId}/terminate`);
}

getTerminationForm(serviceId) {
return this.OvhApiServices.Form()
.v6()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ export default class ServicesActionsCtrl {
case SERVICE_TYPE.VRACK_SERVICES:
this.resiliateLink = `${this.autorenewLink}/terminate-service?id=${this.service.id}${serviceTypeParam}`;
break;
case SERVICE_TYPE.VRACK:
this.resiliateLink =
this.service.status === 'suspended' || this.service.isEmpty
? `${this.autorenewLink}/terminate-vrack-blocked?id=${this.service.id}${serviceTypeParam}`
: `${this.autorenewLink}/terminate-service?id=${this.service.id}${serviceTypeParam}`;
break;
default:
this.resiliateLink = this.service.canResiliateByEndRule()
? resiliationByEndRuleLink
Expand All @@ -134,9 +140,11 @@ export default class ServicesActionsCtrl {
}

canResiliate() {
return ![this.SERVICE_TYPE.PACK_XDSL, this.SERVICE_TYPE.VRACK].includes(
this.service.serviceType,
);
if (this.service.serviceType === this.SERVICE_TYPE.VRACK) {
return this.canDeleteVrack;
}

return ![this.SERVICE_TYPE.PACK_XDSL].includes(this.service.serviceType);
}

getExchangeBilling() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export default class TerminateAgoraServiceController {
}

terminate() {
if (this.serviceType === 'VRACK') {
return this.BillingTerminate.serviceTerminationForVrack(this.id);
}
return this.BillingTerminate.serviceTermination(this.id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"autorenew_agora_terminate_service_VRACK_SERVICES_RESOURCE": "Résilier vRack Services",
"autorenew_agora_terminate_service_warning_OKMS_RESOURCE": "Veuillez confirmer la résiliation de votre KMS",
"autorenew_agora_terminate_service_warning_VRACK_SERVICES_RESOURCE": "Veuillez confirmer la résiliation de vRAck Services",
"autorenew_agora_terminate_service_VRACK": "Résilier vRack",
"autorenew_agora_terminate_service_warning_VRACK": "Veuillez confirmer la résiliation de vRAck",
"autorenew_agora_terminate_service_success_VRACK": "Votre demande de résiliation de votre Vrack a été prise en compte. Un e-mail contenant la procédure vous a été envoyé.",
"autorenew_agora_terminate_service_error_VRACK": "Une erreur est survenue lors de la demande de résiliation de votre Vrack. {{error}}",
"autorenew_agora_terminate_service_success_OKMS_RESOURCE": "Votre demande de résiliation de votre KMS a été prise en compte. Un e-mail contenant la procédure vous a été envoyé.",
"autorenew_agora_terminate_service_success_VRACK_SERVICES_RESOURCE": "Votre demande de résiliation de vRAck Services a été prise en compte. Un e-mail contenant la procédure vous a été envoyé.",
"autorenew_agora_terminate_service_error_OKMS_RESOURCE": "Une erreur est survenue lors de la demande de résiliation de votre KMS. {{error}}",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import template from './template.html';

export default {
bindings: {
goBack: '<',
id: '<',
serviceType: '<',
},
template,
name: 'billingAutorenewTerminateVrackBlocked',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import angular from 'angular';
import angularTranslate from 'angular-translate';
import ngAtInternet from '@ovh-ux/ng-at-internet';
import ngTranslateAsyncLoader from '@ovh-ux/ng-translate-async-loader';
import '@ovh-ux/ui-kit';
import uiRouter from '@uirouter/angularjs';

import component from './component';
import routing from './routing';

const moduleName = 'ovhManagerBillingAutorenewTerminateVrackBlocked';

angular
.module(moduleName, [
angularTranslate,
ngAtInternet,
ngTranslateAsyncLoader,
'oui',
uiRouter,
])
.config(routing)
.component(component.name, component)
.run(/* @ngTranslationsInject:json ./translations */);

export default moduleName;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('app.account.billing.autorenew.terminateVrackBlocked', {
url: '/terminate-vrack-blocked?id&serviceType',
views: {
modal: {
component: 'billingAutorenewTerminateVrackBlocked',
},
},
layout: 'modal',
resolve: {
goBack: /* @ngInject */ (goToAutorenew) => goToAutorenew,
id: /* @ngInject */ ($transition$) => $transition$.params().id,
serviceType: /* @ngInject */ ($transition$) =>
$transition$.params().serviceType,
breadcrumb: () => null,
},
atInternet: {
ignore: true,
},
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<oui-modal
data-heading="{{:: 'autorenew_agora_terminate_vrack_blocked_title' | translate }}"
data-primary-action="$ctrl.goBack()"
data-primary-label="{{:: 'autorenew_agora_terminate_vrack_blocked_close' | translate }}"
data-secondary-disabled="true"
data-on-dismiss="$ctrl.goBack()"
>
<oui-message data-type="warning" class="mb-2">
<span
data-translate="autorenew_agora_terminate_vrack_blocked_description"
></span>
</oui-message>
</oui-modal>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"autorenew_agora_terminate_vrack_blocked_title": "Supprimer mon Vrack",
"autorenew_agora_terminate_vrack_blocked_description": "Afin de supprimer votre Vrack vous devez au préalable deconnecter tous les services qui y sont ratachés",
"autorenew_agora_terminate_vrack_blocked_close": "Fermer"
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import terminateHostingWeb from './actions/terminateHostingWeb/hosting-web.modul
import terminatePrivateDatabase from './actions/terminatePrivateDatabase/private-database.module';
import terminateWebCoach from './actions/terminate-webcoach/terminate-webcoach.module';
import terminateAllDOm from './actions/terminate-all-dom/module';
import terminateVrackBlocked from './actions/terminate-vrack-blocked';
import update from './actions/update/update.module';
import warnNicBilling from './actions/warnNicBilling/warnNicBilling.module';
import warnPendingDebt from './actions/warnPendingDebt/pending-debt.module';
Expand Down Expand Up @@ -71,6 +72,7 @@ angular
terminatePrivateDatabase,
terminateWebCoach,
terminateAllDOm,
terminateVrackBlocked,
uiRouter,
update,
warnNicBilling,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export default /* @ngInject */ ($stateProvider, coreConfigProvider) => {
},
featureAvailability: /* @ngInject */ (ovhFeatureFlipping) =>
ovhFeatureFlipping.checkFeatureAvailability([
'vrack:delete',
'billing:management',
'billing:autorenew2016Deployment',
]),
Expand All @@ -103,6 +104,8 @@ export default /* @ngInject */ ($stateProvider, coreConfigProvider) => {
featureAvailability?.isFeatureAvailable(
'billing:autorenew2016Deployment',
) || false,
canDeleteVrack: /* @ngInject */ (featureAvailability) =>
featureAvailability?.isFeatureAvailable('vrack:delete') || false,
hideBreadcrumb: /* @ngInject */ () => true,
trackingPrefix: () => 'dedicated::account::billing::autorenew',
},
Expand Down

0 comments on commit 31a46e4

Please sign in to comment.