Skip to content
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

feat(dedicated): delete vrack from billing autorenew page #14977

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Expand Up @@ -55,6 +55,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 @@ -4,6 +4,7 @@ import template from './services-actions.html';
export default {
bindings: {
billingManagementAvailability: '<',
deleteVrackAvailability: '<',
service: '<',
trackingPrefix: '@?',
trackingPage: '@?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default class ServicesActionsCtrl {
}

$onInit() {

this.user = this.coreConfig.getUser();
this.BillingLinksService.generateAutorenewLinks(this.service, {
billingManagementAvailability: this.billingManagementAvailability,
Expand Down Expand Up @@ -59,9 +58,12 @@ export default class ServicesActionsCtrl {
}

canResiliate() {
if (this.service.serviceType === this.SERVICE_TYPE.VRACK) {
return this.deleteVrackAvailability && !!this.resiliateLink;
}

return ![
SERVICE_TYPE.PACK_XDSL,
SERVICE_TYPE.VRACK,
SERVICE_TYPE.VMWARE_CLOUD_DIRECTOR_ORGANIZATION,
].includes(this.service.serviceType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ export default class BillingLinksService {
? resiliationByEndRuleLink
: `${autorenewLink}/delete-all-dom?serviceId=${service.serviceId}&serviceType=${service.serviceType}`;
break;
case SERVICE_TYPE.VRACK:
if (service.status !== 'suspended') {
links.resiliateLink = `${autorenewLink}/terminate-vrack?service=${service.serviceId}${serviceTypeParam}`;
}
break;
case SERVICE_TYPE.OKMS:
case SERVICE_TYPE.VRACK_SERVICES:
case SERVICE_TYPE.LICENSE_HYCU:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import template from './template.html';
import controller from './controller';

export default {
bindings: {
goBack: '<',
service: '<',
serviceType: '<',
isEmpty: '<',
},
controller,
template,
name: 'billingAutorenewTerminateVrack',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const TERMINATE_PATTERN = /^TERMINATE$/;

export default {
TERMINATE_PATTERN,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { TERMINATE_PATTERN } from './constants';

export default class TerminateVrackController {
/* @ngInject */
constructor($translate, BillingTerminate) {
this.TERMINATE_PATTERN = TERMINATE_PATTERN;
this.$translate = $translate;
this.BillingTerminate = BillingTerminate;
}

terminate() {
this.BillingTerminate.serviceTerminationForVrack(this.service)
.then(() => this.onSuccess())
.catch((error) => this.onError({ error }));
}

onSuccess() {
this.goBack(
this.$translate.instant(
`autorenew_agora_terminate_service_success_VRACK`,
),
'success',
);
}

onError(error) {
this.goBack(
this.$translate.instant(`autorenew_agora_terminate_service_error_VRACK`, {
error: error?.data?.message,
}),
'danger',
);
}
}
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 = 'ovhManagerBillingAutorenewTerminateVrack';

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,35 @@
export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('app.account.billing.autorenew.terminateVrack', {
url: '/terminate-vrack?service&serviceType',
views: {
modal: {
component: 'billingAutorenewTerminateVrack',
},
},
layout: 'modal',
resolve: {
goBack: /* @ngInject */ (goToAutorenew) => goToAutorenew,
service: /* @ngInject */ ($transition$) => $transition$.params().service,
serviceType: /* @ngInject */ ($transition$) =>
$transition$.params().serviceType,
isEmpty: /* @ngInject */ (OvhApiVrack, service) =>
OvhApiVrack.Aapi()
.services({ serviceName: service })
.$promise.then((allServicesParam) => {
const services = Object.entries(allServicesParam).filter(
([, value]) => {
return Array.isArray(value) && value.length;
},
);
return !services.length;
})
.catch(() => {
return false;
}),
breadcrumb: () => null,
},
atInternet: {
ignore: true,
},
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<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()"
data-ng-if="!$ctrl.isEmpty"
>
<oui-message data-type="warning" class="mb-2" data-ng-if="!$ctrl.isEmpty">
<span
data-translate="autorenew_agora_terminate_vrack_blocked_description"
></span>
</oui-message>
</oui-modal>

<oui-modal
data-heading="{{:: 'autorenew_agora_terminate_vrack_blocked_title' | translate }}"
data-primary-action="$ctrl.terminate()"
data-primary-disabled="!$ctrl.terminateConfirmation"
data-primary-label="{{:: 'autorenew_service_terminate' | translate }}"
data-secondary-action="$ctrl.goBack()"
data-secondary-label="{{:: 'autorenew_service_terminate_cancel' | translate }}"
data-loading="$ctrl.isDeleting"
data-on-dismiss="$ctrl.goBack()"
data-ng-if="$ctrl.isEmpty"
>
<oui-message data-type="warning" class="mb-2">
<span
data-translate="{{:: 'autorenew_agora_terminate_service_warning_' + $ctrl.serviceType}}"
></span>
</oui-message>
<oui-field
data-label="{{:: 'autorenew_agora_terminate_service_confirm_input' | translate }}"
>
<input
type="text"
class="oui-input"
name="terminateInput"
data-ng-model="$ctrl.terminateConfirmation"
data-ng-pattern="$ctrl.TERMINATE_PATTERN"
required
/>
</oui-field>
</oui-modal>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"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",
"autorenew_agora_terminate_service_VRACK": "Supprimer Vrack",
"autorenew_agora_terminate_service_warning_VRACK": "Veuillez confirmer la suppression de Vrack",
"autorenew_agora_terminate_service_success_VRACK": "Votre demande de suppression 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 suppression de votre Vrack. {{error}}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
hasAutoRenew: '<',
homeLink: '<',
isAutorenewManagementAvailable: '<',
canDeleteVrack: '<',
isAutorenew2016DeploymentBannerAvailable: '<',
isEnterpriseCustomer: '<',
nicBilling: '<',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
tracking-page="{{ $ctrl.trackingPage }}"
user="$ctrl.currentUser"
billing-management-availability="$ctrl.isAutorenewManagementAvailable"
delete-vrack-availability="$ctrl.canDeleteVrack"
>
</billing-services-actions>
</oui-datagrid-column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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 terminateVrack from './actions/terminate-vrack';
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 @@ -72,6 +73,7 @@ angular
terminatePrivateDatabase,
terminateWebCoach,
terminateAllDOm,
terminateVrack,
uiRouter,
update,
warnNicBilling,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default /* @ngInject */ ($stateProvider, coreConfigProvider) => {
},
featureAvailability: /* @ngInject */ (ovhFeatureFlipping) =>
ovhFeatureFlipping.checkFeatureAvailability([
'vrack:delete',
'billing:management',
'billing:autorenew2016Deployment',
]),
Expand All @@ -107,6 +108,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
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import template from './template.html';
import controller from './controller';

export default {
bindings: {
goBack: '<',
service: '<',
serviceType: '<',
isEmpty: '<',
},
controller,
template,
name: 'billingAutorenewTerminateVrack',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const TERMINATE_PATTERN = /^TERMINATE$/;

export default {
TERMINATE_PATTERN,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { TERMINATE_PATTERN } from './constants';

export default class TerminateVrackController {
/* @ngInject */
constructor($translate, BillingTerminate) {
this.TERMINATE_PATTERN = TERMINATE_PATTERN;
this.$translate = $translate;
this.BillingTerminate = BillingTerminate;
}

terminate() {
this.BillingTerminate.serviceTerminationForVrack(this.service)
.then(() => this.onSuccess())
.catch((error) => this.onError({ error }));
}

onSuccess() {
this.goBack(
this.$translate.instant(
`autorenew_agora_terminate_service_success_VRACK`,
),
'success',
);
}

onError(error) {
this.goBack(
this.$translate.instant(`autorenew_agora_terminate_service_error_VRACK`, {
error: error?.data?.message,
}),
'danger',
);
}
}
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 = 'ovhManagerBillingAutorenewTerminateVrack';

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,36 @@
export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('billing.autorenew.terminateVrack', {
url: '/terminate-vrack?service&serviceType',
views: {
modal: {
component: 'billingAutorenewTerminateVrack',
},
},
layout: 'modal',
resolve: {
goBack: /* @ngInject */ (goToAutorenew) => goToAutorenew,
service: /* @ngInject */ ($transition$) => $transition$.params().service,
serviceType: /* @ngInject */ ($transition$) =>
$transition$.params().serviceType,
isEmpty: /* @ngInject */ (OvhApiVrack, service) =>
OvhApiVrack.Aapi()
.services({ serviceName: service })
.$promise.then((allServicesParam) => {
console.log('>>>>>>', allServicesParam);
const services = Object.entries(allServicesParam).filter(
([, value]) => {
return Array.isArray(value) && value.length;
},
);
return !services.length;
})
.catch(() => {
return false;
}),
breadcrumb: () => null,
},
atInternet: {
ignore: true,
},
});
};
Loading
Loading