diff --git a/packages/manager/modules/billing-components/src/components/cancellation-form/confirm-terminate.constants.js b/packages/manager/modules/billing-components/src/components/cancellation-form/confirm-terminate.constants.js index bd66bfcd498c..c13aa5809ce8 100644 --- a/packages/manager/modules/billing-components/src/components/cancellation-form/confirm-terminate.constants.js +++ b/packages/manager/modules/billing-components/src/components/cancellation-form/confirm-terminate.constants.js @@ -7,6 +7,7 @@ export const SERVICE_WITH_AGORA_TERMINATION = [ 'vrack-services', 'okms', 'logs-account', + 'nutanix', ]; export const SERVICE_GROUP_WITH_AGORA_TERMINATION_REGEX = /hycu-vms-*|(logs-enterprise(-hds)?$)/; diff --git a/packages/manager/modules/billing-components/src/components/services-actions/service-actions.constants.js b/packages/manager/modules/billing-components/src/components/services-actions/service-actions.constants.js index 52c7065e7bea..125869efd1f8 100644 --- a/packages/manager/modules/billing-components/src/components/services-actions/service-actions.constants.js +++ b/packages/manager/modules/billing-components/src/components/services-actions/service-actions.constants.js @@ -16,6 +16,7 @@ export const SERVICE_TYPE = { VRACK_SERVICES: 'VRACK_SERVICES_RESOURCE', VRACK: 'VRACK', VMWARE_CLOUD_DIRECTOR_ORGANIZATION: 'VMWARE_CLOUD_DIRECTOR_ORGANIZATION', + NUTANIX: 'NUTANIX', }; export const RENEW_URL = { @@ -44,7 +45,10 @@ export const RENEW_URL = { WE: 'https://ca.ovh.com/fr/cgi-bin/order/renew.cgi?domainChooser=', }; +export const SERVICE_ACTIVE_STATUS = 'ACTIVE'; + export default { + SERVICE_ACTIVE_STATUS, RENEW_URL, SERVICE_TYPE, }; diff --git a/packages/manager/modules/billing-components/src/components/services-actions/services-actions.component.js b/packages/manager/modules/billing-components/src/components/services-actions/services-actions.component.js index 89f0133ee76b..4b087722c065 100644 --- a/packages/manager/modules/billing-components/src/components/services-actions/services-actions.component.js +++ b/packages/manager/modules/billing-components/src/components/services-actions/services-actions.component.js @@ -11,6 +11,8 @@ export default { getCancelCommitmentLink: '&?', getCancelResiliationLink: '&?', getResiliationLink: '&?', + handleGoToResiliation: '&?', + isCustomResiliationHandled: ' { this.autorenewLink = links.autorenewLink; + this.billingManagementAvailabilityAndHaveAutorenewLink = + links.billingManagementAvailabilityAndHaveAutorenewLink; this.commitmentLink = links.commitmentLink; this.cancelCommitmentLink = links.cancelCommitmentLink; this.cancelResiliationLink = links.cancelResiliationLink; @@ -95,4 +101,12 @@ export default class ServicesActionsCtrl { this.atInternet.trackClick({ name, type: 'action' }); } } + + handleClickResiliate() { + this.trackAction('go-to-resiliate'); + + if (this.handleGoToResiliation) { + this.handleGoToResiliation(); + } + } } diff --git a/packages/manager/modules/billing-components/src/components/services-actions/services-actions.html b/packages/manager/modules/billing-components/src/components/services-actions/services-actions.html index 4bee43f329d0..71c838a5f266 100644 --- a/packages/manager/modules/billing-components/src/components/services-actions/services-actions.html +++ b/packages/manager/modules/billing-components/src/components/services-actions/services-actions.html @@ -2,7 +2,7 @@ aria-label="{{:: 'billing_services_actions_menu_label' | translate }}" compact data-placement="end" - data-ng-if="!$ctrl.isLoading && ($ctrl.autorenewLink || $ctrl.service.canBeEngaged || $ctrl.service.hasPendingEngagement)" + data-ng-if="!$ctrl.isLoading && (($ctrl.billingManagementAvailabilityAndHaveAutorenewLink && $ctrl.service.serviceType !== $ctrl.SERVICE_TYPE.NUTANIX) || ($ctrl.service.serviceType === $ctrl.SERVICE_TYPE.NUTANIX && $ctrl.service.status === $ctrl.SERVICE_ACTIVE_STATUS) || $ctrl.service.canBeEngaged || $ctrl.service.hasPendingEngagement)" >
diff --git a/packages/manager/modules/billing-components/src/components/subscription-tile/subscription-tile.component.js b/packages/manager/modules/billing-components/src/components/subscription-tile/subscription-tile.component.js index 6d3ff0fa71e8..c7f1c04471f1 100644 --- a/packages/manager/modules/billing-components/src/components/subscription-tile/subscription-tile.component.js +++ b/packages/manager/modules/billing-components/src/components/subscription-tile/subscription-tile.component.js @@ -18,6 +18,8 @@ export default { commitImpressionData: '

diff --git a/packages/manager/modules/billing-components/src/components/utils/billing.links.service.js b/packages/manager/modules/billing-components/src/components/utils/billing.links.service.js index df3a85a51dc4..608be0579ccf 100644 --- a/packages/manager/modules/billing-components/src/components/utils/billing.links.service.js +++ b/packages/manager/modules/billing-components/src/components/utils/billing.links.service.js @@ -11,7 +11,6 @@ export default class BillingLinksService { generateAutorenewLinks(service, options) { const { - billingManagementAvailability, getCommitmentLink, getCancelCommitmentLink, getCancelResiliationLink, @@ -21,9 +20,7 @@ export default class BillingLinksService { const links = {}; const fetchAutoRenewLink = this.$q.defer(); - if (!billingManagementAvailability) { - fetchAutoRenewLink.resolve(null); - } else if (this.$injector.has('shellClient')) { + if (this.$injector.has('shellClient')) { this.$injector .get('shellClient') .navigation.getURL('dedicated', '#/billing/autorenew') @@ -37,6 +34,8 @@ export default class BillingLinksService { return fetchAutoRenewLink.promise.then((autorenewLink) => { links.autorenewLink = autorenewLink; + links.billingManagementAvailabilityAndHaveAutorenewLink = + options.billingManagementAvailability && !!autorenewLink; if (service.SERVICE_TYPE === SERVICE_TYPE.VRACK) return links; @@ -110,8 +109,7 @@ export default class BillingLinksService { default: links.resiliateLink = service.canResiliateByEndRule() ? resiliationByEndRuleLink - : autorenewLink && - `${autorenewLink}/delete?serviceId=${service.serviceId}${serviceTypeParam}`; + : `${links.autorenewLink}/delete?serviceId=${service.serviceId}${serviceTypeParam}`; break; } diff --git a/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/component.js b/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/component.js index ad2344d2f2db..9675cc05da78 100644 --- a/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/component.js +++ b/packages/manager/modules/billing/src/autoRenew/actions/terminate-agora-service/component.js @@ -6,6 +6,7 @@ export default { goBack: '<', id: '<', serviceType: '<', + serviceName: ' { + $stateProvider.state('nutanix.dashboard.general-info.resiliate.**', { + url: '/resiliate', + lazyLoad: ($transition$) => { + const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); + + return import('./resiliate.module').then((mod) => + $ocLazyLoad.inject(mod.default || mod), + ); + }, + }); + }, +); + +export default moduleName; diff --git a/packages/manager/modules/nutanix/src/dashboard/general-info/resiliate/resiliate.module.js b/packages/manager/modules/nutanix/src/dashboard/general-info/resiliate/resiliate.module.js new file mode 100644 index 000000000000..6d53d17d0313 --- /dev/null +++ b/packages/manager/modules/nutanix/src/dashboard/general-info/resiliate/resiliate.module.js @@ -0,0 +1,19 @@ +import angular from 'angular'; + +import '@uirouter/angularjs'; +import 'angular-translate'; + +import ovhManagerBillingComponents from '@ovh-ux/manager-billing-components'; +import routing from './resiliate.routing'; + +const moduleName = 'ovhManagerNutanixDashboardGeneralInfoResiliate'; + +angular + .module(moduleName, [ + 'pascalprecht.translate', + 'ui.router', + ovhManagerBillingComponents, + ]) + .config(routing); + +export default moduleName; diff --git a/packages/manager/modules/nutanix/src/dashboard/general-info/resiliate/resiliate.routing.js b/packages/manager/modules/nutanix/src/dashboard/general-info/resiliate/resiliate.routing.js new file mode 100644 index 000000000000..a244ce1c0ec3 --- /dev/null +++ b/packages/manager/modules/nutanix/src/dashboard/general-info/resiliate/resiliate.routing.js @@ -0,0 +1,43 @@ +import { SERVICE_TYPE } from './constant'; + +export default /* @ngInject */ ($stateProvider) => { + $stateProvider.state('nutanix.dashboard.general-info.resiliate', { + url: '/resiliate', + views: { + modal: { + component: 'billingAutorenewTerminateAgoraService', + }, + }, + params: { + serviceName: null, + }, + layout: 'modal', + resolve: { + serviceType: () => SERVICE_TYPE, + id: /* @ngInject */ (serviceInfo) => serviceInfo.serviceId, + goBack: /* @ngInject */ ($state, $timeout, Alerter, serviceName) => ( + message, + type, + ) => { + const promise = $state.go('nutanix.dashboard.general-info', { + serviceName, + }); + + if (message) { + promise.then(() => + $timeout(() => + Alerter.set( + `alert-${type}`, + message, + null, + 'nutanix-dashboard-alert', + ), + ), + ); + } + + return promise; + }, + }, + }); +}; diff --git a/packages/manager/modules/nutanix/src/dashboard/general-info/routing.js b/packages/manager/modules/nutanix/src/dashboard/general-info/routing.js index 31d16c400c7f..1c4bc2c29ced 100644 --- a/packages/manager/modules/nutanix/src/dashboard/general-info/routing.js +++ b/packages/manager/modules/nutanix/src/dashboard/general-info/routing.js @@ -55,6 +55,10 @@ export default /* @ngInject */ ($stateProvider) => { ), goToRedeploy: /* @ngInject */ ($state) => () => $state.go('nutanix.dashboard.general-info.redeploy'), + goToResiliate: /* @ngInject */ ($state) => (serviceName) => + $state.go('nutanix.dashboard.general-info.resiliate', { + serviceName, + }), breadcrumb: /* @ngInject */ ($translate) => $translate.instant('nutanix_dashboard_general_info'), isPackTypeAvailable: /* @ngInject */ (ovhFeatureFlipping) => diff --git a/packages/manager/modules/nutanix/src/dashboard/general-info/template.html b/packages/manager/modules/nutanix/src/dashboard/general-info/template.html index 8806ba3b6c3c..b43009f5b28c 100644 --- a/packages/manager/modules/nutanix/src/dashboard/general-info/template.html +++ b/packages/manager/modules/nutanix/src/dashboard/general-info/template.html @@ -1,3 +1,4 @@ +

@@ -247,12 +248,13 @@ go-to-commit="$ctrl.goToCommit()" go-to-cancel-commit="$ctrl.goToCancelCommit()" go-to-cancel-resiliation="$ctrl.goToCancelResiliation()" - go-to-resiliation="$ctrl.goToResiliation()" service-infos="$ctrl.serviceInfo" user="$ctrl.user" tracking-prefix="Enterprise_solutions::nutanix::nutanix" tracking-page="Enterprise_solutions::nutanix::nutanix::nutanix::dashboard::general-information" tracking-name-suffix="nutanix" + is-custom-resiliation-handled="true" + handle-go-to-resiliation="$ctrl.goToResiliate($ctrl.serviceName)" >
diff --git a/packages/manager/modules/nutanix/src/dashboard/nodes/node/routing.js b/packages/manager/modules/nutanix/src/dashboard/nodes/node/routing.js index 0762d36b5928..9aa6e84e9f8a 100644 --- a/packages/manager/modules/nutanix/src/dashboard/nodes/node/routing.js +++ b/packages/manager/modules/nutanix/src/dashboard/nodes/node/routing.js @@ -6,7 +6,33 @@ export default /* @ngInject */ ($stateProvider) => { component: 'nutanixNode', }, }, - redirectTo: 'nutanix.dashboard.nodes.node.general-info', + redirectTo: (transition) => { + const $translatePromise = transition.injector().getAsync('$translate'); + const serviceInfoPromise = transition.injector().getAsync('serviceInfo'); + + return Promise.all([$translatePromise, serviceInfoPromise]).then( + ([$translate, serviceInfo]) => { + if (serviceInfo.isResiliated()) { + return { + state: 'error', + params: { + detail: { + message: $translate.instant( + 'nutanix_dashboard_service_suspended', + ), + status: 'EXPIRED', + code: 404, + }, + to: { + state: 'nutanix.index', + }, + }, + }; + } + return 'nutanix.dashboard.nodes.node.general-info'; + }, + ); + }, resolve: { nodeId: /* @ngInject */ ($transition$) => $transition$.params().nodeId, node: /* @ngInject */ (nodeId, NutanixService) => diff --git a/packages/manager/modules/nutanix/src/dashboard/nodes/routing.js b/packages/manager/modules/nutanix/src/dashboard/nodes/routing.js index 06446d1feca3..60e869f8749f 100644 --- a/packages/manager/modules/nutanix/src/dashboard/nodes/routing.js +++ b/packages/manager/modules/nutanix/src/dashboard/nodes/routing.js @@ -1,7 +1,33 @@ export default /* @ngInject */ ($stateProvider) => { $stateProvider.state('nutanix.dashboard.nodes', { url: '/nodes', - redirectTo: 'nutanix.dashboard.nodes.all', + redirectTo: (transition) => { + const $translatePromise = transition.injector().getAsync('$translate'); + const serviceInfoPromise = transition.injector().getAsync('serviceInfo'); + + return Promise.all([$translatePromise, serviceInfoPromise]).then( + ([$translate, serviceInfo]) => { + if (serviceInfo.isResiliated()) { + return { + state: 'error', + params: { + detail: { + message: $translate.instant( + 'nutanix_dashboard_service_suspended', + ), + status: 'EXPIRED', + code: 404, + }, + to: { + state: 'nutanix.dashboard.nodes.all', + }, + }, + }; + } + return 'nutanix.dashboard.nodes.node.general-info'; + }, + ); + }, resolve: { breadcrumb: /* @ngInject */ ($translate) => $translate.instant('nutanix_dashboard_nodes'), diff --git a/packages/manager/modules/nutanix/src/dashboard/routing.js b/packages/manager/modules/nutanix/src/dashboard/routing.js index 4999b33f11e7..a0846668f796 100644 --- a/packages/manager/modules/nutanix/src/dashboard/routing.js +++ b/packages/manager/modules/nutanix/src/dashboard/routing.js @@ -3,7 +3,34 @@ import { OLD_CLUSTER_PLAN_CODE } from './constants'; export default /* @ngInject */ ($stateProvider) => { $stateProvider.state('nutanix.dashboard', { url: '/:serviceName', - redirectTo: 'nutanix.dashboard.general-info', + redirectTo: (transition) => { + const $translatePromise = transition.injector().getAsync('$translate'); + const serviceInfoPromise = transition.injector().getAsync('serviceInfo'); + + return Promise.all([$translatePromise, serviceInfoPromise]).then( + ([$translate, serviceInfo]) => { + if (serviceInfo.isResiliated()) { + return { + state: 'error', + params: { + detail: { + message: $translate.instant( + 'nutanix_dashboard_service_suspended', + ), + status: 'EXPIRED', + code: 404, + }, + to: { + state: 'nutanix.index', + }, + }, + }; + } + + return 'nutanix.dashboard.general-info'; + }, + ); + }, component: 'nutanixDashboard', resolve: { trackingPrefix: /* @ngInject */ () => 'hpc::nutanix::cluster', diff --git a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_de_DE.json b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_de_DE.json index b8a135603c98..b2268df9f79c 100644 --- a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_de_DE.json +++ b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_de_DE.json @@ -4,5 +4,6 @@ "nutanix_dashboard_guides_header": "Anleitungen", "nutanix_dashboard_guides_header_all_guides": "Alle Anleitungen", "nutanix_dashboard_cluster_warning1": "Ihre Nutanix-Lizenz muss vor dem [{{endDate}}] auf Ihrem Cluster in Prism Central registriert werden.", - "nutanix_dashboard_cluster_warning2": "Registrieren Sie Ihre Lizenz" + "nutanix_dashboard_cluster_warning2": "Registrieren Sie Ihre Lizenz", + "nutanix_dashboard_service_suspended": "Der Dienst wurde gekündigt." } diff --git a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_en_GB.json b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_en_GB.json index 280930eb5cbd..f3bcecfbf5dc 100644 --- a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_en_GB.json +++ b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_en_GB.json @@ -4,5 +4,6 @@ "nutanix_dashboard_guides_header": "Guides", "nutanix_dashboard_guides_header_all_guides": "All guides", "nutanix_dashboard_cluster_warning1": "You must register your Nutanix licence on your cluster in Prism Central before [{{endDate}}]", - "nutanix_dashboard_cluster_warning2": "Register your licence" + "nutanix_dashboard_cluster_warning2": "Register your licence", + "nutanix_dashboard_service_suspended": "The service has been cancelled." } diff --git a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_es_ES.json b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_es_ES.json index a9d20aa01796..1382e103f76c 100644 --- a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_es_ES.json +++ b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_es_ES.json @@ -4,5 +4,6 @@ "nutanix_dashboard_guides_header": "Guías", "nutanix_dashboard_guides_header_all_guides": "Todas las guías", "nutanix_dashboard_cluster_warning1": "Debe registrar su licencia Nutanix en su cluster en Prism Central antes del [{{endDate}}].", - "nutanix_dashboard_cluster_warning2": "Registre su licencia" + "nutanix_dashboard_cluster_warning2": "Registre su licencia", + "nutanix_dashboard_service_suspended": "El servicio se ha dado de baja." } diff --git a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_fr_CA.json b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_fr_CA.json index 8740d0bc844f..b559f616c93c 100644 --- a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_fr_CA.json +++ b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_fr_CA.json @@ -4,5 +4,6 @@ "nutanix_dashboard_guides_header": "Guides", "nutanix_dashboard_guides_header_all_guides": "Tous les guides", "nutanix_dashboard_cluster_warning1": "Vous devez enregistrer votre licence Nutanix sur votre cluster dans Prism Central avant le [{{endDate}}]", - "nutanix_dashboard_cluster_warning2": "Enregistrez votre licence" + "nutanix_dashboard_cluster_warning2": "Enregistrez votre licence", + "nutanix_dashboard_service_suspended": "Le service a été résilié." } diff --git a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_fr_FR.json b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_fr_FR.json index 8740d0bc844f..b559f616c93c 100644 --- a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_fr_FR.json +++ b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_fr_FR.json @@ -4,5 +4,6 @@ "nutanix_dashboard_guides_header": "Guides", "nutanix_dashboard_guides_header_all_guides": "Tous les guides", "nutanix_dashboard_cluster_warning1": "Vous devez enregistrer votre licence Nutanix sur votre cluster dans Prism Central avant le [{{endDate}}]", - "nutanix_dashboard_cluster_warning2": "Enregistrez votre licence" + "nutanix_dashboard_cluster_warning2": "Enregistrez votre licence", + "nutanix_dashboard_service_suspended": "Le service a été résilié." } diff --git a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_it_IT.json b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_it_IT.json index 0b3430de092f..41bb236052a1 100644 --- a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_it_IT.json +++ b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_it_IT.json @@ -4,5 +4,6 @@ "nutanix_dashboard_guides_header": "Guide", "nutanix_dashboard_guides_header_all_guides": "Tutte le guide", "nutanix_dashboard_cluster_warning1": "Registra la tua licenza Nutanix sul tuo cluster in Prism Central prima del [{{endDate}}]", - "nutanix_dashboard_cluster_warning2": "Registra la tua licenza" + "nutanix_dashboard_cluster_warning2": "Registra la tua licenza", + "nutanix_dashboard_service_suspended": "Il servizio è stato disattivato." } diff --git a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_pl_PL.json b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_pl_PL.json index df0d592a3bcf..8e1953fadfac 100644 --- a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_pl_PL.json +++ b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_pl_PL.json @@ -4,5 +4,6 @@ "nutanix_dashboard_guides_header": "Przewodniki", "nutanix_dashboard_guides_header_all_guides": "Wszystkie przewodniki", "nutanix_dashboard_cluster_warning1": "Należy zarejestrować licencję Nutanix na klastrze w Prism Central przed [{{endDate}}]", - "nutanix_dashboard_cluster_warning2": "Zarejestruj licencję" + "nutanix_dashboard_cluster_warning2": "Zarejestruj licencję", + "nutanix_dashboard_service_suspended": "Usługa została zakończona." } diff --git a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_pt_PT.json b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_pt_PT.json index 15d155aba7cd..7ac08086157f 100644 --- a/packages/manager/modules/nutanix/src/dashboard/translations/Messages_pt_PT.json +++ b/packages/manager/modules/nutanix/src/dashboard/translations/Messages_pt_PT.json @@ -4,5 +4,6 @@ "nutanix_dashboard_guides_header": "Manuais", "nutanix_dashboard_guides_header_all_guides": "Todos os manuais", "nutanix_dashboard_cluster_warning1": "Deve registar a licença Nutanix no seu cluster em Prism Central antes de [{{endDate}}]", - "nutanix_dashboard_cluster_warning2": "Registe a sua licença" + "nutanix_dashboard_cluster_warning2": "Registe a sua licença", + "nutanix_dashboard_service_suspended": "O serviço foi rescindido." }