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.nodes.all.resiliate-node.**', { + url: '/resiliate/:nodeId', + 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/nodes/list/resiliate-node/resiliate.module.js b/packages/manager/modules/nutanix/src/dashboard/nodes/list/resiliate-node/resiliate.module.js new file mode 100644 index 000000000000..547156c6a269 --- /dev/null +++ b/packages/manager/modules/nutanix/src/dashboard/nodes/list/resiliate-node/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 = 'ovhManagerNutanixDashboardNodeResiliate'; + +angular + .module(moduleName, [ + 'pascalprecht.translate', + 'ui.router', + ovhManagerBillingComponents, + ]) + .config(routing); + +export default moduleName; diff --git a/packages/manager/modules/nutanix/src/dashboard/nodes/list/resiliate-node/resiliate.routing.js b/packages/manager/modules/nutanix/src/dashboard/nodes/list/resiliate-node/resiliate.routing.js new file mode 100644 index 000000000000..89c8e60dafdd --- /dev/null +++ b/packages/manager/modules/nutanix/src/dashboard/nodes/list/resiliate-node/resiliate.routing.js @@ -0,0 +1,50 @@ +import { SERVICE_TYPE } from './constant'; + +export default /* @ngInject */ ($stateProvider) => { + $stateProvider.state('nutanix.dashboard.nodes.all.resiliate-node', { + url: '/resiliate/:nodeName', + views: { + modal: { + component: 'billingAutorenewTerminateAgoraService', + }, + }, + params: { + serviceName: null, + }, + layout: 'modal', + resolve: { + serviceType: () => SERVICE_TYPE, + nodeName: /* @ngInject */ ($transition$) => + $transition$.params().nodeName, + serviceName: /* @ngInject */ (nodeName) => nodeName, + id: /* ngInject */ (server) => server.serviceId, + server: /* @ngInject */ (nodeName, NutanixService) => + NutanixService.getServer(nodeName), + goBack: /* @ngInject */ ( + $state, + $timeout, + Alerter, + clusterServiceName, + ) => (message, type) => { + const promise = $state.go('nutanix.dashboard.nodes.all', { + clusterServiceName, + }); + + 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/routing.js b/packages/manager/modules/nutanix/src/dashboard/routing.js index 1f3ea94de272..40bdeab778f7 100644 --- a/packages/manager/modules/nutanix/src/dashboard/routing.js +++ b/packages/manager/modules/nutanix/src/dashboard/routing.js @@ -26,6 +26,8 @@ export default /* @ngInject */ ($stateProvider) => { NutanixService.getServer(nodeId), serviceName: /* @ngInject */ ($transition$) => $transition$.params().serviceName, + clusterServiceName: /* @ngInject */ ($transition$) => + $transition$.params().serviceName, serviceInfo: /* @ngInject */ (NutanixService, serviceName) => NutanixService.getServiceInfo(serviceName), serviceDetails: /* @ngInject */ (NutanixService, serviceInfo) =>