-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dedicated): delete vrack from billing autorenew page
ref: MANAGER-15077 Signed-off-by: soufien mhelhali <[email protected]>
- Loading branch information
soufien mhelhali
committed
Jan 17, 2025
1 parent
a81ac1b
commit f79eb80
Showing
26 changed files
with
361 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack/component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}; |
5 changes: 5 additions & 0 deletions
5
packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack/constants.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const TERMINATE_PATTERN = /^TERMINATE$/; | ||
|
||
export default { | ||
TERMINATE_PATTERN, | ||
}; |
34 changes: 34 additions & 0 deletions
34
packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack/controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
35 changes: 35 additions & 0 deletions
35
packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack/routing.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
}); | ||
}; |
44 changes: 44 additions & 0 deletions
44
packages/manager/modules/billing/src/autoRenew/actions/terminate-vrack/template.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
9 changes: 9 additions & 0 deletions
9
...er/modules/billing/src/autoRenew/actions/terminate-vrack/translations/Messages_fr_FR.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/manager/modules/new-billing/src/autoRenew/actions/terminate-vrack/component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}; |
5 changes: 5 additions & 0 deletions
5
packages/manager/modules/new-billing/src/autoRenew/actions/terminate-vrack/constants.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const TERMINATE_PATTERN = /^TERMINATE$/; | ||
|
||
export default { | ||
TERMINATE_PATTERN, | ||
}; |
34 changes: 34 additions & 0 deletions
34
packages/manager/modules/new-billing/src/autoRenew/actions/terminate-vrack/controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
packages/manager/modules/new-billing/src/autoRenew/actions/terminate-vrack/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
36 changes: 36 additions & 0 deletions
36
packages/manager/modules/new-billing/src/autoRenew/actions/terminate-vrack/routing.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
}); | ||
}; |
Oops, something went wrong.